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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/lookup.h" 8 #include "src/lookup.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 13
14 void LookupIterator::Next() { 14 void LookupIterator::Next() {
15 has_property_ = false; 15 has_property_ = false;
16 do { 16 do {
17 state_ = LookupInHolder(); 17 state_ = LookupInHolder();
18 } while (!IsFound() && NextHolder()); 18 } while (!IsFound() && NextHolder());
19 } 19 }
20 20
21 21
22 Handle<JSReceiver> LookupIterator::GetRoot() const { 22 Handle<JSReceiver> LookupIterator::GetRoot() const {
23 Handle<Object> receiver = GetReceiver(); 23 Handle<Object> receiver = GetReceiver();
24 if (receiver->IsJSReceiver()) return Handle<JSReceiver>::cast(receiver); 24 if (receiver->IsJSReceiver()) return Handle<JSReceiver>::cast(receiver);
25 Context* native_context = isolate_->context()->native_context(); 25 Handle<Object> root =
26 JSFunction* function; 26 handle(receiver->GetRootMap(isolate_)->prototype(), isolate_);
27 if (receiver->IsNumber()) { 27 CHECK(!root->IsNull());
28 function = native_context->number_function(); 28 return Handle<JSReceiver>::cast(root);
29 } else if (receiver->IsString()) {
30 function = native_context->string_function();
31 } else if (receiver->IsSymbol()) {
32 function = native_context->symbol_function();
33 } else if (receiver->IsBoolean()) {
34 function = native_context->boolean_function();
35 } else {
36 UNREACHABLE();
37 function = NULL;
38 }
39 return handle(JSReceiver::cast(function->instance_prototype()));
40 } 29 }
41 30
42 31
43 Handle<Map> LookupIterator::GetReceiverMap() const { 32 Handle<Map> LookupIterator::GetReceiverMap() const {
44 Handle<Object> receiver = GetReceiver(); 33 Handle<Object> receiver = GetReceiver();
45 if (receiver->IsNumber()) return isolate_->factory()->heap_number_map(); 34 if (receiver->IsNumber()) return isolate_->factory()->heap_number_map();
46 return handle(Handle<HeapObject>::cast(receiver)->map()); 35 return handle(Handle<HeapObject>::cast(receiver)->map());
47 } 36 }
48 37
49 38
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 Handle<Object> value = FetchValue(); 180 Handle<Object> value = FetchValue();
192 if (value->IsTheHole()) { 181 if (value->IsTheHole()) {
193 ASSERT(property_details_.IsReadOnly()); 182 ASSERT(property_details_.IsReadOnly());
194 return factory()->undefined_value(); 183 return factory()->undefined_value();
195 } 184 }
196 return value; 185 return value;
197 } 186 }
198 187
199 188
200 } } // namespace v8::internal 189 } } // namespace v8::internal
OLDNEW
« 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