Author: [email protected]
Date: Wed May 6 17:10:01 2009
New Revision: 1888
Modified:
branches/bleeding_edge/src/bootstrapper.cc
Log:
The ARM assembler tests don't install the standard JS natives. When
setting up push and pop we shouldn't make too many assumptions about
the structure of classes like 'Array'.
Review URL: http://codereview.chromium.org/113068
Modified: branches/bleeding_edge/src/bootstrapper.cc
==============================================================================
--- branches/bleeding_edge/src/bootstrapper.cc (original)
+++ branches/bleeding_edge/src/bootstrapper.cc Wed May 6 17:10:01 2009
@@ -1483,14 +1483,19 @@
JSFunction::cast(global->GetProperty(Heap::Array_symbol())));
Handle<JSObject> visible_prototype =
Handle<JSObject>(JSObject::cast(function->prototype()));
- // Remember to skip the hidden prototype:
- Handle<JSObject> hidden_prototype =
- Handle<JSObject>(JSObject::cast(visible_prototype->GetPrototype()));
- AddSpecialFunction(hidden_prototype, "pop",
+ // Remember to put push and pop on the hidden prototype if it's there.
+ Handle<JSObject> push_and_pop_prototype;
+ Handle<Object> superproto(visible_prototype->GetPrototype());
+ if (superproto->IsJSObject() &&
+ JSObject::cast(*superproto)->map()->is_hidden_prototype()) {
+ push_and_pop_prototype = Handle<JSObject>::cast(superproto);
+ } else {
+ push_and_pop_prototype = visible_prototype;
+ }
+ AddSpecialFunction(push_and_pop_prototype, "pop",
Handle<Code>(Builtins::builtin(Builtins::ArrayPop)));
- AddSpecialFunction(hidden_prototype, "push",
+ AddSpecialFunction(push_and_pop_prototype, "push",
Handle<Code>(Builtins::builtin(Builtins::ArrayPush)));
- ASSERT(hidden_prototype->map()->is_hidden_prototype());
}
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---