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

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

Issue 1509603005: [runtime] [proxy] implement [[Construct]] (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-12-03_JSProxy_Call_1499593003
Patch Set: fimpsing 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') | src/ppc/builtins-ppc.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 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 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 1745
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 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. 1755 // Call into the Runtime for Proxy [[Construct]].
1756 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 1756 __ Push(a1);
1757 __ Push(a3);
1758 // Include the pushed new_target, constructor and the receiver.
1759 __ Daddu(a0, a0, 3);
1760 // Tail-call to the runtime.
1761 __ JumpToExternalReference(
1762 ExternalReference(Runtime::kJSProxyConstruct, masm->isolate()));
1757 } 1763 }
1758 1764
1759 1765
1760 // static 1766 // static
1761 void Builtins::Generate_Construct(MacroAssembler* masm) { 1767 void Builtins::Generate_Construct(MacroAssembler* masm) {
1762 // ----------- S t a t e ------------- 1768 // ----------- S t a t e -------------
1763 // -- a0 : the number of arguments (not including the receiver) 1769 // -- a0 : the number of arguments (not including the receiver)
1764 // -- a1 : the constructor to call (can be any Object) 1770 // -- a1 : the constructor to call (can be any Object)
1765 // -- a3 : the new target (either the same as the constructor or 1771 // -- a3 : the new target (either the same as the constructor or
1766 // the JSFunction on which new was invoked initially) 1772 // the JSFunction on which new was invoked initially)
1767 // ----------------------------------- 1773 // -----------------------------------
1768 1774
1769 // Check if target is a Smi. 1775 // Check if target is a Smi.
1770 Label non_constructor; 1776 Label non_constructor;
1771 __ JumpIfSmi(a1, &non_constructor); 1777 __ JumpIfSmi(a1, &non_constructor);
1772 1778
1773 // Dispatch based on instance type. 1779 // Dispatch based on instance type.
1774 __ ld(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); 1780 __ ld(t1, FieldMemOperand(a1, HeapObject::kMapOffset));
1775 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); 1781 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset));
1776 __ Jump(masm->isolate()->builtins()->ConstructFunction(), 1782 __ Jump(masm->isolate()->builtins()->ConstructFunction(),
1777 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); 1783 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE));
1778 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
1779 eq, t2, Operand(JS_PROXY_TYPE));
1780 1784
1781 // Check if target has a [[Construct]] internal method. 1785 // Check if target has a [[Construct]] internal method.
1782 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); 1786 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset));
1783 __ And(t2, t2, Operand(1 << Map::kIsCallable)); 1787 __ And(t2, t2, Operand(1 << Map::kIsCallable));
1784 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); 1788 __ Branch(&non_constructor, eq, t2, Operand(zero_reg));
1785 1789
1790 // Only dispatch to proxies after checking whether they are constructors.
1791 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
1792 eq, t2, Operand(JS_PROXY_TYPE));
1793
1786 // Called Construct on an exotic Object with a [[Construct]] internal method. 1794 // Called Construct on an exotic Object with a [[Construct]] internal method.
1787 { 1795 {
1788 // Overwrite the original receiver with the (original) target. 1796 // Overwrite the original receiver with the (original) target.
1789 __ dsll(at, a0, kPointerSizeLog2); 1797 __ dsll(at, a0, kPointerSizeLog2);
1790 __ daddu(at, sp, at); 1798 __ daddu(at, sp, at);
1791 __ sd(a1, MemOperand(at)); 1799 __ sd(a1, MemOperand(at));
1792 // Let the "call_as_constructor_delegate" take care of the rest. 1800 // Let the "call_as_constructor_delegate" take care of the rest.
1793 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); 1801 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1);
1794 __ Jump(masm->isolate()->builtins()->CallFunction(), 1802 __ Jump(masm->isolate()->builtins()->CallFunction(),
1795 RelocInfo::CODE_TARGET); 1803 RelocInfo::CODE_TARGET);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 } 1965 }
1958 } 1966 }
1959 1967
1960 1968
1961 #undef __ 1969 #undef __
1962 1970
1963 } // namespace internal 1971 } // namespace internal
1964 } // namespace v8 1972 } // namespace v8
1965 1973
1966 #endif // V8_TARGET_ARCH_MIPS64 1974 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/ppc/builtins-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698