OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 480 |
481 Handle<Object> args[] = { receiver, name }; | 481 Handle<Object> args[] = { receiver, name }; |
482 Handle<Object> result = CallTrap( | 482 Handle<Object> result = CallTrap( |
483 "get", isolate->derived_get_trap(), ARRAY_SIZE(args), args); | 483 "get", isolate->derived_get_trap(), ARRAY_SIZE(args), args); |
484 if (isolate->has_pending_exception()) return Failure::Exception(); | 484 if (isolate->has_pending_exception()) return Failure::Exception(); |
485 | 485 |
486 return *result; | 486 return *result; |
487 } | 487 } |
488 | 488 |
489 | 489 |
| 490 Handle<Object> Object::GetPropertyOrElement(Handle<Object> object, |
| 491 Handle<Name> name) { |
| 492 uint32_t index; |
| 493 Isolate* isolate = name->GetIsolate(); |
| 494 if (name->AsArrayIndex(&index)) return GetElement(isolate, object, index); |
| 495 return GetProperty(object, name); |
| 496 } |
| 497 |
| 498 |
490 Handle<Object> Object::GetProperty(Handle<Object> object, | 499 Handle<Object> Object::GetProperty(Handle<Object> object, |
491 Handle<Name> name) { | 500 Handle<Name> name) { |
492 // TODO(rossberg): The index test should not be here but in the GetProperty | 501 CALL_HEAP_FUNCTION(name->GetIsolate(), object->GetProperty(*name), Object); |
493 // method (or somewhere else entirely). Needs more global clean-up. | |
494 uint32_t index; | |
495 Isolate* isolate = name->GetIsolate(); | |
496 if (name->AsArrayIndex(&index)) return GetElement(isolate, object, index); | |
497 CALL_HEAP_FUNCTION(isolate, object->GetProperty(*name), Object); | |
498 } | 502 } |
499 | 503 |
500 | 504 |
501 MaybeObject* JSProxy::GetElementWithHandler(Object* receiver, | 505 MaybeObject* JSProxy::GetElementWithHandler(Object* receiver, |
502 uint32_t index) { | 506 uint32_t index) { |
503 String* name; | 507 String* name; |
504 MaybeObject* maybe = GetHeap()->Uint32ToString(index); | 508 MaybeObject* maybe = GetHeap()->Uint32ToString(index); |
505 if (!maybe->To<String>(&name)) return maybe; | 509 if (!maybe->To<String>(&name)) return maybe; |
506 return GetPropertyWithHandler(receiver, name); | 510 return GetPropertyWithHandler(receiver, name); |
507 } | 511 } |
(...skipping 3087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3595 Handle<Object> argv[] = { result }; | 3599 Handle<Object> argv[] = { result }; |
3596 Handle<Object> desc = Execution::Call( | 3600 Handle<Object> desc = Execution::Call( |
3597 isolate, isolate->to_complete_property_descriptor(), result, | 3601 isolate, isolate->to_complete_property_descriptor(), result, |
3598 ARRAY_SIZE(argv), argv, &has_pending_exception); | 3602 ARRAY_SIZE(argv), argv, &has_pending_exception); |
3599 if (has_pending_exception) return Handle<Object>(); | 3603 if (has_pending_exception) return Handle<Object>(); |
3600 | 3604 |
3601 // [[GetProperty]] requires to check that all properties are configurable. | 3605 // [[GetProperty]] requires to check that all properties are configurable. |
3602 Handle<String> configurable_name = | 3606 Handle<String> configurable_name = |
3603 isolate->factory()->InternalizeOneByteString( | 3607 isolate->factory()->InternalizeOneByteString( |
3604 STATIC_ASCII_VECTOR("configurable_")); | 3608 STATIC_ASCII_VECTOR("configurable_")); |
3605 Handle<Object> configurable( | 3609 Handle<Object> configurable = Object::GetProperty(desc, configurable_name); |
3606 v8::internal::GetProperty(isolate, desc, configurable_name)); | 3610 ASSERT(!configurable.is_null()); |
3607 ASSERT(!isolate->has_pending_exception()); | |
3608 ASSERT(configurable->IsTrue() || configurable->IsFalse()); | 3611 ASSERT(configurable->IsTrue() || configurable->IsFalse()); |
3609 if (configurable->IsFalse()) { | 3612 if (configurable->IsFalse()) { |
3610 Handle<String> trap = | 3613 Handle<String> trap = |
3611 isolate->factory()->InternalizeOneByteString( | 3614 isolate->factory()->InternalizeOneByteString( |
3612 STATIC_ASCII_VECTOR("getPropertyDescriptor")); | 3615 STATIC_ASCII_VECTOR("getPropertyDescriptor")); |
3613 Handle<Object> args[] = { handler, trap, name }; | 3616 Handle<Object> args[] = { handler, trap, name }; |
3614 Handle<Object> error = isolate->factory()->NewTypeError( | 3617 Handle<Object> error = isolate->factory()->NewTypeError( |
3615 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args))); | 3618 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args))); |
3616 isolate->Throw(*error); | 3619 isolate->Throw(*error); |
3617 return Handle<Object>(); | 3620 return Handle<Object>(); |
3618 } | 3621 } |
3619 ASSERT(configurable->IsTrue()); | 3622 ASSERT(configurable->IsTrue()); |
3620 | 3623 |
3621 // Check for DataDescriptor. | 3624 // Check for DataDescriptor. |
3622 Handle<String> hasWritable_name = | 3625 Handle<String> hasWritable_name = |
3623 isolate->factory()->InternalizeOneByteString( | 3626 isolate->factory()->InternalizeOneByteString( |
3624 STATIC_ASCII_VECTOR("hasWritable_")); | 3627 STATIC_ASCII_VECTOR("hasWritable_")); |
3625 Handle<Object> hasWritable( | 3628 Handle<Object> hasWritable = Object::GetProperty(desc, hasWritable_name); |
3626 v8::internal::GetProperty(isolate, desc, hasWritable_name)); | 3629 ASSERT(!hasWritable.is_null()); |
3627 ASSERT(!isolate->has_pending_exception()); | |
3628 ASSERT(hasWritable->IsTrue() || hasWritable->IsFalse()); | 3630 ASSERT(hasWritable->IsTrue() || hasWritable->IsFalse()); |
3629 if (hasWritable->IsTrue()) { | 3631 if (hasWritable->IsTrue()) { |
3630 Handle<String> writable_name = | 3632 Handle<String> writable_name = |
3631 isolate->factory()->InternalizeOneByteString( | 3633 isolate->factory()->InternalizeOneByteString( |
3632 STATIC_ASCII_VECTOR("writable_")); | 3634 STATIC_ASCII_VECTOR("writable_")); |
3633 Handle<Object> writable( | 3635 Handle<Object> writable = Object::GetProperty(desc, writable_name); |
3634 v8::internal::GetProperty(isolate, desc, writable_name)); | 3636 ASSERT(!writable.is_null()); |
3635 ASSERT(!isolate->has_pending_exception()); | |
3636 ASSERT(writable->IsTrue() || writable->IsFalse()); | 3637 ASSERT(writable->IsTrue() || writable->IsFalse()); |
3637 *done = writable->IsFalse(); | 3638 *done = writable->IsFalse(); |
3638 if (!*done) return isolate->factory()->the_hole_value(); | 3639 if (!*done) return isolate->factory()->the_hole_value(); |
3639 if (strict_mode == SLOPPY) return value; | 3640 if (strict_mode == SLOPPY) return value; |
3640 Handle<Object> args[] = { name, receiver }; | 3641 Handle<Object> args[] = { name, receiver }; |
3641 Handle<Object> error = isolate->factory()->NewTypeError( | 3642 Handle<Object> error = isolate->factory()->NewTypeError( |
3642 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); | 3643 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); |
3643 isolate->Throw(*error); | 3644 isolate->Throw(*error); |
3644 return Handle<Object>(); | 3645 return Handle<Object>(); |
3645 } | 3646 } |
3646 | 3647 |
3647 // We have an AccessorDescriptor. | 3648 // We have an AccessorDescriptor. |
3648 Handle<String> set_name = isolate->factory()->InternalizeOneByteString( | 3649 Handle<String> set_name = isolate->factory()->InternalizeOneByteString( |
3649 STATIC_ASCII_VECTOR("set_")); | 3650 STATIC_ASCII_VECTOR("set_")); |
3650 Handle<Object> setter(v8::internal::GetProperty(isolate, desc, set_name)); | 3651 Handle<Object> setter = Object::GetProperty(desc, set_name); |
3651 ASSERT(!isolate->has_pending_exception()); | 3652 ASSERT(!setter.is_null()); |
3652 if (!setter->IsUndefined()) { | 3653 if (!setter->IsUndefined()) { |
3653 // TODO(rossberg): nicer would be to cast to some JSCallable here... | 3654 // TODO(rossberg): nicer would be to cast to some JSCallable here... |
3654 return SetPropertyWithDefinedSetter( | 3655 return SetPropertyWithDefinedSetter( |
3655 receiver, Handle<JSReceiver>::cast(setter), value); | 3656 receiver, Handle<JSReceiver>::cast(setter), value); |
3656 } | 3657 } |
3657 | 3658 |
3658 if (strict_mode == SLOPPY) return value; | 3659 if (strict_mode == SLOPPY) return value; |
3659 Handle<Object> args2[] = { name, proxy }; | 3660 Handle<Object> args2[] = { name, proxy }; |
3660 Handle<Object> error = isolate->factory()->NewTypeError( | 3661 Handle<Object> error = isolate->factory()->NewTypeError( |
3661 "no_setter_in_callback", HandleVector(args2, ARRAY_SIZE(args2))); | 3662 "no_setter_in_callback", HandleVector(args2, ARRAY_SIZE(args2))); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3719 bool has_pending_exception; | 3720 bool has_pending_exception; |
3720 Handle<Object> argv[] = { result }; | 3721 Handle<Object> argv[] = { result }; |
3721 Handle<Object> desc = Execution::Call( | 3722 Handle<Object> desc = Execution::Call( |
3722 isolate, isolate->to_complete_property_descriptor(), result, | 3723 isolate, isolate->to_complete_property_descriptor(), result, |
3723 ARRAY_SIZE(argv), argv, &has_pending_exception); | 3724 ARRAY_SIZE(argv), argv, &has_pending_exception); |
3724 if (has_pending_exception) return NONE; | 3725 if (has_pending_exception) return NONE; |
3725 | 3726 |
3726 // Convert result to PropertyAttributes. | 3727 // Convert result to PropertyAttributes. |
3727 Handle<String> enum_n = isolate->factory()->InternalizeOneByteString( | 3728 Handle<String> enum_n = isolate->factory()->InternalizeOneByteString( |
3728 STATIC_ASCII_VECTOR("enumerable_")); | 3729 STATIC_ASCII_VECTOR("enumerable_")); |
3729 Handle<Object> enumerable(v8::internal::GetProperty(isolate, desc, enum_n)); | 3730 Handle<Object> enumerable = Object::GetProperty(desc, enum_n); |
3730 if (isolate->has_pending_exception()) return NONE; | 3731 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, enumerable, NONE); |
3731 Handle<String> conf_n = isolate->factory()->InternalizeOneByteString( | 3732 Handle<String> conf_n = isolate->factory()->InternalizeOneByteString( |
3732 STATIC_ASCII_VECTOR("configurable_")); | 3733 STATIC_ASCII_VECTOR("configurable_")); |
3733 Handle<Object> configurable(v8::internal::GetProperty(isolate, desc, conf_n)); | 3734 Handle<Object> configurable = Object::GetProperty(desc, conf_n); |
3734 if (isolate->has_pending_exception()) return NONE; | 3735 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, configurable, NONE); |
3735 Handle<String> writ_n = isolate->factory()->InternalizeOneByteString( | 3736 Handle<String> writ_n = isolate->factory()->InternalizeOneByteString( |
3736 STATIC_ASCII_VECTOR("writable_")); | 3737 STATIC_ASCII_VECTOR("writable_")); |
3737 Handle<Object> writable(v8::internal::GetProperty(isolate, desc, writ_n)); | 3738 Handle<Object> writable = Object::GetProperty(desc, writ_n); |
3738 if (isolate->has_pending_exception()) return NONE; | 3739 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, writable, NONE); |
3739 if (!writable->BooleanValue()) { | 3740 if (!writable->BooleanValue()) { |
3740 Handle<String> set_n = isolate->factory()->InternalizeOneByteString( | 3741 Handle<String> set_n = isolate->factory()->InternalizeOneByteString( |
3741 STATIC_ASCII_VECTOR("set_")); | 3742 STATIC_ASCII_VECTOR("set_")); |
3742 Handle<Object> setter(v8::internal::GetProperty(isolate, desc, set_n)); | 3743 Handle<Object> setter = Object::GetProperty(desc, set_n); |
3743 if (isolate->has_pending_exception()) return NONE; | 3744 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, setter, NONE); |
3744 writable = isolate->factory()->ToBoolean(!setter->IsUndefined()); | 3745 writable = isolate->factory()->ToBoolean(!setter->IsUndefined()); |
3745 } | 3746 } |
3746 | 3747 |
3747 if (configurable->IsFalse()) { | 3748 if (configurable->IsFalse()) { |
3748 Handle<Object> handler(proxy->handler(), isolate); | 3749 Handle<Object> handler(proxy->handler(), isolate); |
3749 Handle<String> trap = isolate->factory()->InternalizeOneByteString( | 3750 Handle<String> trap = isolate->factory()->InternalizeOneByteString( |
3750 STATIC_ASCII_VECTOR("getPropertyDescriptor")); | 3751 STATIC_ASCII_VECTOR("getPropertyDescriptor")); |
3751 Handle<Object> args[] = { handler, trap, name }; | 3752 Handle<Object> args[] = { handler, trap, name }; |
3752 Handle<Object> error = isolate->factory()->NewTypeError( | 3753 Handle<Object> error = isolate->factory()->NewTypeError( |
3753 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args))); | 3754 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args))); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3796 | 3797 |
3797 | 3798 |
3798 MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name, | 3799 MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name, |
3799 Handle<Object> derived, | 3800 Handle<Object> derived, |
3800 int argc, | 3801 int argc, |
3801 Handle<Object> argv[]) { | 3802 Handle<Object> argv[]) { |
3802 Isolate* isolate = GetIsolate(); | 3803 Isolate* isolate = GetIsolate(); |
3803 Handle<Object> handler(this->handler(), isolate); | 3804 Handle<Object> handler(this->handler(), isolate); |
3804 | 3805 |
3805 Handle<String> trap_name = isolate->factory()->InternalizeUtf8String(name); | 3806 Handle<String> trap_name = isolate->factory()->InternalizeUtf8String(name); |
3806 Handle<Object> trap(v8::internal::GetProperty(isolate, handler, trap_name)); | 3807 Handle<Object> trap = Object::GetPropertyOrElement(handler, trap_name); |
3807 if (isolate->has_pending_exception()) return trap; | 3808 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, trap, Handle<Object>()); |
3808 | 3809 |
3809 if (trap->IsUndefined()) { | 3810 if (trap->IsUndefined()) { |
3810 if (derived.is_null()) { | 3811 if (derived.is_null()) { |
3811 Handle<Object> args[] = { handler, trap_name }; | 3812 Handle<Object> args[] = { handler, trap_name }; |
3812 Handle<Object> error = isolate->factory()->NewTypeError( | 3813 Handle<Object> error = isolate->factory()->NewTypeError( |
3813 "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args))); | 3814 "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args))); |
3814 isolate->Throw(*error); | 3815 isolate->Throw(*error); |
3815 return Handle<Object>(); | 3816 return Handle<Object>(); |
3816 } | 3817 } |
3817 trap = Handle<Object>(derived); | 3818 trap = Handle<Object>(derived); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4063 return Handle<Object>(); | 4064 return Handle<Object>(); |
4064 } else { | 4065 } else { |
4065 return value; | 4066 return value; |
4066 } | 4067 } |
4067 } | 4068 } |
4068 | 4069 |
4069 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 4070 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
4070 bool is_observed = object->map()->is_observed() && | 4071 bool is_observed = object->map()->is_observed() && |
4071 *name != isolate->heap()->hidden_string(); | 4072 *name != isolate->heap()->hidden_string(); |
4072 if (is_observed && lookup->IsDataProperty()) { | 4073 if (is_observed && lookup->IsDataProperty()) { |
4073 old_value = Object::GetProperty(object, name); | 4074 old_value = Object::GetPropertyOrElement(object, name); |
4074 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | 4075 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); |
4075 } | 4076 } |
4076 | 4077 |
4077 // This is a real property that is not read-only, or it is a | 4078 // This is a real property that is not read-only, or it is a |
4078 // transition or null descriptor and there are no setters in the prototypes. | 4079 // transition or null descriptor and there are no setters in the prototypes. |
4079 Handle<Object> result = value; | 4080 Handle<Object> result = value; |
4080 switch (lookup->type()) { | 4081 switch (lookup->type()) { |
4081 case NORMAL: | 4082 case NORMAL: |
4082 SetNormalizedProperty(handle(lookup->holder()), lookup, value); | 4083 SetNormalizedProperty(handle(lookup->holder()), lookup, value); |
4083 break; | 4084 break; |
(...skipping 25 matching lines...) Expand all Loading... |
4109 | 4110 |
4110 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>()); | 4111 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>()); |
4111 | 4112 |
4112 if (is_observed) { | 4113 if (is_observed) { |
4113 if (lookup->IsTransition()) { | 4114 if (lookup->IsTransition()) { |
4114 EnqueueChangeRecord(object, "add", name, old_value); | 4115 EnqueueChangeRecord(object, "add", name, old_value); |
4115 } else { | 4116 } else { |
4116 LookupResult new_lookup(isolate); | 4117 LookupResult new_lookup(isolate); |
4117 object->LocalLookup(*name, &new_lookup, true); | 4118 object->LocalLookup(*name, &new_lookup, true); |
4118 if (new_lookup.IsDataProperty()) { | 4119 if (new_lookup.IsDataProperty()) { |
4119 Handle<Object> new_value = Object::GetProperty(object, name); | 4120 Handle<Object> new_value = Object::GetPropertyOrElement(object, name); |
4120 CHECK_NOT_EMPTY_HANDLE(isolate, new_value); | 4121 CHECK_NOT_EMPTY_HANDLE(isolate, new_value); |
4121 if (!new_value->SameValue(*old_value)) { | 4122 if (!new_value->SameValue(*old_value)) { |
4122 EnqueueChangeRecord(object, "update", name, old_value); | 4123 EnqueueChangeRecord(object, "update", name, old_value); |
4123 } | 4124 } |
4124 } | 4125 } |
4125 } | 4126 } |
4126 } | 4127 } |
4127 | 4128 |
4128 return result; | 4129 return result; |
4129 } | 4130 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4188 return AddProperty(object, name, value, attributes, SLOPPY, | 4189 return AddProperty(object, name, value, attributes, SLOPPY, |
4189 MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode, flag); | 4190 MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode, flag); |
4190 } | 4191 } |
4191 | 4192 |
4192 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 4193 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
4193 PropertyAttributes old_attributes = ABSENT; | 4194 PropertyAttributes old_attributes = ABSENT; |
4194 bool is_observed = object->map()->is_observed() && | 4195 bool is_observed = object->map()->is_observed() && |
4195 *name != isolate->heap()->hidden_string(); | 4196 *name != isolate->heap()->hidden_string(); |
4196 if (is_observed && lookup.IsProperty()) { | 4197 if (is_observed && lookup.IsProperty()) { |
4197 if (lookup.IsDataProperty()) { | 4198 if (lookup.IsDataProperty()) { |
4198 old_value = Object::GetProperty(object, name); | 4199 old_value = Object::GetPropertyOrElement(object, name); |
4199 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | 4200 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); |
4200 } | 4201 } |
4201 old_attributes = lookup.GetAttributes(); | 4202 old_attributes = lookup.GetAttributes(); |
4202 } | 4203 } |
4203 | 4204 |
4204 // Check of IsReadOnly removed from here in clone. | 4205 // Check of IsReadOnly removed from here in clone. |
4205 switch (lookup.type()) { | 4206 switch (lookup.type()) { |
4206 case NORMAL: | 4207 case NORMAL: |
4207 ReplaceSlowProperty(object, name, value, attributes); | 4208 ReplaceSlowProperty(object, name, value, attributes); |
4208 break; | 4209 break; |
(...skipping 25 matching lines...) Expand all Loading... |
4234 if (is_observed) { | 4235 if (is_observed) { |
4235 if (lookup.IsTransition()) { | 4236 if (lookup.IsTransition()) { |
4236 EnqueueChangeRecord(object, "add", name, old_value); | 4237 EnqueueChangeRecord(object, "add", name, old_value); |
4237 } else if (old_value->IsTheHole()) { | 4238 } else if (old_value->IsTheHole()) { |
4238 EnqueueChangeRecord(object, "reconfigure", name, old_value); | 4239 EnqueueChangeRecord(object, "reconfigure", name, old_value); |
4239 } else { | 4240 } else { |
4240 LookupResult new_lookup(isolate); | 4241 LookupResult new_lookup(isolate); |
4241 object->LocalLookup(*name, &new_lookup, true); | 4242 object->LocalLookup(*name, &new_lookup, true); |
4242 bool value_changed = false; | 4243 bool value_changed = false; |
4243 if (new_lookup.IsDataProperty()) { | 4244 if (new_lookup.IsDataProperty()) { |
4244 Handle<Object> new_value = Object::GetProperty(object, name); | 4245 Handle<Object> new_value = Object::GetPropertyOrElement(object, name); |
4245 CHECK_NOT_EMPTY_HANDLE(isolate, new_value); | 4246 CHECK_NOT_EMPTY_HANDLE(isolate, new_value); |
4246 value_changed = !old_value->SameValue(*new_value); | 4247 value_changed = !old_value->SameValue(*new_value); |
4247 } | 4248 } |
4248 if (new_lookup.GetAttributes() != old_attributes) { | 4249 if (new_lookup.GetAttributes() != old_attributes) { |
4249 if (!value_changed) old_value = isolate->factory()->the_hole_value(); | 4250 if (!value_changed) old_value = isolate->factory()->the_hole_value(); |
4250 EnqueueChangeRecord(object, "reconfigure", name, old_value); | 4251 EnqueueChangeRecord(object, "reconfigure", name, old_value); |
4251 } else if (value_changed) { | 4252 } else if (value_changed) { |
4252 EnqueueChangeRecord(object, "update", name, old_value); | 4253 EnqueueChangeRecord(object, "update", name, old_value); |
4253 } | 4254 } |
4254 } | 4255 } |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5224 isolate->Throw(*error); | 5225 isolate->Throw(*error); |
5225 return Handle<Object>(); | 5226 return Handle<Object>(); |
5226 } | 5227 } |
5227 return isolate->factory()->false_value(); | 5228 return isolate->factory()->false_value(); |
5228 } | 5229 } |
5229 | 5230 |
5230 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 5231 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
5231 bool is_observed = object->map()->is_observed() && | 5232 bool is_observed = object->map()->is_observed() && |
5232 *name != isolate->heap()->hidden_string(); | 5233 *name != isolate->heap()->hidden_string(); |
5233 if (is_observed && lookup.IsDataProperty()) { | 5234 if (is_observed && lookup.IsDataProperty()) { |
5234 old_value = Object::GetProperty(object, name); | 5235 old_value = Object::GetPropertyOrElement(object, name); |
5235 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | 5236 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); |
5236 } | 5237 } |
5237 Handle<Object> result; | 5238 Handle<Object> result; |
5238 | 5239 |
5239 // Check for interceptor. | 5240 // Check for interceptor. |
5240 if (lookup.IsInterceptor()) { | 5241 if (lookup.IsInterceptor()) { |
5241 // Skip interceptor if forcing a deletion. | 5242 // Skip interceptor if forcing a deletion. |
5242 if (mode == FORCE_DELETION) { | 5243 if (mode == FORCE_DELETION) { |
5243 result = DeletePropertyPostInterceptor(object, name, mode); | 5244 result = DeletePropertyPostInterceptor(object, name, mode); |
5244 } else { | 5245 } else { |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6332 if (is_element) { | 6333 if (is_element) { |
6333 preexists = HasLocalElement(object, index); | 6334 preexists = HasLocalElement(object, index); |
6334 if (preexists && object->GetLocalElementAccessorPair(index) == NULL) { | 6335 if (preexists && object->GetLocalElementAccessorPair(index) == NULL) { |
6335 old_value = Object::GetElementNoExceptionThrown(isolate, object, index); | 6336 old_value = Object::GetElementNoExceptionThrown(isolate, object, index); |
6336 } | 6337 } |
6337 } else { | 6338 } else { |
6338 LookupResult lookup(isolate); | 6339 LookupResult lookup(isolate); |
6339 object->LocalLookup(*name, &lookup, true); | 6340 object->LocalLookup(*name, &lookup, true); |
6340 preexists = lookup.IsProperty(); | 6341 preexists = lookup.IsProperty(); |
6341 if (preexists && lookup.IsDataProperty()) { | 6342 if (preexists && lookup.IsDataProperty()) { |
6342 old_value = Object::GetProperty(object, name); | 6343 old_value = Object::GetPropertyOrElement(object, name); |
6343 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | 6344 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); |
6344 } | 6345 } |
6345 } | 6346 } |
6346 } | 6347 } |
6347 | 6348 |
6348 if (is_element) { | 6349 if (is_element) { |
6349 DefineElementAccessor( | 6350 DefineElementAccessor( |
6350 object, index, getter, setter, attributes, access_control); | 6351 object, index, getter, setter, attributes, access_control); |
6351 } else { | 6352 } else { |
6352 DefinePropertyAccessor( | 6353 DefinePropertyAccessor( |
(...skipping 10086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16439 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16440 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16440 static const char* error_messages_[] = { | 16441 static const char* error_messages_[] = { |
16441 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16442 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16442 }; | 16443 }; |
16443 #undef ERROR_MESSAGES_TEXTS | 16444 #undef ERROR_MESSAGES_TEXTS |
16444 return error_messages_[reason]; | 16445 return error_messages_[reason]; |
16445 } | 16446 } |
16446 | 16447 |
16447 | 16448 |
16448 } } // namespace v8::internal | 16449 } } // namespace v8::internal |
OLD | NEW |