OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 4272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4283 if (it->HasAccess()) break; | 4283 if (it->HasAccess()) break; |
4284 // Check whether it makes sense to reuse the lookup iterator. Here it | 4284 // Check whether it makes sense to reuse the lookup iterator. Here it |
4285 // might still call into setters up the prototype chain. | 4285 // might still call into setters up the prototype chain. |
4286 return JSObject::SetPropertyWithFailedAccessCheck(it, value, | 4286 return JSObject::SetPropertyWithFailedAccessCheck(it, value, |
4287 should_throw); | 4287 should_throw); |
4288 | 4288 |
4289 case LookupIterator::JSPROXY: | 4289 case LookupIterator::JSPROXY: |
4290 return JSProxy::SetProperty(it->GetHolder<JSProxy>(), it->GetName(), | 4290 return JSProxy::SetProperty(it->GetHolder<JSProxy>(), it->GetName(), |
4291 value, it->GetReceiver(), language_mode); | 4291 value, it->GetReceiver(), language_mode); |
4292 | 4292 |
4293 case LookupIterator::INTERCEPTOR: | 4293 case LookupIterator::INTERCEPTOR: { |
| 4294 Handle<Map> store_target_map = |
| 4295 handle(it->GetStoreTarget()->map(), it->isolate()); |
4294 if (it->HolderIsReceiverOrHiddenPrototype()) { | 4296 if (it->HolderIsReceiverOrHiddenPrototype()) { |
4295 Maybe<bool> result = | 4297 Maybe<bool> result = |
4296 JSObject::SetPropertyWithInterceptor(it, should_throw, value); | 4298 JSObject::SetPropertyWithInterceptor(it, should_throw, value); |
4297 if (result.IsNothing() || result.FromJust()) return result; | 4299 if (result.IsNothing() || result.FromJust()) return result; |
| 4300 // Interceptor modified the store target but failed to set the |
| 4301 // property. |
| 4302 Utils::ApiCheck(*store_target_map == it->GetStoreTarget()->map(), |
| 4303 it->IsElement() ? "v8::IndexedPropertySetterCallback" |
| 4304 : "v8::NamedPropertySetterCallback", |
| 4305 "Interceptor silently changed store target."); |
4298 } else { | 4306 } else { |
4299 Maybe<PropertyAttributes> maybe_attributes = | 4307 Maybe<PropertyAttributes> maybe_attributes = |
4300 JSObject::GetPropertyAttributesWithInterceptor(it); | 4308 JSObject::GetPropertyAttributesWithInterceptor(it); |
4301 if (!maybe_attributes.IsJust()) return Nothing<bool>(); | 4309 if (!maybe_attributes.IsJust()) return Nothing<bool>(); |
4302 if (maybe_attributes.FromJust() == ABSENT) break; | |
4303 if ((maybe_attributes.FromJust() & READ_ONLY) != 0) { | 4310 if ((maybe_attributes.FromJust() & READ_ONLY) != 0) { |
4304 return WriteToReadOnlyProperty(it, value, should_throw); | 4311 return WriteToReadOnlyProperty(it, value, should_throw); |
4305 } | 4312 } |
| 4313 // Interceptor modified the store target but failed to set the |
| 4314 // property. |
| 4315 Utils::ApiCheck(*store_target_map == it->GetStoreTarget()->map(), |
| 4316 it->IsElement() ? "v8::IndexedPropertySetterCallback" |
| 4317 : "v8::NamedPropertySetterCallback", |
| 4318 "Interceptor silently changed store target."); |
| 4319 if (maybe_attributes.FromJust() == ABSENT) break; |
4306 *found = false; | 4320 *found = false; |
4307 return Nothing<bool>(); | 4321 return Nothing<bool>(); |
4308 } | 4322 } |
4309 break; | 4323 break; |
| 4324 } |
4310 | 4325 |
4311 case LookupIterator::ACCESSOR: { | 4326 case LookupIterator::ACCESSOR: { |
4312 if (it->IsReadOnly()) { | 4327 if (it->IsReadOnly()) { |
4313 return WriteToReadOnlyProperty(it, value, should_throw); | 4328 return WriteToReadOnlyProperty(it, value, should_throw); |
4314 } | 4329 } |
4315 Handle<Object> accessors = it->GetAccessors(); | 4330 Handle<Object> accessors = it->GetAccessors(); |
4316 if (accessors->IsAccessorInfo() && | 4331 if (accessors->IsAccessorInfo() && |
4317 !it->HolderIsReceiverOrHiddenPrototype() && | 4332 !it->HolderIsReceiverOrHiddenPrototype() && |
4318 AccessorInfo::cast(*accessors)->is_special_data_property()) { | 4333 AccessorInfo::cast(*accessors)->is_special_data_property()) { |
4319 *found = false; | 4334 *found = false; |
(...skipping 14093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18413 if (cell->value() != *new_value) { | 18428 if (cell->value() != *new_value) { |
18414 cell->set_value(*new_value); | 18429 cell->set_value(*new_value); |
18415 Isolate* isolate = cell->GetIsolate(); | 18430 Isolate* isolate = cell->GetIsolate(); |
18416 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18431 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
18417 isolate, DependentCode::kPropertyCellChangedGroup); | 18432 isolate, DependentCode::kPropertyCellChangedGroup); |
18418 } | 18433 } |
18419 } | 18434 } |
18420 | 18435 |
18421 } // namespace internal | 18436 } // namespace internal |
18422 } // namespace v8 | 18437 } // namespace v8 |
OLD | NEW |