Unify LookupIterator::GetRoot and Objects::GetRootMap
BUG=none R=verwaest@chromium.org LOG=n Review URL: https://codereview.chromium.org/388193002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22369 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
cc9a9f4191
commit
712957548d
@ -22,21 +22,10 @@ void LookupIterator::Next() {
|
||||
Handle<JSReceiver> LookupIterator::GetRoot() const {
|
||||
Handle<Object> receiver = GetReceiver();
|
||||
if (receiver->IsJSReceiver()) return Handle<JSReceiver>::cast(receiver);
|
||||
Context* native_context = isolate_->context()->native_context();
|
||||
JSFunction* function;
|
||||
if (receiver->IsNumber()) {
|
||||
function = native_context->number_function();
|
||||
} else if (receiver->IsString()) {
|
||||
function = native_context->string_function();
|
||||
} else if (receiver->IsSymbol()) {
|
||||
function = native_context->symbol_function();
|
||||
} else if (receiver->IsBoolean()) {
|
||||
function = native_context->boolean_function();
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
function = NULL;
|
||||
}
|
||||
return handle(JSReceiver::cast(function->instance_prototype()));
|
||||
Handle<Object> root =
|
||||
handle(receiver->GetRootMap(isolate_)->prototype(), isolate_);
|
||||
CHECK(!root->IsNull());
|
||||
return Handle<JSReceiver>::cast(root);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1570,6 +1570,7 @@ class Object {
|
||||
#endif
|
||||
|
||||
private:
|
||||
friend class LookupIterator;
|
||||
friend class PrototypeIterator;
|
||||
|
||||
// Return the map of the root of object's prototype chain.
|
||||
|
Loading…
Reference in New Issue
Block a user