Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: src/arm64/builtins-arm64.cc

Issue 1360403002: Revert of [es6] Introduce spec compliant IsConstructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if V8_TARGET_ARCH_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 // Tail call to the function-specific construct stub (still in the caller 1701 // Tail call to the function-specific construct stub (still in the caller
1702 // context at this point). 1702 // context at this point).
1703 __ Ldr(x4, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); 1703 __ Ldr(x4, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
1704 __ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset)); 1704 __ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset));
1705 __ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag); 1705 __ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag);
1706 __ Br(x4); 1706 __ Br(x4);
1707 } 1707 }
1708 1708
1709 1709
1710 // static 1710 // static
1711 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
1712 // ----------- S t a t e -------------
1713 // -- x0 : the number of arguments (not including the receiver)
1714 // -- x1 : the constructor to call (checked to be a JSFunctionProxy)
1715 // -- x3 : the original constructor (either the same as the constructor or
1716 // the JSFunction on which new was invoked initially)
1717 // -----------------------------------
1718
1719 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
1720 __ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kConstructTrapOffset));
1721 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1722 }
1723
1724
1725 // static
1726 void Builtins::Generate_Construct(MacroAssembler* masm) { 1711 void Builtins::Generate_Construct(MacroAssembler* masm) {
1727 // ----------- S t a t e ------------- 1712 // ----------- S t a t e -------------
1728 // -- x0 : the number of arguments (not including the receiver) 1713 // -- x0 : the number of arguments (not including the receiver)
1729 // -- x1 : the constructor to call (can be any Object) 1714 // -- x1 : the constructor to call (can be any Object)
1730 // -- x3 : the original constructor (either the same as the constructor or 1715 // -- x3 : the original constructor (either the same as the constructor or
1731 // the JSFunction on which new was invoked initially) 1716 // the JSFunction on which new was invoked initially)
1732 // ----------------------------------- 1717 // -----------------------------------
1733 1718
1734 // Check if target has a [[Construct]] internal method. 1719 Label non_callable, non_function;
1735 Label non_constructor; 1720 __ JumpIfSmi(x1, &non_callable);
1736 __ JumpIfSmi(x1, &non_constructor); 1721 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE);
1737 __ Ldr(x4, FieldMemOperand(x1, HeapObject::kMapOffset));
1738 __ Ldrb(x2, FieldMemOperand(x4, Map::kBitFieldOffset));
1739 __ TestAndBranchIfAllClear(x2, 1 << Map::kIsConstructor, &non_constructor);
1740
1741 // Dispatch based on instance type.
1742 __ CompareInstanceType(x4, x5, JS_FUNCTION_TYPE);
1743 __ Jump(masm->isolate()->builtins()->ConstructFunction(), 1722 __ Jump(masm->isolate()->builtins()->ConstructFunction(),
1744 RelocInfo::CODE_TARGET, eq); 1723 RelocInfo::CODE_TARGET, eq);
1745 __ Cmp(x5, JS_FUNCTION_PROXY_TYPE); 1724 __ Cmp(x5, JS_FUNCTION_PROXY_TYPE);
1746 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, 1725 __ B(ne, &non_function);
1747 eq);
1748 1726
1749 // Called Construct on an exotic Object with a [[Construct]] internal method. 1727 // 1. Construct of function proxy.
1750 { 1728 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
1751 // Overwrite the original receiver with the (original) target. 1729 __ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kConstructTrapOffset));
1752 __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2)); 1730 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1753 // Let the "call_as_constructor_delegate" take care of the rest.
1754 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, x1);
1755 __ Jump(masm->isolate()->builtins()->CallFunction(),
1756 RelocInfo::CODE_TARGET);
1757 }
1758 1731
1759 // Called Construct on an Object that doesn't have a [[Construct]] internal 1732 // 2. Construct of something that else, which might have a [[Construct]]
1760 // method. 1733 // internal method (if not we raise an exception).
1761 __ bind(&non_constructor); 1734 __ Bind(&non_function);
1735 // Check if target has a [[Call]] internal method.
1736 // TODO(bmeurer): This shoud use IsConstructor once available.
1737 __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset));
1738 __ TestAndBranchIfAllClear(x4, 1 << Map::kIsCallable, &non_callable);
1739 // Overwrite the original receiver with the (original) target.
1740 __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2));
1741 // Let the "call_as_constructor_delegate" take care of the rest.
1742 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, x1);
1743 __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET);
1744
1745 // 3. Construct of something that is not callable.
1746 __ bind(&non_callable);
1762 { 1747 {
1763 FrameScope scope(masm, StackFrame::INTERNAL); 1748 FrameScope scope(masm, StackFrame::INTERNAL);
1764 __ Push(x1); 1749 __ Push(x1);
1765 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); 1750 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1);
1766 } 1751 }
1767 } 1752 }
1768 1753
1769 1754
1770 // static 1755 // static
1771 void Builtins::Generate_PushArgsAndCall(MacroAssembler* masm) { 1756 void Builtins::Generate_PushArgsAndCall(MacroAssembler* masm) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 } 1952 }
1968 } 1953 }
1969 1954
1970 1955
1971 #undef __ 1956 #undef __
1972 1957
1973 } // namespace internal 1958 } // namespace internal
1974 } // namespace v8 1959 } // namespace v8
1975 1960
1976 #endif // V8_TARGET_ARCH_ARM 1961 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698