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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 } | 707 } |
708 // Slow case. | 708 // Slow case. |
709 return HasOwnPropertyImplementation(isolate, Handle<JSObject>(js_obj), | 709 return HasOwnPropertyImplementation(isolate, Handle<JSObject>(js_obj), |
710 Handle<Name>(key)); | 710 Handle<Name>(key)); |
711 } else if (object->IsString() && key_is_array_index) { | 711 } else if (object->IsString() && key_is_array_index) { |
712 // Well, there is one exception: Handle [] on strings. | 712 // Well, there is one exception: Handle [] on strings. |
713 Handle<String> string = Handle<String>::cast(object); | 713 Handle<String> string = Handle<String>::cast(object); |
714 if (index < static_cast<uint32_t>(string->length())) { | 714 if (index < static_cast<uint32_t>(string->length())) { |
715 return isolate->heap()->true_value(); | 715 return isolate->heap()->true_value(); |
716 } | 716 } |
| 717 } else if (object->IsJSProxy()) { |
| 718 Maybe<bool> result = |
| 719 JSReceiver::HasOwnProperty(Handle<JSProxy>::cast(object), key); |
| 720 if (!result.IsJust()) return isolate->heap()->exception(); |
| 721 return isolate->heap()->ToBoolean(result.FromJust()); |
717 } | 722 } |
718 return isolate->heap()->false_value(); | 723 return isolate->heap()->false_value(); |
719 } | 724 } |
720 | 725 |
721 | 726 |
722 // ES6 section 12.9.3, operator in. | 727 // ES6 section 12.9.3, operator in. |
723 RUNTIME_FUNCTION(Runtime_HasProperty) { | 728 RUNTIME_FUNCTION(Runtime_HasProperty) { |
724 HandleScope scope(isolate); | 729 HandleScope scope(isolate); |
725 DCHECK_EQ(2, args.length()); | 730 DCHECK_EQ(2, args.length()); |
726 CONVERT_ARG_HANDLE_CHECKED(Object, key, 0); | 731 CONVERT_ARG_HANDLE_CHECKED(Object, key, 0); |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 | 1579 |
1575 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1580 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
1576 HandleScope scope(isolate); | 1581 HandleScope scope(isolate); |
1577 DCHECK(args.length() == 2); | 1582 DCHECK(args.length() == 2); |
1578 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1583 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
1579 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1584 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
1580 return JSReceiver::DefineProperties(isolate, o, properties); | 1585 return JSReceiver::DefineProperties(isolate, o, properties); |
1581 } | 1586 } |
1582 } // namespace internal | 1587 } // namespace internal |
1583 } // namespace v8 | 1588 } // namespace v8 |
OLD | NEW |