Reviewers: dcarney,
Description:
Simplify Object::GetElementWithReceiver
Don't inline GetPrototype() to avoid code duplication
BUG=none
[email protected]
LOG=n
Please review this at https://codereview.chromium.org/331313010/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+6, -17 lines):
M src/objects.cc
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
0e5d9a26a277a890c673e0338a16bfceb143dbe4..05be9a27591e6d5bcf5737ce1566869cb67b26b1
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -813,26 +813,15 @@ MaybeHandle<Object>
Object::GetElementWithReceiver(Isolate* isolate,
!holder->IsNull();
holder = Handle<Object>(holder->GetPrototype(isolate), isolate)) {
if (!holder->IsJSObject()) {
- Context* native_context = isolate->context()->native_context();
- if (holder->IsNumber()) {
- holder = Handle<Object>(
- native_context->number_function()->instance_prototype(),
isolate);
- } else if (holder->IsString()) {
- holder = Handle<Object>(
- native_context->string_function()->instance_prototype(),
isolate);
- } else if (holder->IsSymbol()) {
- holder = Handle<Object>(
- native_context->symbol_function()->instance_prototype(),
isolate);
- } else if (holder->IsBoolean()) {
- holder = Handle<Object>(
- native_context->boolean_function()->instance_prototype(),
isolate);
- } else if (holder->IsJSProxy()) {
+ if (holder->IsJSProxy()) {
return JSProxy::GetElementWithHandler(
Handle<JSProxy>::cast(holder), receiver, index);
- } else {
- // Undefined and null have no indexed properties.
- ASSERT(holder->IsUndefined() || holder->IsNull());
+ } else if (holder->IsUndefined()) {
+ // Undefined has no indexed properties.
return isolate->factory()->undefined_value();
+ } else {
+ holder = Handle<Object>(holder->GetPrototype(isolate), isolate);
+ ASSERT(holder->IsJSObject());
}
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.