Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/builtins.h" | 5 #include "src/builtins.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1738 HandleScope scope(isolate); | 1738 HandleScope scope(isolate); |
| 1739 // The ConstructStub is executed in the context of the caller, so we need | 1739 // The ConstructStub is executed in the context of the caller, so we need |
| 1740 // to enter the callee context first before raising an exception. | 1740 // to enter the callee context first before raising an exception. |
| 1741 isolate->set_context(args.target()->context()); | 1741 isolate->set_context(args.target()->context()); |
| 1742 THROW_NEW_ERROR_RETURN_FAILURE( | 1742 THROW_NEW_ERROR_RETURN_FAILURE( |
| 1743 isolate, NewTypeError(MessageTemplate::kNotConstructor, | 1743 isolate, NewTypeError(MessageTemplate::kNotConstructor, |
| 1744 isolate->factory()->Symbol_string())); | 1744 isolate->factory()->Symbol_string())); |
| 1745 } | 1745 } |
| 1746 | 1746 |
| 1747 | 1747 |
| 1748 // ES6 section 26.2.1.1 Proxy ( target, handler ) for the [[Call]] case. | |
| 1749 BUILTIN(ProxyConstructor) { | |
| 1750 HandleScope scope(isolate); | |
| 1751 THROW_NEW_ERROR_RETURN_FAILURE( | |
| 1752 isolate, | |
| 1753 NewTypeError(MessageTemplate::kConstructorNotFunction, | |
| 1754 isolate->factory()->NewStringFromAsciiChecked("Proxy"))); | |
| 1755 } | |
| 1756 | |
| 1757 | |
| 1758 // ES6 section 26.2.1.1 Proxy ( target, handler ) for the [[Construct]] case. | |
|
Camillo Bruni
2015/12/02 12:02:56
Could you add section "9.5.15 ProxyCreate(target,
Benedikt Meurer
2015/12/02 12:07:20
Moved to dedicated ProxyCreate function.
| |
| 1759 BUILTIN(ProxyConstructor_ConstructStub) { | |
| 1760 HandleScope scope(isolate); | |
| 1761 DCHECK_EQ(3, args.length()); | |
| 1762 Handle<Object> target = args.at<Object>(1); | |
| 1763 Handle<Object> handler = args.at<Object>(2); | |
| 1764 // The ConstructStub is executed in the context of the caller, so we need | |
| 1765 // to enter the callee context first before raising an exception. | |
| 1766 isolate->set_context(args.target()->context()); | |
| 1767 if (!target->IsJSReceiver()) { | |
| 1768 THROW_NEW_ERROR_RETURN_FAILURE( | |
| 1769 isolate, NewTypeError(MessageTemplate::kProxyTargetNonObject)); | |
| 1770 } | |
| 1771 if (target->IsJSProxy() && JSProxy::cast(*target)->IsRevoked()) { | |
| 1772 THROW_NEW_ERROR_RETURN_FAILURE( | |
| 1773 isolate, NewTypeError(MessageTemplate::kProxyHandlerOrTargetRevoked)); | |
| 1774 } | |
| 1775 if (!handler->IsJSReceiver()) { | |
| 1776 THROW_NEW_ERROR_RETURN_FAILURE( | |
| 1777 isolate, NewTypeError(MessageTemplate::kProxyHandlerNonObject)); | |
| 1778 } | |
| 1779 if (handler->IsJSProxy() && JSProxy::cast(*handler)->IsRevoked()) { | |
| 1780 THROW_NEW_ERROR_RETURN_FAILURE( | |
| 1781 isolate, NewTypeError(MessageTemplate::kProxyHandlerOrTargetRevoked)); | |
| 1782 } | |
| 1783 return *isolate->factory()->NewJSProxy(Handle<JSReceiver>::cast(target), | |
| 1784 Handle<JSReceiver>::cast(handler)); | |
| 1785 } | |
| 1786 | |
| 1787 | |
| 1748 // ----------------------------------------------------------------------------- | 1788 // ----------------------------------------------------------------------------- |
| 1749 // Throwers for restricted function properties and strict arguments object | 1789 // Throwers for restricted function properties and strict arguments object |
| 1750 // properties | 1790 // properties |
| 1751 | 1791 |
| 1752 | 1792 |
| 1753 BUILTIN(RestrictedFunctionPropertiesThrower) { | 1793 BUILTIN(RestrictedFunctionPropertiesThrower) { |
| 1754 HandleScope scope(isolate); | 1794 HandleScope scope(isolate); |
| 1755 THROW_NEW_ERROR_RETURN_FAILURE( | 1795 THROW_NEW_ERROR_RETURN_FAILURE( |
| 1756 isolate, NewTypeError(MessageTemplate::kRestrictedFunctionProperties)); | 1796 isolate, NewTypeError(MessageTemplate::kRestrictedFunctionProperties)); |
| 1757 } | 1797 } |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2375 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 2415 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 2376 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 2416 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 2377 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 2417 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 2378 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 2418 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 2379 #undef DEFINE_BUILTIN_ACCESSOR_C | 2419 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 2380 #undef DEFINE_BUILTIN_ACCESSOR_A | 2420 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 2381 | 2421 |
| 2382 | 2422 |
| 2383 } // namespace internal | 2423 } // namespace internal |
| 2384 } // namespace v8 | 2424 } // namespace v8 |
| OLD | NEW |