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 4356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4367 // Check whether it makes sense to reuse the lookup iterator. Here it | 4367 // Check whether it makes sense to reuse the lookup iterator. Here it |
4368 // might still call into setters up the prototype chain. | 4368 // might still call into setters up the prototype chain. |
4369 return JSObject::SetPropertyWithFailedAccessCheck(it, value, | 4369 return JSObject::SetPropertyWithFailedAccessCheck(it, value, |
4370 should_throw); | 4370 should_throw); |
4371 | 4371 |
4372 case LookupIterator::JSPROXY: | 4372 case LookupIterator::JSPROXY: |
4373 return JSProxy::SetProperty(it->GetHolder<JSProxy>(), it->GetName(), | 4373 return JSProxy::SetProperty(it->GetHolder<JSProxy>(), it->GetName(), |
4374 value, it->GetReceiver(), language_mode); | 4374 value, it->GetReceiver(), language_mode); |
4375 | 4375 |
4376 case LookupIterator::INTERCEPTOR: { | 4376 case LookupIterator::INTERCEPTOR: { |
4377 Handle<Map> store_target_map = | 4377 Handle<Map> store_target_map; |
4378 handle(it->GetStoreTarget()->map(), it->isolate()); | 4378 if (it->GetReceiver()->IsJSObject()) { |
| 4379 store_target_map = handle(it->GetStoreTarget()->map(), it->isolate()); |
| 4380 } |
4379 if (it->HolderIsReceiverOrHiddenPrototype()) { | 4381 if (it->HolderIsReceiverOrHiddenPrototype()) { |
4380 Maybe<bool> result = | 4382 Maybe<bool> result = |
4381 JSObject::SetPropertyWithInterceptor(it, should_throw, value); | 4383 JSObject::SetPropertyWithInterceptor(it, should_throw, value); |
4382 if (result.IsNothing() || result.FromJust()) return result; | 4384 if (result.IsNothing() || result.FromJust()) return result; |
4383 // Interceptor modified the store target but failed to set the | 4385 // Interceptor modified the store target but failed to set the |
4384 // property. | 4386 // property. |
4385 Utils::ApiCheck(*store_target_map == it->GetStoreTarget()->map(), | 4387 Utils::ApiCheck(store_target_map.is_null() || |
| 4388 *store_target_map == it->GetStoreTarget()->map(), |
4386 it->IsElement() ? "v8::IndexedPropertySetterCallback" | 4389 it->IsElement() ? "v8::IndexedPropertySetterCallback" |
4387 : "v8::NamedPropertySetterCallback", | 4390 : "v8::NamedPropertySetterCallback", |
4388 "Interceptor silently changed store target."); | 4391 "Interceptor silently changed store target."); |
4389 } else { | 4392 } else { |
4390 Maybe<PropertyAttributes> maybe_attributes = | 4393 Maybe<PropertyAttributes> maybe_attributes = |
4391 JSObject::GetPropertyAttributesWithInterceptor(it); | 4394 JSObject::GetPropertyAttributesWithInterceptor(it); |
4392 if (!maybe_attributes.IsJust()) return Nothing<bool>(); | 4395 if (!maybe_attributes.IsJust()) return Nothing<bool>(); |
4393 if ((maybe_attributes.FromJust() & READ_ONLY) != 0) { | 4396 if ((maybe_attributes.FromJust() & READ_ONLY) != 0) { |
4394 return WriteToReadOnlyProperty(it, value, should_throw); | 4397 return WriteToReadOnlyProperty(it, value, should_throw); |
4395 } | 4398 } |
4396 // Interceptor modified the store target but failed to set the | 4399 // Interceptor modified the store target but failed to set the |
4397 // property. | 4400 // property. |
4398 Utils::ApiCheck(*store_target_map == it->GetStoreTarget()->map(), | 4401 Utils::ApiCheck(store_target_map.is_null() || |
| 4402 *store_target_map == it->GetStoreTarget()->map(), |
4399 it->IsElement() ? "v8::IndexedPropertySetterCallback" | 4403 it->IsElement() ? "v8::IndexedPropertySetterCallback" |
4400 : "v8::NamedPropertySetterCallback", | 4404 : "v8::NamedPropertySetterCallback", |
4401 "Interceptor silently changed store target."); | 4405 "Interceptor silently changed store target."); |
4402 if (maybe_attributes.FromJust() == ABSENT) break; | 4406 if (maybe_attributes.FromJust() == ABSENT) break; |
4403 *found = false; | 4407 *found = false; |
4404 return Nothing<bool>(); | 4408 return Nothing<bool>(); |
4405 } | 4409 } |
4406 break; | 4410 break; |
4407 } | 4411 } |
4408 | 4412 |
(...skipping 14581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18990 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, | 18994 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, |
18991 PrototypeIterator::END_AT_NULL); | 18995 PrototypeIterator::END_AT_NULL); |
18992 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { | 18996 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { |
18993 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; | 18997 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; |
18994 } | 18998 } |
18995 return false; | 18999 return false; |
18996 } | 19000 } |
18997 | 19001 |
18998 } // namespace internal | 19002 } // namespace internal |
18999 } // namespace v8 | 19003 } // namespace v8 |
OLD | NEW |