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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 // Only JS objects can have properties. | 698 // Only JS objects can have properties. |
699 if (object->IsJSObject()) { | 699 if (object->IsJSObject()) { |
700 Handle<JSObject> js_obj = Handle<JSObject>::cast(object); | 700 Handle<JSObject> js_obj = Handle<JSObject>::cast(object); |
701 // Fast case: either the key is a real named property or it is not | 701 // Fast case: either the key is a real named property or it is not |
702 // an array index and there are no interceptors or hidden | 702 // an array index and there are no interceptors or hidden |
703 // prototypes. | 703 // prototypes. |
704 // TODO(jkummerow): Make JSReceiver::HasOwnProperty fast enough to | 704 // TODO(jkummerow): Make JSReceiver::HasOwnProperty fast enough to |
705 // handle all cases directly (without this custom fast path). | 705 // handle all cases directly (without this custom fast path). |
706 Maybe<bool> maybe = Nothing<bool>(); | 706 Maybe<bool> maybe = Nothing<bool>(); |
707 if (key_is_array_index) { | 707 if (key_is_array_index) { |
708 maybe = JSObject::HasOwnElement(js_obj, index); | 708 LookupIterator it(js_obj->GetIsolate(), js_obj, index, |
| 709 LookupIterator::HIDDEN); |
| 710 maybe = JSReceiver::HasProperty(&it); |
709 } else { | 711 } else { |
710 maybe = JSObject::HasRealNamedProperty(js_obj, key); | 712 maybe = JSObject::HasRealNamedProperty(js_obj, key); |
711 } | 713 } |
712 if (!maybe.IsJust()) return isolate->heap()->exception(); | 714 if (!maybe.IsJust()) return isolate->heap()->exception(); |
713 DCHECK(!isolate->has_pending_exception()); | 715 DCHECK(!isolate->has_pending_exception()); |
714 if (maybe.FromJust()) { | 716 if (maybe.FromJust()) { |
715 return isolate->heap()->true_value(); | 717 return isolate->heap()->true_value(); |
716 } | 718 } |
717 Map* map = js_obj->map(); | 719 Map* map = js_obj->map(); |
718 if (!key_is_array_index && !map->has_named_interceptor() && | 720 if (!key_is_array_index && !map->has_named_interceptor() && |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 | 1414 |
1413 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1415 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
1414 HandleScope scope(isolate); | 1416 HandleScope scope(isolate); |
1415 DCHECK(args.length() == 2); | 1417 DCHECK(args.length() == 2); |
1416 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1418 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
1417 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1419 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
1418 return JSReceiver::DefineProperties(isolate, o, properties); | 1420 return JSReceiver::DefineProperties(isolate, o, properties); |
1419 } | 1421 } |
1420 } // namespace internal | 1422 } // namespace internal |
1421 } // namespace v8 | 1423 } // namespace v8 |
OLD | NEW |