| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |