OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3097 Handle<Object> accessors = it->GetAccessors(); | 3097 Handle<Object> accessors = it->GetAccessors(); |
3098 if (accessors->IsAccessorInfo() && | 3098 if (accessors->IsAccessorInfo() && |
3099 !it->HolderIsReceiverOrHiddenPrototype() && | 3099 !it->HolderIsReceiverOrHiddenPrototype() && |
3100 AccessorInfo::cast(*accessors)->is_special_data_property()) { | 3100 AccessorInfo::cast(*accessors)->is_special_data_property()) { |
3101 done = true; | 3101 done = true; |
3102 break; | 3102 break; |
3103 } | 3103 } |
3104 return SetPropertyWithAccessor(it, value, language_mode); | 3104 return SetPropertyWithAccessor(it, value, language_mode); |
3105 } | 3105 } |
3106 case LookupIterator::INTEGER_INDEXED_EXOTIC: | 3106 case LookupIterator::INTEGER_INDEXED_EXOTIC: |
3107 done = true; | 3107 // TODO(verwaest): We should throw an exception. |
3108 break; | 3108 return value; |
3109 | 3109 |
3110 case LookupIterator::DATA: | 3110 case LookupIterator::DATA: |
3111 if (it->IsReadOnly()) { | 3111 if (it->IsReadOnly()) { |
3112 return WriteToReadOnlyProperty(it, value, language_mode); | 3112 return WriteToReadOnlyProperty(it, value, language_mode); |
3113 } | 3113 } |
3114 if (it->HolderIsReceiverOrHiddenPrototype()) { | 3114 if (it->HolderIsReceiverOrHiddenPrototype()) { |
3115 return SetDataProperty(it, value); | 3115 return SetDataProperty(it, value); |
3116 } | 3116 } |
3117 done = true; | 3117 done = true; |
3118 break; | 3118 break; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3173 | 3173 |
3174 for (; own_lookup.IsFound(); own_lookup.Next()) { | 3174 for (; own_lookup.IsFound(); own_lookup.Next()) { |
3175 switch (own_lookup.state()) { | 3175 switch (own_lookup.state()) { |
3176 case LookupIterator::ACCESS_CHECK: | 3176 case LookupIterator::ACCESS_CHECK: |
3177 if (!own_lookup.HasAccess()) { | 3177 if (!own_lookup.HasAccess()) { |
3178 return JSObject::SetPropertyWithFailedAccessCheck(&own_lookup, value); | 3178 return JSObject::SetPropertyWithFailedAccessCheck(&own_lookup, value); |
3179 } | 3179 } |
3180 break; | 3180 break; |
3181 | 3181 |
3182 case LookupIterator::INTEGER_INDEXED_EXOTIC: | 3182 case LookupIterator::INTEGER_INDEXED_EXOTIC: |
3183 return result; | 3183 return RedefineNonconfigurableProperty(it->isolate(), it->GetName(), |
| 3184 value, language_mode); |
3184 | 3185 |
3185 case LookupIterator::DATA: { | 3186 case LookupIterator::DATA: { |
3186 PropertyDetails details = own_lookup.property_details(); | 3187 PropertyDetails details = own_lookup.property_details(); |
3187 if (details.IsConfigurable() || !details.IsReadOnly()) { | 3188 if (details.IsConfigurable() || !details.IsReadOnly()) { |
3188 return JSObject::DefineOwnPropertyIgnoreAttributes( | 3189 return JSObject::DefineOwnPropertyIgnoreAttributes( |
3189 &own_lookup, value, details.attributes()); | 3190 &own_lookup, value, details.attributes()); |
3190 } | 3191 } |
3191 return WriteToReadOnlyProperty(&own_lookup, value, language_mode); | 3192 return WriteToReadOnlyProperty(&own_lookup, value, language_mode); |
3192 } | 3193 } |
3193 | 3194 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3343 Handle<Object> value, | 3344 Handle<Object> value, |
3344 PropertyAttributes attributes, | 3345 PropertyAttributes attributes, |
3345 LanguageMode language_mode, | 3346 LanguageMode language_mode, |
3346 StoreFromKeyed store_mode) { | 3347 StoreFromKeyed store_mode) { |
3347 DCHECK(!it->GetReceiver()->IsJSProxy()); | 3348 DCHECK(!it->GetReceiver()->IsJSProxy()); |
3348 if (!it->GetReceiver()->IsJSObject()) { | 3349 if (!it->GetReceiver()->IsJSObject()) { |
3349 // TODO(verwaest): Throw a TypeError with a more specific message. | 3350 // TODO(verwaest): Throw a TypeError with a more specific message. |
3350 return WriteToReadOnlyProperty(it, value, language_mode); | 3351 return WriteToReadOnlyProperty(it, value, language_mode); |
3351 } | 3352 } |
3352 | 3353 |
3353 if (it->state() == LookupIterator::INTEGER_INDEXED_EXOTIC) return value; | 3354 DCHECK_NE(LookupIterator::INTEGER_INDEXED_EXOTIC, it->state()); |
3354 | 3355 |
3355 Handle<JSObject> receiver = it->GetStoreTarget(); | 3356 Handle<JSObject> receiver = it->GetStoreTarget(); |
3356 | 3357 |
3357 // If the receiver is a JSGlobalProxy, store on the prototype (JSGlobalObject) | 3358 // If the receiver is a JSGlobalProxy, store on the prototype (JSGlobalObject) |
3358 // instead. If the prototype is Null, the proxy is detached. | 3359 // instead. If the prototype is Null, the proxy is detached. |
3359 if (receiver->IsJSGlobalProxy()) return value; | 3360 if (receiver->IsJSGlobalProxy()) return value; |
3360 | 3361 |
3361 Isolate* isolate = it->isolate(); | 3362 Isolate* isolate = it->isolate(); |
3362 | 3363 |
3363 if (!receiver->map()->is_extensible() && | 3364 if (!receiver->map()->is_extensible() && |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4174 // they throw. Here we should do the same. | 4175 // they throw. Here we should do the same. |
4175 case LookupIterator::INTERCEPTOR: | 4176 case LookupIterator::INTERCEPTOR: |
4176 if (handling == DONT_FORCE_FIELD) { | 4177 if (handling == DONT_FORCE_FIELD) { |
4177 MaybeHandle<Object> maybe_result = | 4178 MaybeHandle<Object> maybe_result = |
4178 JSObject::SetPropertyWithInterceptor(it, value); | 4179 JSObject::SetPropertyWithInterceptor(it, value); |
4179 if (!maybe_result.is_null()) return maybe_result; | 4180 if (!maybe_result.is_null()) return maybe_result; |
4180 if (it->isolate()->has_pending_exception()) return maybe_result; | 4181 if (it->isolate()->has_pending_exception()) return maybe_result; |
4181 } | 4182 } |
4182 break; | 4183 break; |
4183 | 4184 |
4184 case LookupIterator::INTEGER_INDEXED_EXOTIC: | |
4185 return value; | |
4186 | |
4187 case LookupIterator::ACCESSOR: { | 4185 case LookupIterator::ACCESSOR: { |
4188 Handle<Object> accessors = it->GetAccessors(); | 4186 Handle<Object> accessors = it->GetAccessors(); |
4189 | 4187 |
4190 // Special handling for ExecutableAccessorInfo, which behaves like a | 4188 // Special handling for ExecutableAccessorInfo, which behaves like a |
4191 // data property. | 4189 // data property. |
4192 if (accessors->IsExecutableAccessorInfo() && | 4190 if (accessors->IsExecutableAccessorInfo() && |
4193 handling == DONT_FORCE_FIELD) { | 4191 handling == DONT_FORCE_FIELD) { |
4194 PropertyDetails details = it->property_details(); | 4192 PropertyDetails details = it->property_details(); |
4195 // Ensure the context isn't changed after calling into accessors. | 4193 // Ensure the context isn't changed after calling into accessors. |
4196 AssertNoContextChange ncc(it->isolate()); | 4194 AssertNoContextChange ncc(it->isolate()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4229 if (is_observed) { | 4227 if (is_observed) { |
4230 RETURN_ON_EXCEPTION( | 4228 RETURN_ON_EXCEPTION( |
4231 it->isolate(), | 4229 it->isolate(), |
4232 EnqueueChangeRecord(object, "reconfigure", it->GetName(), | 4230 EnqueueChangeRecord(object, "reconfigure", it->GetName(), |
4233 it->factory()->the_hole_value()), | 4231 it->factory()->the_hole_value()), |
4234 Object); | 4232 Object); |
4235 } | 4233 } |
4236 | 4234 |
4237 return value; | 4235 return value; |
4238 } | 4236 } |
| 4237 case LookupIterator::INTEGER_INDEXED_EXOTIC: |
| 4238 return RedefineNonconfigurableProperty(it->isolate(), it->GetName(), |
| 4239 value, STRICT); |
| 4240 |
4239 case LookupIterator::DATA: { | 4241 case LookupIterator::DATA: { |
4240 PropertyDetails details = it->property_details(); | 4242 PropertyDetails details = it->property_details(); |
4241 Handle<Object> old_value = it->factory()->the_hole_value(); | 4243 Handle<Object> old_value = it->factory()->the_hole_value(); |
4242 // Regular property update if the attributes match. | 4244 // Regular property update if the attributes match. |
4243 if (details.attributes() == attributes) { | 4245 if (details.attributes() == attributes) { |
4244 return SetDataProperty(it, value); | 4246 return SetDataProperty(it, value); |
4245 } | 4247 } |
4246 | 4248 |
4247 // Special case: properties of typed arrays cannot be reconfigured to | 4249 // Special case: properties of typed arrays cannot be reconfigured to |
4248 // non-writable nor to non-enumerable. | 4250 // non-writable nor to non-enumerable. |
(...skipping 12402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16651 Handle<Object> new_value) { | 16653 Handle<Object> new_value) { |
16652 if (cell->value() != *new_value) { | 16654 if (cell->value() != *new_value) { |
16653 cell->set_value(*new_value); | 16655 cell->set_value(*new_value); |
16654 Isolate* isolate = cell->GetIsolate(); | 16656 Isolate* isolate = cell->GetIsolate(); |
16655 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16657 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
16656 isolate, DependentCode::kPropertyCellChangedGroup); | 16658 isolate, DependentCode::kPropertyCellChangedGroup); |
16657 } | 16659 } |
16658 } | 16660 } |
16659 } // namespace internal | 16661 } // namespace internal |
16660 } // namespace v8 | 16662 } // namespace v8 |
OLD | NEW |