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

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

Issue 1510493011: MIPS: Fix [runtime] [proxy] implement [[Construct]]. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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') | no next file » | 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 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 // static 1746 // static
1747 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { 1747 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
1748 // ----------- S t a t e ------------- 1748 // ----------- S t a t e -------------
1749 // -- a0 : the number of arguments (not including the receiver) 1749 // -- a0 : the number of arguments (not including the receiver)
1750 // -- a1 : the constructor to call (checked to be a JSProxy) 1750 // -- a1 : the constructor to call (checked to be a JSProxy)
1751 // -- a3 : the new target (either the same as the constructor or 1751 // -- a3 : the new target (either the same as the constructor or
1752 // the JSFunction on which new was invoked initially) 1752 // the JSFunction on which new was invoked initially)
1753 // ----------------------------------- 1753 // -----------------------------------
1754 1754
1755 // Call into the Runtime for Proxy [[Construct]]. 1755 // Call into the Runtime for Proxy [[Construct]].
1756 __ Push(a1); 1756 __ Push(a1, a3);
1757 __ Push(a3);
1758 // Include the pushed new_target, constructor and the receiver. 1757 // Include the pushed new_target, constructor and the receiver.
1759 __ Daddu(a0, a0, Operand(3)); 1758 __ Daddu(a0, a0, Operand(3));
1760 // Tail-call to the runtime. 1759 // Tail-call to the runtime.
1761 __ JumpToExternalReference( 1760 __ JumpToExternalReference(
1762 ExternalReference(Runtime::kJSProxyConstruct, masm->isolate())); 1761 ExternalReference(Runtime::kJSProxyConstruct, masm->isolate()));
1763 } 1762 }
1764 1763
1765 1764
1766 // static 1765 // static
1767 void Builtins::Generate_Construct(MacroAssembler* masm) { 1766 void Builtins::Generate_Construct(MacroAssembler* masm) {
1768 // ----------- S t a t e ------------- 1767 // ----------- S t a t e -------------
1769 // -- a0 : the number of arguments (not including the receiver) 1768 // -- a0 : the number of arguments (not including the receiver)
1770 // -- a1 : the constructor to call (can be any Object) 1769 // -- a1 : the constructor to call (can be any Object)
1771 // -- a3 : the new target (either the same as the constructor or 1770 // -- a3 : the new target (either the same as the constructor or
1772 // the JSFunction on which new was invoked initially) 1771 // the JSFunction on which new was invoked initially)
1773 // ----------------------------------- 1772 // -----------------------------------
1774 1773
1775 // Check if target is a Smi. 1774 // Check if target is a Smi.
1776 Label non_constructor; 1775 Label non_constructor;
1777 __ JumpIfSmi(a1, &non_constructor); 1776 __ JumpIfSmi(a1, &non_constructor);
1778 1777
1779 // Dispatch based on instance type. 1778 // Dispatch based on instance type.
1780 __ ld(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); 1779 __ ld(t1, FieldMemOperand(a1, HeapObject::kMapOffset));
1781 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); 1780 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset));
1782 __ Jump(masm->isolate()->builtins()->ConstructFunction(), 1781 __ Jump(masm->isolate()->builtins()->ConstructFunction(),
1783 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); 1782 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE));
1784 1783
1785 // Check if target has a [[Construct]] internal method. 1784 // Check if target has a [[Construct]] internal method.
1786 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); 1785 __ lbu(t3, FieldMemOperand(t1, Map::kBitFieldOffset));
1787 __ And(t2, t2, Operand(1 << Map::kIsCallable)); 1786 __ And(t3, t3, Operand(1 << Map::kIsCallable));
1788 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); 1787 __ Branch(&non_constructor, eq, t3, Operand(zero_reg));
1789 1788
1790 // Only dispatch to proxies after checking whether they are constructors. 1789 // Only dispatch to proxies after checking whether they are constructors.
1791 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, 1790 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
1792 eq, t2, Operand(JS_PROXY_TYPE)); 1791 eq, t2, Operand(JS_PROXY_TYPE));
1793 1792
1794 // Called Construct on an exotic Object with a [[Construct]] internal method. 1793 // Called Construct on an exotic Object with a [[Construct]] internal method.
1795 { 1794 {
1796 // Overwrite the original receiver with the (original) target. 1795 // Overwrite the original receiver with the (original) target.
1797 __ dsll(at, a0, kPointerSizeLog2); 1796 __ dsll(at, a0, kPointerSizeLog2);
1798 __ daddu(at, sp, at); 1797 __ daddu(at, sp, at);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 } 1964 }
1966 } 1965 }
1967 1966
1968 1967
1969 #undef __ 1968 #undef __
1970 1969
1971 } // namespace internal 1970 } // namespace internal
1972 } // namespace v8 1971 } // namespace v8
1973 1972
1974 #endif // V8_TARGET_ARCH_MIPS64 1973 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698