Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: src/lookup.cc

Issue 388193002: Unify LookupIterator::GetRoot and Objects::GetRootMap (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index 5391640ac1f1f1a3e7dc4f6f831b2c6724b039c2..1b46f2c8292362c054c0239d6a4c9cdacb52ed2d 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -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);
}
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698