Chromium Code Reviews| 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/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
| 9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
| 10 #include "src/lookup-inl.h" | 10 #include "src/lookup-inl.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 interceptor_state_ = InterceptorState::kProcessNonMasking; | 52 interceptor_state_ = InterceptorState::kProcessNonMasking; |
| 53 state_ = NOT_FOUND; | 53 state_ = NOT_FOUND; |
| 54 property_details_ = PropertyDetails::Empty(); | 54 property_details_ = PropertyDetails::Empty(); |
| 55 number_ = DescriptorArray::kNotFound; | 55 number_ = DescriptorArray::kNotFound; |
| 56 holder_ = initial_holder_; | 56 holder_ = initial_holder_; |
| 57 holder_map_ = handle(holder_->map(), isolate_); | 57 holder_map_ = handle(holder_->map(), isolate_); |
| 58 Next(); | 58 Next(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 | 61 |
| 62 Handle<JSReceiver> LookupIterator::GetRoot(Handle<Object> receiver, | 62 Handle<JSReceiver> LookupIterator::GetRoot() { |
|
Igor Sheludko
2015/07/10 10:02:42
I think it is better to keep GetRoot() static give
| |
| 63 Isolate* isolate) { | 63 if (receiver_->IsJSReceiver()) return Handle<JSReceiver>::cast(receiver_); |
| 64 if (receiver->IsJSReceiver()) return Handle<JSReceiver>::cast(receiver); | 64 // Strings are the only objects with properties (only elements) directly on |
| 65 auto root = handle(receiver->GetRootMap(isolate)->prototype(), isolate); | 65 // the wrapper. Hence we can skip generating the wrapper for all other cases. |
| 66 if (IsElement() && receiver_->IsString() && | |
| 67 index_ < static_cast<uint32_t>(String::cast(*receiver_)->length())) { | |
| 68 // TODO(verwaest): Speed this up. Perhaps use a cached wrapper on the native | |
| 69 // context, ensuring that we don't leak it into JS? | |
| 70 Handle<JSFunction> constructor = isolate_->string_function(); | |
| 71 Handle<JSObject> result = factory()->NewJSObject(constructor); | |
| 72 Handle<JSValue>::cast(result)->set_value(*receiver_); | |
| 73 return result; | |
| 74 } | |
| 75 auto root = handle(receiver_->GetRootMap(isolate_)->prototype(), isolate_); | |
| 66 if (root->IsNull()) { | 76 if (root->IsNull()) { |
| 67 unsigned int magic = 0xbbbbbbbb; | 77 unsigned int magic = 0xbbbbbbbb; |
| 68 isolate->PushStackTraceAndDie(magic, *receiver, NULL, magic); | 78 isolate_->PushStackTraceAndDie(magic, *receiver_, NULL, magic); |
| 69 } | 79 } |
| 70 return Handle<JSReceiver>::cast(root); | 80 return Handle<JSReceiver>::cast(root); |
| 71 } | 81 } |
| 72 | 82 |
| 73 | 83 |
| 74 Handle<Map> LookupIterator::GetReceiverMap() const { | 84 Handle<Map> LookupIterator::GetReceiverMap() const { |
| 75 if (receiver_->IsNumber()) return isolate_->factory()->heap_number_map(); | 85 if (receiver_->IsNumber()) return isolate_->factory()->heap_number_map(); |
| 76 return handle(Handle<HeapObject>::cast(receiver_)->map(), isolate_); | 86 return handle(Handle<HeapObject>::cast(receiver_)->map(), isolate_); |
| 77 } | 87 } |
| 78 | 88 |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 case InterceptorState::kSkipNonMasking: | 502 case InterceptorState::kSkipNonMasking: |
| 493 return true; | 503 return true; |
| 494 case InterceptorState::kProcessNonMasking: | 504 case InterceptorState::kProcessNonMasking: |
| 495 return false; | 505 return false; |
| 496 } | 506 } |
| 497 } | 507 } |
| 498 return interceptor_state_ == InterceptorState::kProcessNonMasking; | 508 return interceptor_state_ == InterceptorState::kProcessNonMasking; |
| 499 } | 509 } |
| 500 } // namespace internal | 510 } // namespace internal |
| 501 } // namespace v8 | 511 } // namespace v8 |
| OLD | NEW |