| 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/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/debug.h" | 9 #include "src/debug.h" |
| 10 #include "src/runtime/runtime.h" | 10 #include "src/runtime/runtime.h" |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 | 765 |
| 766 uint32_t index; | 766 uint32_t index; |
| 767 const bool key_is_array_index = key->AsArrayIndex(&index); | 767 const bool key_is_array_index = key->AsArrayIndex(&index); |
| 768 | 768 |
| 769 // Only JS objects can have properties. | 769 // Only JS objects can have properties. |
| 770 if (object->IsJSObject()) { | 770 if (object->IsJSObject()) { |
| 771 Handle<JSObject> js_obj = Handle<JSObject>::cast(object); | 771 Handle<JSObject> js_obj = Handle<JSObject>::cast(object); |
| 772 // Fast case: either the key is a real named property or it is not | 772 // Fast case: either the key is a real named property or it is not |
| 773 // an array index and there are no interceptors or hidden | 773 // an array index and there are no interceptors or hidden |
| 774 // prototypes. | 774 // prototypes. |
| 775 Maybe<bool> maybe; | 775 Maybe<bool> maybe = Nothing<bool>(); |
| 776 if (key_is_array_index) { | 776 if (key_is_array_index) { |
| 777 maybe = JSObject::HasOwnElement(js_obj, index); | 777 maybe = JSObject::HasOwnElement(js_obj, index); |
| 778 } else { | 778 } else { |
| 779 maybe = JSObject::HasRealNamedProperty(js_obj, key); | 779 maybe = JSObject::HasRealNamedProperty(js_obj, key); |
| 780 } | 780 } |
| 781 if (!maybe.has_value) return isolate->heap()->exception(); | 781 if (!maybe.has_value) return isolate->heap()->exception(); |
| 782 DCHECK(!isolate->has_pending_exception()); | 782 DCHECK(!isolate->has_pending_exception()); |
| 783 if (maybe.value) { | 783 if (maybe.value) { |
| 784 return isolate->heap()->true_value(); | 784 return isolate->heap()->true_value(); |
| 785 } | 785 } |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 1571 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
| 1572 | 1572 |
| 1573 RETURN_FAILURE_ON_EXCEPTION( | 1573 RETURN_FAILURE_ON_EXCEPTION( |
| 1574 isolate, | 1574 isolate, |
| 1575 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), | 1575 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), |
| 1576 setter, attrs)); | 1576 setter, attrs)); |
| 1577 return isolate->heap()->undefined_value(); | 1577 return isolate->heap()->undefined_value(); |
| 1578 } | 1578 } |
| 1579 } | 1579 } |
| 1580 } // namespace v8::internal | 1580 } // namespace v8::internal |
| OLD | NEW |