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

Side by Side Diff: src/mips64/builtins-mips64.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, 2 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/mips/builtins-mips.cc ('k') | src/objects.h » ('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 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 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 // Tail call to the function-specific construct stub (still in the caller 1648 // Tail call to the function-specific construct stub (still in the caller
1649 // context at this point). 1649 // context at this point).
1650 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1650 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1651 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); 1651 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset));
1652 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag)); 1652 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag));
1653 __ Jump(at); 1653 __ Jump(at);
1654 } 1654 }
1655 1655
1656 1656
1657 // static 1657 // static
1658 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
1659 // ----------- S t a t e -------------
1660 // -- a0 : the number of arguments (not including the receiver)
1661 // -- a1 : the constructor to call (checked to be a JSFunctionProxy)
1662 // -- a3 : the original constructor (either the same as the constructor or
1663 // the JSFunction on which new was invoked initially)
1664 // -----------------------------------
1665
1666 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
1667 __ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset));
1668 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1669 }
1670
1671
1672 // static
1673 void Builtins::Generate_Construct(MacroAssembler* masm) { 1658 void Builtins::Generate_Construct(MacroAssembler* masm) {
1674 // ----------- S t a t e ------------- 1659 // ----------- S t a t e -------------
1675 // -- a0 : the number of arguments (not including the receiver) 1660 // -- a0 : the number of arguments (not including the receiver)
1676 // -- a1 : the constructor to call (can be any Object) 1661 // -- a1 : the constructor to call (can be any Object)
1677 // -- a3 : the original constructor (either the same as the constructor or 1662 // -- a3 : the original constructor (either the same as the constructor or
1678 // the JSFunction on which new was invoked initially) 1663 // the JSFunction on which new was invoked initially)
1679 // ----------------------------------- 1664 // -----------------------------------
1680 1665
1681 // Check if target has a [[Construct]] internal method. 1666 Label non_callable, non_function;
1682 Label non_constructor; 1667 __ JumpIfSmi(a1, &non_callable);
1683 __ JumpIfSmi(a1, &non_constructor); 1668 __ GetObjectType(a1, t1, t2);
1684 __ ld(t1, FieldMemOperand(t1, HeapObject::kMapOffset));
1685 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset));
1686 __ And(t2, t2, Operand(1 << Map::kIsCallable));
1687 __ Branch(&non_constructor, eq, t2, Operand(zero_reg));
1688
1689 // Dispatch based on instance type.
1690 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset));
1691 __ Jump(masm->isolate()->builtins()->ConstructFunction(), 1669 __ Jump(masm->isolate()->builtins()->ConstructFunction(),
1692 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); 1670 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE));
1693 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, 1671 __ Branch(&non_function, ne, t2, Operand(JS_FUNCTION_PROXY_TYPE));
1694 eq, t2, Operand(JS_FUNCTION_PROXY_TYPE));
1695 1672
1696 // Called Construct on an exotic Object with a [[Construct]] internal method. 1673 // 1. Construct of function proxy.
1697 { 1674 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
1698 // Overwrite the original receiver with the (original) target. 1675 __ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset));
1699 __ dsll(at, a0, kPointerSizeLog2); 1676 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1700 __ daddu(at, sp, at);
1701 __ sd(a1, MemOperand(at));
1702 // Let the "call_as_constructor_delegate" take care of the rest.
1703 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1);
1704 __ Jump(masm->isolate()->builtins()->CallFunction(),
1705 RelocInfo::CODE_TARGET);
1706 }
1707 1677
1708 // Called Construct on an Object that doesn't have a [[Construct]] internal 1678 // 2. Construct of something that else, which might have a [[Construct]]
1709 // method. 1679 // internal method (if not we raise an exception).
1710 __ bind(&non_constructor); 1680 __ bind(&non_function);
1681 // Check if target has a [[Call]] internal method.
1682 // TODO(bmeurer): This shoud use IsConstructor once available.
1683 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset));
1684 __ And(t1, t1, Operand(1 << Map::kIsCallable));
1685 __ Branch(&non_callable, eq, t1, Operand(zero_reg));
1686 // Overwrite the original receiver with the (original) target.
1687 __ dsll(at, a0, kPointerSizeLog2);
1688 __ daddu(at, sp, at);
1689 __ sd(a1, MemOperand(at));
1690 // Let the "call_as_constructor_delegate" take care of the rest.
1691 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1);
1692 __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET);
1693
1694 // 3. Construct of something that is not callable.
1695 __ bind(&non_callable);
1711 { 1696 {
1712 FrameScope scope(masm, StackFrame::INTERNAL); 1697 FrameScope scope(masm, StackFrame::INTERNAL);
1713 __ Push(a1); 1698 __ Push(a1);
1714 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); 1699 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1);
1715 } 1700 }
1716 } 1701 }
1717 1702
1718 1703
1719 // static 1704 // static
1720 void Builtins::Generate_PushArgsAndCall(MacroAssembler* masm) { 1705 void Builtins::Generate_PushArgsAndCall(MacroAssembler* masm) {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 } 1882 }
1898 } 1883 }
1899 1884
1900 1885
1901 #undef __ 1886 #undef __
1902 1887
1903 } // namespace internal 1888 } // namespace internal
1904 } // namespace v8 1889 } // namespace v8
1905 1890
1906 #endif // V8_TARGET_ARCH_MIPS64 1891 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698