| 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 "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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 case LookupIterator::INTEGER_INDEXED_EXOTIC: | 740 case LookupIterator::INTEGER_INDEXED_EXOTIC: |
| 741 return ReadAbsentProperty(it, language_mode); | 741 return ReadAbsentProperty(it, language_mode); |
| 742 case LookupIterator::DATA: | 742 case LookupIterator::DATA: |
| 743 return it->GetDataValue(); | 743 return it->GetDataValue(); |
| 744 } | 744 } |
| 745 } | 745 } |
| 746 return ReadAbsentProperty(it, language_mode); | 746 return ReadAbsentProperty(it, language_mode); |
| 747 } | 747 } |
| 748 | 748 |
| 749 | 749 |
| 750 #define STACK_CHECK(result_value) \ |
| 751 do { \ |
| 752 StackLimitCheck stack_check(isolate); \ |
| 753 if (stack_check.HasOverflowed()) { \ |
| 754 isolate->Throw(*isolate->factory()->NewRangeError( \ |
| 755 MessageTemplate::kStackOverflow)); \ |
| 756 return result_value; \ |
| 757 } \ |
| 758 } while (false) |
| 759 |
| 760 |
| 750 // static | 761 // static |
| 751 MaybeHandle<Object> JSProxy::GetProperty(Isolate* isolate, | 762 MaybeHandle<Object> JSProxy::GetProperty(Isolate* isolate, |
| 752 Handle<JSProxy> proxy, | 763 Handle<JSProxy> proxy, |
| 753 Handle<Name> name, | 764 Handle<Name> name, |
| 754 Handle<Object> receiver, | 765 Handle<Object> receiver, |
| 755 LanguageMode language_mode) { | 766 LanguageMode language_mode) { |
| 767 STACK_CHECK(MaybeHandle<Object>()); |
| 756 Handle<Name> trap_name = isolate->factory()->get_string(); | 768 Handle<Name> trap_name = isolate->factory()->get_string(); |
| 757 // 1. Assert: IsPropertyKey(P) is true. | 769 // 1. Assert: IsPropertyKey(P) is true. |
| 758 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. | 770 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
| 759 Handle<Object> handler(proxy->handler(), isolate); | 771 Handle<Object> handler(proxy->handler(), isolate); |
| 760 // 3. If handler is null, throw a TypeError exception. | 772 // 3. If handler is null, throw a TypeError exception. |
| 761 // 4. Assert: Type(handler) is Object. | 773 // 4. Assert: Type(handler) is Object. |
| 762 if (proxy->IsRevoked()) { | 774 if (proxy->IsRevoked()) { |
| 763 THROW_NEW_ERROR(isolate, | 775 THROW_NEW_ERROR(isolate, |
| 764 NewTypeError(MessageTemplate::kProxyRevoked, trap_name), | 776 NewTypeError(MessageTemplate::kProxyRevoked, trap_name), |
| 765 Object); | 777 Object); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 return writable_elems; | 969 return writable_elems; |
| 958 } | 970 } |
| 959 | 971 |
| 960 | 972 |
| 961 // ES6 9.5.1 | 973 // ES6 9.5.1 |
| 962 // static | 974 // static |
| 963 MaybeHandle<Object> JSProxy::GetPrototype(Handle<JSProxy> proxy) { | 975 MaybeHandle<Object> JSProxy::GetPrototype(Handle<JSProxy> proxy) { |
| 964 Isolate* isolate = proxy->GetIsolate(); | 976 Isolate* isolate = proxy->GetIsolate(); |
| 965 Handle<String> trap_name = isolate->factory()->getPrototypeOf_string(); | 977 Handle<String> trap_name = isolate->factory()->getPrototypeOf_string(); |
| 966 | 978 |
| 979 STACK_CHECK(MaybeHandle<Object>()); |
| 980 |
| 967 // 1. Let handler be the value of the [[ProxyHandler]] internal slot. | 981 // 1. Let handler be the value of the [[ProxyHandler]] internal slot. |
| 968 // 2. If handler is null, throw a TypeError exception. | 982 // 2. If handler is null, throw a TypeError exception. |
| 969 // 3. Assert: Type(handler) is Object. | 983 // 3. Assert: Type(handler) is Object. |
| 970 // 4. Let target be the value of the [[ProxyTarget]] internal slot. | 984 // 4. Let target be the value of the [[ProxyTarget]] internal slot. |
| 971 if (proxy->IsRevoked()) { | 985 if (proxy->IsRevoked()) { |
| 972 THROW_NEW_ERROR(isolate, | 986 THROW_NEW_ERROR(isolate, |
| 973 NewTypeError(MessageTemplate::kProxyRevoked, trap_name), | 987 NewTypeError(MessageTemplate::kProxyRevoked, trap_name), |
| 974 Object); | 988 Object); |
| 975 } | 989 } |
| 976 Handle<JSReceiver> target(proxy->target(), isolate); | 990 Handle<JSReceiver> target(proxy->target(), isolate); |
| (...skipping 3640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4617 | 4631 |
| 4618 void JSProxy::Revoke(Handle<JSProxy> proxy) { | 4632 void JSProxy::Revoke(Handle<JSProxy> proxy) { |
| 4619 Isolate* isolate = proxy->GetIsolate(); | 4633 Isolate* isolate = proxy->GetIsolate(); |
| 4620 if (!proxy->IsRevoked()) proxy->set_handler(isolate->heap()->null_value()); | 4634 if (!proxy->IsRevoked()) proxy->set_handler(isolate->heap()->null_value()); |
| 4621 DCHECK(proxy->IsRevoked()); | 4635 DCHECK(proxy->IsRevoked()); |
| 4622 } | 4636 } |
| 4623 | 4637 |
| 4624 | 4638 |
| 4625 Maybe<bool> JSProxy::HasProperty(Isolate* isolate, Handle<JSProxy> proxy, | 4639 Maybe<bool> JSProxy::HasProperty(Isolate* isolate, Handle<JSProxy> proxy, |
| 4626 Handle<Name> name) { | 4640 Handle<Name> name) { |
| 4641 STACK_CHECK(Nothing<bool>()); |
| 4627 // 1. (Assert) | 4642 // 1. (Assert) |
| 4628 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. | 4643 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
| 4629 Handle<Object> handler(proxy->handler(), isolate); | 4644 Handle<Object> handler(proxy->handler(), isolate); |
| 4630 // 3. If handler is null, throw a TypeError exception. | 4645 // 3. If handler is null, throw a TypeError exception. |
| 4631 // 4. Assert: Type(handler) is Object. | 4646 // 4. Assert: Type(handler) is Object. |
| 4632 if (proxy->IsRevoked()) { | 4647 if (proxy->IsRevoked()) { |
| 4633 isolate->Throw(*isolate->factory()->NewTypeError( | 4648 isolate->Throw(*isolate->factory()->NewTypeError( |
| 4634 MessageTemplate::kProxyRevoked, isolate->factory()->has_string())); | 4649 MessageTemplate::kProxyRevoked, isolate->factory()->has_string())); |
| 4635 return Nothing<bool>(); | 4650 return Nothing<bool>(); |
| 4636 } | 4651 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4684 } | 4699 } |
| 4685 // 10. Return booleanTrapResult. | 4700 // 10. Return booleanTrapResult. |
| 4686 return Just(boolean_trap_result); | 4701 return Just(boolean_trap_result); |
| 4687 } | 4702 } |
| 4688 | 4703 |
| 4689 | 4704 |
| 4690 Maybe<bool> JSProxy::SetProperty(Handle<JSProxy> proxy, Handle<Name> name, | 4705 Maybe<bool> JSProxy::SetProperty(Handle<JSProxy> proxy, Handle<Name> name, |
| 4691 Handle<Object> value, Handle<Object> receiver, | 4706 Handle<Object> value, Handle<Object> receiver, |
| 4692 LanguageMode language_mode) { | 4707 LanguageMode language_mode) { |
| 4693 Isolate* isolate = proxy->GetIsolate(); | 4708 Isolate* isolate = proxy->GetIsolate(); |
| 4709 STACK_CHECK(Nothing<bool>()); |
| 4694 Factory* factory = isolate->factory(); | 4710 Factory* factory = isolate->factory(); |
| 4695 Handle<String> trap_name = factory->set_string(); | 4711 Handle<String> trap_name = factory->set_string(); |
| 4696 ShouldThrow should_throw = | 4712 ShouldThrow should_throw = |
| 4697 is_sloppy(language_mode) ? DONT_THROW : THROW_ON_ERROR; | 4713 is_sloppy(language_mode) ? DONT_THROW : THROW_ON_ERROR; |
| 4698 | 4714 |
| 4699 if (proxy->IsRevoked()) { | 4715 if (proxy->IsRevoked()) { |
| 4700 isolate->Throw( | 4716 isolate->Throw( |
| 4701 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name)); | 4717 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name)); |
| 4702 return Nothing<bool>(); | 4718 return Nothing<bool>(); |
| 4703 } | 4719 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4753 return Just(true); | 4769 return Just(true); |
| 4754 } | 4770 } |
| 4755 | 4771 |
| 4756 | 4772 |
| 4757 Maybe<bool> JSProxy::DeletePropertyOrElement(Handle<JSProxy> proxy, | 4773 Maybe<bool> JSProxy::DeletePropertyOrElement(Handle<JSProxy> proxy, |
| 4758 Handle<Name> name, | 4774 Handle<Name> name, |
| 4759 LanguageMode language_mode) { | 4775 LanguageMode language_mode) { |
| 4760 ShouldThrow should_throw = | 4776 ShouldThrow should_throw = |
| 4761 is_sloppy(language_mode) ? DONT_THROW : THROW_ON_ERROR; | 4777 is_sloppy(language_mode) ? DONT_THROW : THROW_ON_ERROR; |
| 4762 Isolate* isolate = proxy->GetIsolate(); | 4778 Isolate* isolate = proxy->GetIsolate(); |
| 4779 STACK_CHECK(Nothing<bool>()); |
| 4763 Factory* factory = isolate->factory(); | 4780 Factory* factory = isolate->factory(); |
| 4764 Handle<String> trap_name = factory->deleteProperty_string(); | 4781 Handle<String> trap_name = factory->deleteProperty_string(); |
| 4765 | 4782 |
| 4766 if (proxy->IsRevoked()) { | 4783 if (proxy->IsRevoked()) { |
| 4767 isolate->Throw( | 4784 isolate->Throw( |
| 4768 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name)); | 4785 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name)); |
| 4769 return Nothing<bool>(); | 4786 return Nothing<bool>(); |
| 4770 } | 4787 } |
| 4771 Handle<JSReceiver> target(proxy->target(), isolate); | 4788 Handle<JSReceiver> target(proxy->target(), isolate); |
| 4772 Handle<JSReceiver> handler(JSReceiver::cast(proxy->handler()), isolate); | 4789 Handle<JSReceiver> handler(JSReceiver::cast(proxy->handler()), isolate); |
| (...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6791 return Just(result); | 6808 return Just(result); |
| 6792 } | 6809 } |
| 6793 | 6810 |
| 6794 | 6811 |
| 6795 // ES6 9.5.6 | 6812 // ES6 9.5.6 |
| 6796 // static | 6813 // static |
| 6797 Maybe<bool> JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy, | 6814 Maybe<bool> JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy, |
| 6798 Handle<Object> key, | 6815 Handle<Object> key, |
| 6799 PropertyDescriptor* desc, | 6816 PropertyDescriptor* desc, |
| 6800 ShouldThrow should_throw) { | 6817 ShouldThrow should_throw) { |
| 6818 STACK_CHECK(Nothing<bool>()); |
| 6801 Handle<String> trap_name = isolate->factory()->defineProperty_string(); | 6819 Handle<String> trap_name = isolate->factory()->defineProperty_string(); |
| 6802 // 1. Assert: IsPropertyKey(P) is true. | 6820 // 1. Assert: IsPropertyKey(P) is true. |
| 6803 DCHECK(key->IsName() || key->IsNumber()); | 6821 DCHECK(key->IsName() || key->IsNumber()); |
| 6804 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. | 6822 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
| 6805 Handle<Object> handler(proxy->handler(), isolate); | 6823 Handle<Object> handler(proxy->handler(), isolate); |
| 6806 // 3. If handler is null, throw a TypeError exception. | 6824 // 3. If handler is null, throw a TypeError exception. |
| 6807 // 4. Assert: Type(handler) is Object. | 6825 // 4. Assert: Type(handler) is Object. |
| 6808 if (proxy->IsRevoked()) { | 6826 if (proxy->IsRevoked()) { |
| 6809 isolate->Throw(*isolate->factory()->NewTypeError( | 6827 isolate->Throw(*isolate->factory()->NewTypeError( |
| 6810 MessageTemplate::kProxyRevoked, trap_name)); | 6828 MessageTemplate::kProxyRevoked, trap_name)); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6969 return Just(true); | 6987 return Just(true); |
| 6970 } | 6988 } |
| 6971 | 6989 |
| 6972 | 6990 |
| 6973 // ES6 9.5.5 | 6991 // ES6 9.5.5 |
| 6974 // static | 6992 // static |
| 6975 Maybe<bool> JSProxy::GetOwnPropertyDescriptor(Isolate* isolate, | 6993 Maybe<bool> JSProxy::GetOwnPropertyDescriptor(Isolate* isolate, |
| 6976 Handle<JSProxy> proxy, | 6994 Handle<JSProxy> proxy, |
| 6977 Handle<Name> name, | 6995 Handle<Name> name, |
| 6978 PropertyDescriptor* desc) { | 6996 PropertyDescriptor* desc) { |
| 6997 STACK_CHECK(Nothing<bool>()); |
| 6979 Handle<String> trap_name = | 6998 Handle<String> trap_name = |
| 6980 isolate->factory()->getOwnPropertyDescriptor_string(); | 6999 isolate->factory()->getOwnPropertyDescriptor_string(); |
| 6981 // 1. (Assert) | 7000 // 1. (Assert) |
| 6982 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. | 7001 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
| 6983 Handle<Object> handler(proxy->handler(), isolate); | 7002 Handle<Object> handler(proxy->handler(), isolate); |
| 6984 // 3. If handler is null, throw a TypeError exception. | 7003 // 3. If handler is null, throw a TypeError exception. |
| 6985 // 4. Assert: Type(handler) is Object. | 7004 // 4. Assert: Type(handler) is Object. |
| 6986 if (proxy->IsRevoked()) { | 7005 if (proxy->IsRevoked()) { |
| 6987 isolate->Throw(*isolate->factory()->NewTypeError( | 7006 isolate->Throw(*isolate->factory()->NewTypeError( |
| 6988 MessageTemplate::kProxyRevoked, trap_name)); | 7007 MessageTemplate::kProxyRevoked, trap_name)); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7324 } | 7343 } |
| 7325 DCHECK(object->IsJSObject()); | 7344 DCHECK(object->IsJSObject()); |
| 7326 return JSObject::PreventExtensions(Handle<JSObject>::cast(object), | 7345 return JSObject::PreventExtensions(Handle<JSObject>::cast(object), |
| 7327 should_throw); | 7346 should_throw); |
| 7328 } | 7347 } |
| 7329 | 7348 |
| 7330 | 7349 |
| 7331 Maybe<bool> JSProxy::PreventExtensions(Handle<JSProxy> proxy, | 7350 Maybe<bool> JSProxy::PreventExtensions(Handle<JSProxy> proxy, |
| 7332 ShouldThrow should_throw) { | 7351 ShouldThrow should_throw) { |
| 7333 Isolate* isolate = proxy->GetIsolate(); | 7352 Isolate* isolate = proxy->GetIsolate(); |
| 7353 STACK_CHECK(Nothing<bool>()); |
| 7334 Factory* factory = isolate->factory(); | 7354 Factory* factory = isolate->factory(); |
| 7335 Handle<String> trap_name = factory->preventExtensions_string(); | 7355 Handle<String> trap_name = factory->preventExtensions_string(); |
| 7336 | 7356 |
| 7337 if (proxy->IsRevoked()) { | 7357 if (proxy->IsRevoked()) { |
| 7338 isolate->Throw( | 7358 isolate->Throw( |
| 7339 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name)); | 7359 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name)); |
| 7340 return Nothing<bool>(); | 7360 return Nothing<bool>(); |
| 7341 } | 7361 } |
| 7342 Handle<JSReceiver> target(proxy->target(), isolate); | 7362 Handle<JSReceiver> target(proxy->target(), isolate); |
| 7343 Handle<JSReceiver> handler(JSReceiver::cast(proxy->handler()), isolate); | 7363 Handle<JSReceiver> handler(JSReceiver::cast(proxy->handler()), isolate); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7433 Maybe<bool> JSReceiver::IsExtensible(Handle<JSReceiver> object) { | 7453 Maybe<bool> JSReceiver::IsExtensible(Handle<JSReceiver> object) { |
| 7434 if (object->IsJSProxy()) { | 7454 if (object->IsJSProxy()) { |
| 7435 return JSProxy::IsExtensible(Handle<JSProxy>::cast(object)); | 7455 return JSProxy::IsExtensible(Handle<JSProxy>::cast(object)); |
| 7436 } | 7456 } |
| 7437 return Just(JSObject::IsExtensible(Handle<JSObject>::cast(object))); | 7457 return Just(JSObject::IsExtensible(Handle<JSObject>::cast(object))); |
| 7438 } | 7458 } |
| 7439 | 7459 |
| 7440 | 7460 |
| 7441 Maybe<bool> JSProxy::IsExtensible(Handle<JSProxy> proxy) { | 7461 Maybe<bool> JSProxy::IsExtensible(Handle<JSProxy> proxy) { |
| 7442 Isolate* isolate = proxy->GetIsolate(); | 7462 Isolate* isolate = proxy->GetIsolate(); |
| 7463 STACK_CHECK(Nothing<bool>()); |
| 7443 Factory* factory = isolate->factory(); | 7464 Factory* factory = isolate->factory(); |
| 7444 Handle<String> trap_name = factory->isExtensible_string(); | 7465 Handle<String> trap_name = factory->isExtensible_string(); |
| 7445 | 7466 |
| 7446 if (proxy->IsRevoked()) { | 7467 if (proxy->IsRevoked()) { |
| 7447 isolate->Throw( | 7468 isolate->Throw( |
| 7448 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name)); | 7469 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name)); |
| 7449 return Nothing<bool>(); | 7470 return Nothing<bool>(); |
| 7450 } | 7471 } |
| 7451 Handle<JSReceiver> target(proxy->target(), isolate); | 7472 Handle<JSReceiver> target(proxy->target(), isolate); |
| 7452 Handle<JSReceiver> handler(JSReceiver::cast(proxy->handler()), isolate); | 7473 Handle<JSReceiver> handler(JSReceiver::cast(proxy->handler()), isolate); |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8384 return Just(true); | 8405 return Just(true); |
| 8385 } | 8406 } |
| 8386 | 8407 |
| 8387 | 8408 |
| 8388 // ES6 9.5.11 | 8409 // ES6 9.5.11 |
| 8389 // Returns false in case of exception. | 8410 // Returns false in case of exception. |
| 8390 // static | 8411 // static |
| 8391 Maybe<bool> JSProxy::Enumerate(Isolate* isolate, Handle<JSReceiver> receiver, | 8412 Maybe<bool> JSProxy::Enumerate(Isolate* isolate, Handle<JSReceiver> receiver, |
| 8392 Handle<JSProxy> proxy, | 8413 Handle<JSProxy> proxy, |
| 8393 KeyAccumulator* accumulator) { | 8414 KeyAccumulator* accumulator) { |
| 8415 STACK_CHECK(Nothing<bool>()); |
| 8394 // 1. Let handler be the value of the [[ProxyHandler]] internal slot of O. | 8416 // 1. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
| 8395 Handle<Object> handler(proxy->handler(), isolate); | 8417 Handle<Object> handler(proxy->handler(), isolate); |
| 8396 // 2. If handler is null, throw a TypeError exception. | 8418 // 2. If handler is null, throw a TypeError exception. |
| 8397 // 3. Assert: Type(handler) is Object. | 8419 // 3. Assert: Type(handler) is Object. |
| 8398 if (proxy->IsRevoked()) { | 8420 if (proxy->IsRevoked()) { |
| 8399 isolate->Throw(*isolate->factory()->NewTypeError( | 8421 isolate->Throw(*isolate->factory()->NewTypeError( |
| 8400 MessageTemplate::kProxyRevoked, | 8422 MessageTemplate::kProxyRevoked, |
| 8401 isolate->factory()->enumerate_string())); | 8423 isolate->factory()->enumerate_string())); |
| 8402 return Nothing<bool>(); | 8424 return Nothing<bool>(); |
| 8403 } | 8425 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8491 | 8513 |
| 8492 | 8514 |
| 8493 // ES6 9.5.12 | 8515 // ES6 9.5.12 |
| 8494 // Returns |true| on success, |nothing| in case of exception. | 8516 // Returns |true| on success, |nothing| in case of exception. |
| 8495 // static | 8517 // static |
| 8496 Maybe<bool> JSProxy::OwnPropertyKeys(Isolate* isolate, | 8518 Maybe<bool> JSProxy::OwnPropertyKeys(Isolate* isolate, |
| 8497 Handle<JSReceiver> receiver, | 8519 Handle<JSReceiver> receiver, |
| 8498 Handle<JSProxy> proxy, | 8520 Handle<JSProxy> proxy, |
| 8499 PropertyFilter filter, | 8521 PropertyFilter filter, |
| 8500 KeyAccumulator* accumulator) { | 8522 KeyAccumulator* accumulator) { |
| 8523 STACK_CHECK(Nothing<bool>()); |
| 8501 // 1. Let handler be the value of the [[ProxyHandler]] internal slot of O. | 8524 // 1. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
| 8502 Handle<Object> handler(proxy->handler(), isolate); | 8525 Handle<Object> handler(proxy->handler(), isolate); |
| 8503 // 2. If handler is null, throw a TypeError exception. | 8526 // 2. If handler is null, throw a TypeError exception. |
| 8504 // 3. Assert: Type(handler) is Object. | 8527 // 3. Assert: Type(handler) is Object. |
| 8505 if (proxy->IsRevoked()) { | 8528 if (proxy->IsRevoked()) { |
| 8506 isolate->Throw(*isolate->factory()->NewTypeError( | 8529 isolate->Throw(*isolate->factory()->NewTypeError( |
| 8507 MessageTemplate::kProxyRevoked, isolate->factory()->ownKeys_string())); | 8530 MessageTemplate::kProxyRevoked, isolate->factory()->ownKeys_string())); |
| 8508 return Nothing<bool>(); | 8531 return Nothing<bool>(); |
| 8509 } | 8532 } |
| 8510 // 4. Let target be the value of the [[ProxyTarget]] internal slot of O. | 8533 // 4. Let target be the value of the [[ProxyTarget]] internal slot of O. |
| (...skipping 6616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15127 from_javascript, should_throw); | 15150 from_javascript, should_throw); |
| 15128 } | 15151 } |
| 15129 | 15152 |
| 15130 | 15153 |
| 15131 // ES6: 9.5.2 [[SetPrototypeOf]] (V) | 15154 // ES6: 9.5.2 [[SetPrototypeOf]] (V) |
| 15132 // static | 15155 // static |
| 15133 Maybe<bool> JSProxy::SetPrototype(Handle<JSProxy> proxy, Handle<Object> value, | 15156 Maybe<bool> JSProxy::SetPrototype(Handle<JSProxy> proxy, Handle<Object> value, |
| 15134 bool from_javascript, | 15157 bool from_javascript, |
| 15135 ShouldThrow should_throw) { | 15158 ShouldThrow should_throw) { |
| 15136 Isolate* isolate = proxy->GetIsolate(); | 15159 Isolate* isolate = proxy->GetIsolate(); |
| 15160 STACK_CHECK(Nothing<bool>()); |
| 15137 Handle<Name> trap_name = isolate->factory()->setPrototypeOf_string(); | 15161 Handle<Name> trap_name = isolate->factory()->setPrototypeOf_string(); |
| 15138 // 1. Assert: Either Type(V) is Object or Type(V) is Null. | 15162 // 1. Assert: Either Type(V) is Object or Type(V) is Null. |
| 15139 DCHECK(value->IsJSReceiver() || value->IsNull()); | 15163 DCHECK(value->IsJSReceiver() || value->IsNull()); |
| 15140 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. | 15164 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
| 15141 Handle<Object> handler(proxy->handler(), isolate); | 15165 Handle<Object> handler(proxy->handler(), isolate); |
| 15142 // 3. If handler is null, throw a TypeError exception. | 15166 // 3. If handler is null, throw a TypeError exception. |
| 15143 // 4. Assert: Type(handler) is Object. | 15167 // 4. Assert: Type(handler) is Object. |
| 15144 if (proxy->IsRevoked()) { | 15168 if (proxy->IsRevoked()) { |
| 15145 isolate->Throw(*isolate->factory()->NewTypeError( | 15169 isolate->Throw(*isolate->factory()->NewTypeError( |
| 15146 MessageTemplate::kProxyRevoked, trap_name)); | 15170 MessageTemplate::kProxyRevoked, trap_name)); |
| (...skipping 4165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19312 if (cell->value() != *new_value) { | 19336 if (cell->value() != *new_value) { |
| 19313 cell->set_value(*new_value); | 19337 cell->set_value(*new_value); |
| 19314 Isolate* isolate = cell->GetIsolate(); | 19338 Isolate* isolate = cell->GetIsolate(); |
| 19315 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19339 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19316 isolate, DependentCode::kPropertyCellChangedGroup); | 19340 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19317 } | 19341 } |
| 19318 } | 19342 } |
| 19319 | 19343 |
| 19320 } // namespace internal | 19344 } // namespace internal |
| 19321 } // namespace v8 | 19345 } // namespace v8 |
| OLD | NEW |