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/lookup.h" | 5 #include "src/lookup.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/elements.h" | 9 #include "src/elements.h" |
10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 if (index != kMaxUInt32 && receiver->IsString() && | 124 if (index != kMaxUInt32 && receiver->IsString() && |
125 index < static_cast<uint32_t>(String::cast(*receiver)->length())) { | 125 index < static_cast<uint32_t>(String::cast(*receiver)->length())) { |
126 // TODO(verwaest): Speed this up. Perhaps use a cached wrapper on the native | 126 // TODO(verwaest): Speed this up. Perhaps use a cached wrapper on the native |
127 // context, ensuring that we don't leak it into JS? | 127 // context, ensuring that we don't leak it into JS? |
128 Handle<JSFunction> constructor = isolate->string_function(); | 128 Handle<JSFunction> constructor = isolate->string_function(); |
129 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor); | 129 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor); |
130 Handle<JSValue>::cast(result)->set_value(*receiver); | 130 Handle<JSValue>::cast(result)->set_value(*receiver); |
131 return result; | 131 return result; |
132 } | 132 } |
133 auto root = handle(receiver->GetRootMap(isolate)->prototype(), isolate); | 133 auto root = handle(receiver->GetRootMap(isolate)->prototype(), isolate); |
134 if (root->IsNull()) { | 134 if (root->IsNull(isolate)) { |
135 unsigned int magic = 0xbbbbbbbb; | 135 unsigned int magic = 0xbbbbbbbb; |
136 isolate->PushStackTraceAndDie(magic, *receiver, NULL, magic); | 136 isolate->PushStackTraceAndDie(magic, *receiver, NULL, magic); |
137 } | 137 } |
138 return Handle<JSReceiver>::cast(root); | 138 return Handle<JSReceiver>::cast(root); |
139 } | 139 } |
140 | 140 |
141 | 141 |
142 Handle<Map> LookupIterator::GetReceiverMap() const { | 142 Handle<Map> LookupIterator::GetReceiverMap() const { |
143 if (receiver_->IsNumber()) return factory()->heap_number_map(); | 143 if (receiver_->IsNumber()) return factory()->heap_number_map(); |
144 return handle(Handle<HeapObject>::cast(receiver_)->map(), isolate_); | 144 return handle(Handle<HeapObject>::cast(receiver_)->map(), isolate_); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 if (holder->IsJSObject()) { | 366 if (holder->IsJSObject()) { |
367 JSObject::ReoptimizeIfPrototype(Handle<JSObject>::cast(holder)); | 367 JSObject::ReoptimizeIfPrototype(Handle<JSObject>::cast(holder)); |
368 } | 368 } |
369 } | 369 } |
370 state_ = NOT_FOUND; | 370 state_ = NOT_FOUND; |
371 } | 371 } |
372 | 372 |
373 void LookupIterator::TransitionToAccessorProperty( | 373 void LookupIterator::TransitionToAccessorProperty( |
374 Handle<Object> getter, Handle<Object> setter, | 374 Handle<Object> getter, Handle<Object> setter, |
375 PropertyAttributes attributes) { | 375 PropertyAttributes attributes) { |
376 DCHECK(!getter->IsNull() || !setter->IsNull()); | 376 DCHECK(!getter->IsNull(isolate_) || !setter->IsNull(isolate_)); |
377 // Can only be called when the receiver is a JSObject. JSProxy has to be | 377 // Can only be called when the receiver is a JSObject. JSProxy has to be |
378 // handled via a trap. Adding properties to primitive values is not | 378 // handled via a trap. Adding properties to primitive values is not |
379 // observable. | 379 // observable. |
380 Handle<JSObject> receiver = GetStoreTarget(); | 380 Handle<JSObject> receiver = GetStoreTarget(); |
381 | 381 |
382 if (!IsElement() && !receiver->map()->is_dictionary_map()) { | 382 if (!IsElement() && !receiver->map()->is_dictionary_map()) { |
383 Handle<Map> old_map(receiver->map(), isolate_); | 383 Handle<Map> old_map(receiver->map(), isolate_); |
384 | 384 |
385 if (!holder_.is_identical_to(receiver)) { | 385 if (!holder_.is_identical_to(receiver)) { |
386 holder_ = receiver; | 386 holder_ = receiver; |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 case v8::internal::kAccessor: | 752 case v8::internal::kAccessor: |
753 return ACCESSOR; | 753 return ACCESSOR; |
754 } | 754 } |
755 | 755 |
756 UNREACHABLE(); | 756 UNREACHABLE(); |
757 return state_; | 757 return state_; |
758 } | 758 } |
759 | 759 |
760 } // namespace internal | 760 } // namespace internal |
761 } // namespace v8 | 761 } // namespace v8 |
OLD | NEW |