Chromium Code Reviews| 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 3084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3592 Handle<Object> argv[] = { result }; | 3596 Handle<Object> argv[] = { result }; |
| 3593 Handle<Object> desc = Execution::Call( | 3597 Handle<Object> desc = Execution::Call( |
| 3594 isolate, isolate->to_complete_property_descriptor(), result, | 3598 isolate, isolate->to_complete_property_descriptor(), result, |
| 3595 ARRAY_SIZE(argv), argv, &has_pending_exception); | 3599 ARRAY_SIZE(argv), argv, &has_pending_exception); |
| 3596 if (has_pending_exception) return Handle<Object>(); | 3600 if (has_pending_exception) return Handle<Object>(); |
| 3597 | 3601 |
| 3598 // [[GetProperty]] requires to check that all properties are configurable. | 3602 // [[GetProperty]] requires to check that all properties are configurable. |
| 3599 Handle<String> configurable_name = | 3603 Handle<String> configurable_name = |
| 3600 isolate->factory()->InternalizeOneByteString( | 3604 isolate->factory()->InternalizeOneByteString( |
| 3601 STATIC_ASCII_VECTOR("configurable_")); | 3605 STATIC_ASCII_VECTOR("configurable_")); |
| 3602 Handle<Object> configurable( | 3606 Handle<Object> configurable = Object::GetProperty(desc, configurable_name); |
|
Igor Sheludko
2014/03/26 18:37:31
Is it possible to get undefined or null as a desc
Yang
2014/03/28 09:56:58
I think it's alright the way it is. This is purely
| |
| 3603 v8::internal::GetProperty(isolate, desc, configurable_name)); | 3607 ASSERT(!configurable.is_null()); |
| 3604 ASSERT(!isolate->has_pending_exception()); | |
| 3605 ASSERT(configurable->IsTrue() || configurable->IsFalse()); | 3608 ASSERT(configurable->IsTrue() || configurable->IsFalse()); |
| 3606 if (configurable->IsFalse()) { | 3609 if (configurable->IsFalse()) { |
| 3607 Handle<String> trap = | 3610 Handle<String> trap = |
| 3608 isolate->factory()->InternalizeOneByteString( | 3611 isolate->factory()->InternalizeOneByteString( |
| 3609 STATIC_ASCII_VECTOR("getPropertyDescriptor")); | 3612 STATIC_ASCII_VECTOR("getPropertyDescriptor")); |
| 3610 Handle<Object> args[] = { handler, trap, name }; | 3613 Handle<Object> args[] = { handler, trap, name }; |
| 3611 Handle<Object> error = isolate->factory()->NewTypeError( | 3614 Handle<Object> error = isolate->factory()->NewTypeError( |
| 3612 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args))); | 3615 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args))); |
| 3613 isolate->Throw(*error); | 3616 isolate->Throw(*error); |
| 3614 return Handle<Object>(); | 3617 return Handle<Object>(); |
| 3615 } | 3618 } |
| 3616 ASSERT(configurable->IsTrue()); | 3619 ASSERT(configurable->IsTrue()); |
| 3617 | 3620 |
| 3618 // Check for DataDescriptor. | 3621 // Check for DataDescriptor. |
| 3619 Handle<String> hasWritable_name = | 3622 Handle<String> hasWritable_name = |
| 3620 isolate->factory()->InternalizeOneByteString( | 3623 isolate->factory()->InternalizeOneByteString( |
| 3621 STATIC_ASCII_VECTOR("hasWritable_")); | 3624 STATIC_ASCII_VECTOR("hasWritable_")); |
| 3622 Handle<Object> hasWritable( | 3625 Handle<Object> hasWritable = Object::GetProperty(desc, hasWritable_name); |
| 3623 v8::internal::GetProperty(isolate, desc, hasWritable_name)); | 3626 ASSERT(!hasWritable.is_null()); |
| 3624 ASSERT(!isolate->has_pending_exception()); | |
| 3625 ASSERT(hasWritable->IsTrue() || hasWritable->IsFalse()); | 3627 ASSERT(hasWritable->IsTrue() || hasWritable->IsFalse()); |
| 3626 if (hasWritable->IsTrue()) { | 3628 if (hasWritable->IsTrue()) { |
| 3627 Handle<String> writable_name = | 3629 Handle<String> writable_name = |
| 3628 isolate->factory()->InternalizeOneByteString( | 3630 isolate->factory()->InternalizeOneByteString( |
| 3629 STATIC_ASCII_VECTOR("writable_")); | 3631 STATIC_ASCII_VECTOR("writable_")); |
| 3630 Handle<Object> writable( | 3632 Handle<Object> writable = Object::GetProperty(desc, writable_name); |
| 3631 v8::internal::GetProperty(isolate, desc, writable_name)); | 3633 ASSERT(!writable.is_null()); |
| 3632 ASSERT(!isolate->has_pending_exception()); | |
| 3633 ASSERT(writable->IsTrue() || writable->IsFalse()); | 3634 ASSERT(writable->IsTrue() || writable->IsFalse()); |
| 3634 *done = writable->IsFalse(); | 3635 *done = writable->IsFalse(); |
| 3635 if (!*done) return isolate->factory()->the_hole_value(); | 3636 if (!*done) return isolate->factory()->the_hole_value(); |
| 3636 if (strict_mode == SLOPPY) return value; | 3637 if (strict_mode == SLOPPY) return value; |
| 3637 Handle<Object> args[] = { name, receiver }; | 3638 Handle<Object> args[] = { name, receiver }; |
| 3638 Handle<Object> error = isolate->factory()->NewTypeError( | 3639 Handle<Object> error = isolate->factory()->NewTypeError( |
| 3639 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); | 3640 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); |
| 3640 isolate->Throw(*error); | 3641 isolate->Throw(*error); |
| 3641 return Handle<Object>(); | 3642 return Handle<Object>(); |
| 3642 } | 3643 } |
| 3643 | 3644 |
| 3644 // We have an AccessorDescriptor. | 3645 // We have an AccessorDescriptor. |
| 3645 Handle<String> set_name = isolate->factory()->InternalizeOneByteString( | 3646 Handle<String> set_name = isolate->factory()->InternalizeOneByteString( |
| 3646 STATIC_ASCII_VECTOR("set_")); | 3647 STATIC_ASCII_VECTOR("set_")); |
| 3647 Handle<Object> setter(v8::internal::GetProperty(isolate, desc, set_name)); | 3648 Handle<Object> setter = Object::GetProperty(desc, set_name); |
| 3648 ASSERT(!isolate->has_pending_exception()); | 3649 ASSERT(!setter.is_null()); |
| 3649 if (!setter->IsUndefined()) { | 3650 if (!setter->IsUndefined()) { |
| 3650 // TODO(rossberg): nicer would be to cast to some JSCallable here... | 3651 // TODO(rossberg): nicer would be to cast to some JSCallable here... |
| 3651 return SetPropertyWithDefinedSetter( | 3652 return SetPropertyWithDefinedSetter( |
| 3652 receiver, Handle<JSReceiver>::cast(setter), value); | 3653 receiver, Handle<JSReceiver>::cast(setter), value); |
| 3653 } | 3654 } |
| 3654 | 3655 |
| 3655 if (strict_mode == SLOPPY) return value; | 3656 if (strict_mode == SLOPPY) return value; |
| 3656 Handle<Object> args2[] = { name, proxy }; | 3657 Handle<Object> args2[] = { name, proxy }; |
| 3657 Handle<Object> error = isolate->factory()->NewTypeError( | 3658 Handle<Object> error = isolate->factory()->NewTypeError( |
| 3658 "no_setter_in_callback", HandleVector(args2, ARRAY_SIZE(args2))); | 3659 "no_setter_in_callback", HandleVector(args2, ARRAY_SIZE(args2))); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3716 bool has_pending_exception; | 3717 bool has_pending_exception; |
| 3717 Handle<Object> argv[] = { result }; | 3718 Handle<Object> argv[] = { result }; |
| 3718 Handle<Object> desc = Execution::Call( | 3719 Handle<Object> desc = Execution::Call( |
| 3719 isolate, isolate->to_complete_property_descriptor(), result, | 3720 isolate, isolate->to_complete_property_descriptor(), result, |
| 3720 ARRAY_SIZE(argv), argv, &has_pending_exception); | 3721 ARRAY_SIZE(argv), argv, &has_pending_exception); |
| 3721 if (has_pending_exception) return NONE; | 3722 if (has_pending_exception) return NONE; |
| 3722 | 3723 |
| 3723 // Convert result to PropertyAttributes. | 3724 // Convert result to PropertyAttributes. |
| 3724 Handle<String> enum_n = isolate->factory()->InternalizeOneByteString( | 3725 Handle<String> enum_n = isolate->factory()->InternalizeOneByteString( |
| 3725 STATIC_ASCII_VECTOR("enumerable_")); | 3726 STATIC_ASCII_VECTOR("enumerable_")); |
| 3726 Handle<Object> enumerable(v8::internal::GetProperty(isolate, desc, enum_n)); | 3727 Handle<Object> enumerable = Object::GetProperty(desc, enum_n); |
| 3727 if (isolate->has_pending_exception()) return NONE; | 3728 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, enumerable, NONE); |
| 3728 Handle<String> conf_n = isolate->factory()->InternalizeOneByteString( | 3729 Handle<String> conf_n = isolate->factory()->InternalizeOneByteString( |
| 3729 STATIC_ASCII_VECTOR("configurable_")); | 3730 STATIC_ASCII_VECTOR("configurable_")); |
| 3730 Handle<Object> configurable(v8::internal::GetProperty(isolate, desc, conf_n)); | 3731 Handle<Object> configurable = Object::GetProperty(desc, conf_n); |
| 3731 if (isolate->has_pending_exception()) return NONE; | 3732 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, configurable, NONE); |
| 3732 Handle<String> writ_n = isolate->factory()->InternalizeOneByteString( | 3733 Handle<String> writ_n = isolate->factory()->InternalizeOneByteString( |
| 3733 STATIC_ASCII_VECTOR("writable_")); | 3734 STATIC_ASCII_VECTOR("writable_")); |
| 3734 Handle<Object> writable(v8::internal::GetProperty(isolate, desc, writ_n)); | 3735 Handle<Object> writable = Object::GetProperty(desc, writ_n); |
| 3735 if (isolate->has_pending_exception()) return NONE; | 3736 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, writable, NONE); |
| 3736 if (!writable->BooleanValue()) { | 3737 if (!writable->BooleanValue()) { |
| 3737 Handle<String> set_n = isolate->factory()->InternalizeOneByteString( | 3738 Handle<String> set_n = isolate->factory()->InternalizeOneByteString( |
| 3738 STATIC_ASCII_VECTOR("set_")); | 3739 STATIC_ASCII_VECTOR("set_")); |
| 3739 Handle<Object> setter(v8::internal::GetProperty(isolate, desc, set_n)); | 3740 Handle<Object> setter = Object::GetProperty(desc, set_n); |
| 3740 if (isolate->has_pending_exception()) return NONE; | 3741 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, setter, NONE); |
|
Igor Sheludko
2014/03/26 18:37:31
Add two spaces in front of the line.
Yang
2014/03/28 09:56:58
Done.
| |
| 3741 writable = isolate->factory()->ToBoolean(!setter->IsUndefined()); | 3742 writable = isolate->factory()->ToBoolean(!setter->IsUndefined()); |
| 3742 } | 3743 } |
| 3743 | 3744 |
| 3744 if (configurable->IsFalse()) { | 3745 if (configurable->IsFalse()) { |
| 3745 Handle<Object> handler(proxy->handler(), isolate); | 3746 Handle<Object> handler(proxy->handler(), isolate); |
| 3746 Handle<String> trap = isolate->factory()->InternalizeOneByteString( | 3747 Handle<String> trap = isolate->factory()->InternalizeOneByteString( |
| 3747 STATIC_ASCII_VECTOR("getPropertyDescriptor")); | 3748 STATIC_ASCII_VECTOR("getPropertyDescriptor")); |
| 3748 Handle<Object> args[] = { handler, trap, name }; | 3749 Handle<Object> args[] = { handler, trap, name }; |
| 3749 Handle<Object> error = isolate->factory()->NewTypeError( | 3750 Handle<Object> error = isolate->factory()->NewTypeError( |
| 3750 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args))); | 3751 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args))); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3793 | 3794 |
| 3794 | 3795 |
| 3795 MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name, | 3796 MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name, |
| 3796 Handle<Object> derived, | 3797 Handle<Object> derived, |
| 3797 int argc, | 3798 int argc, |
| 3798 Handle<Object> argv[]) { | 3799 Handle<Object> argv[]) { |
| 3799 Isolate* isolate = GetIsolate(); | 3800 Isolate* isolate = GetIsolate(); |
| 3800 Handle<Object> handler(this->handler(), isolate); | 3801 Handle<Object> handler(this->handler(), isolate); |
| 3801 | 3802 |
| 3802 Handle<String> trap_name = isolate->factory()->InternalizeUtf8String(name); | 3803 Handle<String> trap_name = isolate->factory()->InternalizeUtf8String(name); |
| 3803 Handle<Object> trap(v8::internal::GetProperty(isolate, handler, trap_name)); | 3804 Handle<Object> trap = Object::GetPropertyOrElement(handler, trap_name); |
| 3804 if (isolate->has_pending_exception()) return trap; | 3805 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, trap, Handle<Object>()); |
| 3805 | 3806 |
| 3806 if (trap->IsUndefined()) { | 3807 if (trap->IsUndefined()) { |
| 3807 if (derived.is_null()) { | 3808 if (derived.is_null()) { |
| 3808 Handle<Object> args[] = { handler, trap_name }; | 3809 Handle<Object> args[] = { handler, trap_name }; |
| 3809 Handle<Object> error = isolate->factory()->NewTypeError( | 3810 Handle<Object> error = isolate->factory()->NewTypeError( |
| 3810 "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args))); | 3811 "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args))); |
| 3811 isolate->Throw(*error); | 3812 isolate->Throw(*error); |
| 3812 return Handle<Object>(); | 3813 return Handle<Object>(); |
| 3813 } | 3814 } |
| 3814 trap = Handle<Object>(derived); | 3815 trap = Handle<Object>(derived); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4060 return Handle<Object>(); | 4061 return Handle<Object>(); |
| 4061 } else { | 4062 } else { |
| 4062 return value; | 4063 return value; |
| 4063 } | 4064 } |
| 4064 } | 4065 } |
| 4065 | 4066 |
| 4066 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 4067 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
| 4067 bool is_observed = object->map()->is_observed() && | 4068 bool is_observed = object->map()->is_observed() && |
| 4068 *name != isolate->heap()->hidden_string(); | 4069 *name != isolate->heap()->hidden_string(); |
| 4069 if (is_observed && lookup->IsDataProperty()) { | 4070 if (is_observed && lookup->IsDataProperty()) { |
| 4070 old_value = Object::GetProperty(object, name); | 4071 old_value = Object::GetPropertyOrElement(object, name); |
| 4071 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | 4072 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); |
| 4072 } | 4073 } |
| 4073 | 4074 |
| 4074 // This is a real property that is not read-only, or it is a | 4075 // This is a real property that is not read-only, or it is a |
| 4075 // transition or null descriptor and there are no setters in the prototypes. | 4076 // transition or null descriptor and there are no setters in the prototypes. |
| 4076 Handle<Object> result = value; | 4077 Handle<Object> result = value; |
| 4077 switch (lookup->type()) { | 4078 switch (lookup->type()) { |
| 4078 case NORMAL: | 4079 case NORMAL: |
| 4079 SetNormalizedProperty(handle(lookup->holder()), lookup, value); | 4080 SetNormalizedProperty(handle(lookup->holder()), lookup, value); |
| 4080 break; | 4081 break; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 4106 | 4107 |
| 4107 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>()); | 4108 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>()); |
| 4108 | 4109 |
| 4109 if (is_observed) { | 4110 if (is_observed) { |
| 4110 if (lookup->IsTransition()) { | 4111 if (lookup->IsTransition()) { |
| 4111 EnqueueChangeRecord(object, "add", name, old_value); | 4112 EnqueueChangeRecord(object, "add", name, old_value); |
| 4112 } else { | 4113 } else { |
| 4113 LookupResult new_lookup(isolate); | 4114 LookupResult new_lookup(isolate); |
| 4114 object->LocalLookup(*name, &new_lookup, true); | 4115 object->LocalLookup(*name, &new_lookup, true); |
| 4115 if (new_lookup.IsDataProperty()) { | 4116 if (new_lookup.IsDataProperty()) { |
| 4116 Handle<Object> new_value = Object::GetProperty(object, name); | 4117 Handle<Object> new_value = Object::GetPropertyOrElement(object, name); |
| 4117 CHECK_NOT_EMPTY_HANDLE(isolate, new_value); | 4118 CHECK_NOT_EMPTY_HANDLE(isolate, new_value); |
| 4118 if (!new_value->SameValue(*old_value)) { | 4119 if (!new_value->SameValue(*old_value)) { |
| 4119 EnqueueChangeRecord(object, "update", name, old_value); | 4120 EnqueueChangeRecord(object, "update", name, old_value); |
| 4120 } | 4121 } |
| 4121 } | 4122 } |
| 4122 } | 4123 } |
| 4123 } | 4124 } |
| 4124 | 4125 |
| 4125 return result; | 4126 return result; |
| 4126 } | 4127 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4185 return AddProperty(object, name, value, attributes, SLOPPY, | 4186 return AddProperty(object, name, value, attributes, SLOPPY, |
| 4186 MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode, flag); | 4187 MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode, flag); |
| 4187 } | 4188 } |
| 4188 | 4189 |
| 4189 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 4190 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
| 4190 PropertyAttributes old_attributes = ABSENT; | 4191 PropertyAttributes old_attributes = ABSENT; |
| 4191 bool is_observed = object->map()->is_observed() && | 4192 bool is_observed = object->map()->is_observed() && |
| 4192 *name != isolate->heap()->hidden_string(); | 4193 *name != isolate->heap()->hidden_string(); |
| 4193 if (is_observed && lookup.IsProperty()) { | 4194 if (is_observed && lookup.IsProperty()) { |
| 4194 if (lookup.IsDataProperty()) { | 4195 if (lookup.IsDataProperty()) { |
| 4195 old_value = Object::GetProperty(object, name); | 4196 old_value = Object::GetPropertyOrElement(object, name); |
| 4196 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | 4197 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); |
| 4197 } | 4198 } |
| 4198 old_attributes = lookup.GetAttributes(); | 4199 old_attributes = lookup.GetAttributes(); |
| 4199 } | 4200 } |
| 4200 | 4201 |
| 4201 // Check of IsReadOnly removed from here in clone. | 4202 // Check of IsReadOnly removed from here in clone. |
| 4202 switch (lookup.type()) { | 4203 switch (lookup.type()) { |
| 4203 case NORMAL: | 4204 case NORMAL: |
| 4204 ReplaceSlowProperty(object, name, value, attributes); | 4205 ReplaceSlowProperty(object, name, value, attributes); |
| 4205 break; | 4206 break; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 4231 if (is_observed) { | 4232 if (is_observed) { |
| 4232 if (lookup.IsTransition()) { | 4233 if (lookup.IsTransition()) { |
| 4233 EnqueueChangeRecord(object, "add", name, old_value); | 4234 EnqueueChangeRecord(object, "add", name, old_value); |
| 4234 } else if (old_value->IsTheHole()) { | 4235 } else if (old_value->IsTheHole()) { |
| 4235 EnqueueChangeRecord(object, "reconfigure", name, old_value); | 4236 EnqueueChangeRecord(object, "reconfigure", name, old_value); |
| 4236 } else { | 4237 } else { |
| 4237 LookupResult new_lookup(isolate); | 4238 LookupResult new_lookup(isolate); |
| 4238 object->LocalLookup(*name, &new_lookup, true); | 4239 object->LocalLookup(*name, &new_lookup, true); |
| 4239 bool value_changed = false; | 4240 bool value_changed = false; |
| 4240 if (new_lookup.IsDataProperty()) { | 4241 if (new_lookup.IsDataProperty()) { |
| 4241 Handle<Object> new_value = Object::GetProperty(object, name); | 4242 Handle<Object> new_value = Object::GetPropertyOrElement(object, name); |
| 4242 CHECK_NOT_EMPTY_HANDLE(isolate, new_value); | 4243 CHECK_NOT_EMPTY_HANDLE(isolate, new_value); |
| 4243 value_changed = !old_value->SameValue(*new_value); | 4244 value_changed = !old_value->SameValue(*new_value); |
| 4244 } | 4245 } |
| 4245 if (new_lookup.GetAttributes() != old_attributes) { | 4246 if (new_lookup.GetAttributes() != old_attributes) { |
| 4246 if (!value_changed) old_value = isolate->factory()->the_hole_value(); | 4247 if (!value_changed) old_value = isolate->factory()->the_hole_value(); |
| 4247 EnqueueChangeRecord(object, "reconfigure", name, old_value); | 4248 EnqueueChangeRecord(object, "reconfigure", name, old_value); |
| 4248 } else if (value_changed) { | 4249 } else if (value_changed) { |
| 4249 EnqueueChangeRecord(object, "update", name, old_value); | 4250 EnqueueChangeRecord(object, "update", name, old_value); |
| 4250 } | 4251 } |
| 4251 } | 4252 } |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5220 isolate->Throw(*error); | 5221 isolate->Throw(*error); |
| 5221 return Handle<Object>(); | 5222 return Handle<Object>(); |
| 5222 } | 5223 } |
| 5223 return isolate->factory()->false_value(); | 5224 return isolate->factory()->false_value(); |
| 5224 } | 5225 } |
| 5225 | 5226 |
| 5226 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 5227 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
| 5227 bool is_observed = object->map()->is_observed() && | 5228 bool is_observed = object->map()->is_observed() && |
| 5228 *name != isolate->heap()->hidden_string(); | 5229 *name != isolate->heap()->hidden_string(); |
| 5229 if (is_observed && lookup.IsDataProperty()) { | 5230 if (is_observed && lookup.IsDataProperty()) { |
| 5230 old_value = Object::GetProperty(object, name); | 5231 old_value = Object::GetPropertyOrElement(object, name); |
| 5231 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | 5232 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); |
| 5232 } | 5233 } |
| 5233 Handle<Object> result; | 5234 Handle<Object> result; |
| 5234 | 5235 |
| 5235 // Check for interceptor. | 5236 // Check for interceptor. |
| 5236 if (lookup.IsInterceptor()) { | 5237 if (lookup.IsInterceptor()) { |
| 5237 // Skip interceptor if forcing a deletion. | 5238 // Skip interceptor if forcing a deletion. |
| 5238 if (mode == FORCE_DELETION) { | 5239 if (mode == FORCE_DELETION) { |
| 5239 result = DeletePropertyPostInterceptor(object, name, mode); | 5240 result = DeletePropertyPostInterceptor(object, name, mode); |
| 5240 } else { | 5241 } else { |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6326 if (is_element) { | 6327 if (is_element) { |
| 6327 preexists = HasLocalElement(object, index); | 6328 preexists = HasLocalElement(object, index); |
| 6328 if (preexists && object->GetLocalElementAccessorPair(index) == NULL) { | 6329 if (preexists && object->GetLocalElementAccessorPair(index) == NULL) { |
| 6329 old_value = Object::GetElementNoExceptionThrown(isolate, object, index); | 6330 old_value = Object::GetElementNoExceptionThrown(isolate, object, index); |
| 6330 } | 6331 } |
| 6331 } else { | 6332 } else { |
| 6332 LookupResult lookup(isolate); | 6333 LookupResult lookup(isolate); |
| 6333 object->LocalLookup(*name, &lookup, true); | 6334 object->LocalLookup(*name, &lookup, true); |
| 6334 preexists = lookup.IsProperty(); | 6335 preexists = lookup.IsProperty(); |
| 6335 if (preexists && lookup.IsDataProperty()) { | 6336 if (preexists && lookup.IsDataProperty()) { |
| 6336 old_value = Object::GetProperty(object, name); | 6337 old_value = Object::GetPropertyOrElement(object, name); |
| 6337 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | 6338 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); |
| 6338 } | 6339 } |
| 6339 } | 6340 } |
| 6340 } | 6341 } |
| 6341 | 6342 |
| 6342 if (is_element) { | 6343 if (is_element) { |
| 6343 DefineElementAccessor( | 6344 DefineElementAccessor( |
| 6344 object, index, getter, setter, attributes, access_control); | 6345 object, index, getter, setter, attributes, access_control); |
| 6345 } else { | 6346 } else { |
| 6346 DefinePropertyAccessor( | 6347 DefinePropertyAccessor( |
| (...skipping 10072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16419 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16420 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16420 static const char* error_messages_[] = { | 16421 static const char* error_messages_[] = { |
| 16421 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16422 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16422 }; | 16423 }; |
| 16423 #undef ERROR_MESSAGES_TEXTS | 16424 #undef ERROR_MESSAGES_TEXTS |
| 16424 return error_messages_[reason]; | 16425 return error_messages_[reason]; |
| 16425 } | 16426 } |
| 16426 | 16427 |
| 16427 | 16428 |
| 16428 } } // namespace v8::internal | 16429 } } // namespace v8::internal |
| OLD | NEW |