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

Side by Side Diff: src/mips/builtins-mips.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/messages.h ('k') | src/mips64/builtins-mips64.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 1754
1755 // static 1755 // static
1756 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { 1756 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
1757 // ----------- S t a t e ------------- 1757 // ----------- S t a t e -------------
1758 // -- a0 : the number of arguments (not including the receiver) 1758 // -- a0 : the number of arguments (not including the receiver)
1759 // -- a1 : the constructor to call (checked to be a JSProxy) 1759 // -- a1 : the constructor to call (checked to be a JSProxy)
1760 // -- a3 : the new target (either the same as the constructor or 1760 // -- a3 : the new target (either the same as the constructor or
1761 // the JSFunction on which new was invoked initially) 1761 // the JSFunction on which new was invoked initially)
1762 // ----------------------------------- 1762 // -----------------------------------
1763 1763
1764 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. 1764 // Call into the Runtime for Proxy [[Construct]].
1765 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 1765 __ Push(a1);
1766 __ Push(a3);
1767 // Include the pushed new_target, constructor and the receiver.
1768 __ Addu(a0, a0, 3);
1769 // Tail-call to the runtime.
1770 __ JumpToExternalReference(
1771 ExternalReference(Runtime::kJSProxyConstruct, masm->isolate()));
1766 } 1772 }
1767 1773
1768 1774
1769 // static 1775 // static
1770 void Builtins::Generate_Construct(MacroAssembler* masm) { 1776 void Builtins::Generate_Construct(MacroAssembler* masm) {
1771 // ----------- S t a t e ------------- 1777 // ----------- S t a t e -------------
1772 // -- a0 : the number of arguments (not including the receiver) 1778 // -- a0 : the number of arguments (not including the receiver)
1773 // -- a1 : the constructor to call (can be any Object) 1779 // -- a1 : the constructor to call (can be any Object)
1774 // -- a3 : the new target (either the same as the constructor or 1780 // -- a3 : the new target (either the same as the constructor or
1775 // the JSFunction on which new was invoked initially) 1781 // the JSFunction on which new was invoked initially)
1776 // ----------------------------------- 1782 // -----------------------------------
1777 1783
1778 // Check if target is a Smi. 1784 // Check if target is a Smi.
1779 Label non_constructor; 1785 Label non_constructor;
1780 __ JumpIfSmi(a1, &non_constructor); 1786 __ JumpIfSmi(a1, &non_constructor);
1781 1787
1782 // Dispatch based on instance type. 1788 // Dispatch based on instance type.
1783 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); 1789 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset));
1784 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); 1790 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset));
1785 __ Jump(masm->isolate()->builtins()->ConstructFunction(), 1791 __ Jump(masm->isolate()->builtins()->ConstructFunction(),
1786 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); 1792 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE));
1787 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
1788 eq, t2, Operand(JS_PROXY_TYPE));
1789 1793
1790 // Check if target has a [[Construct]] internal method. 1794 // Check if target has a [[Construct]] internal method.
1791 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); 1795 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset));
1792 __ And(t2, t2, Operand(1 << Map::kIsCallable)); 1796 __ And(t2, t2, Operand(1 << Map::kIsCallable));
1793 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); 1797 __ Branch(&non_constructor, eq, t2, Operand(zero_reg));
1794 1798
1799 // Only dispatch to proxies after checking whether they are constructors.
1800 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
1801 eq, t2, Operand(JS_PROXY_TYPE));
1802
1795 // Called Construct on an exotic Object with a [[Construct]] internal method. 1803 // Called Construct on an exotic Object with a [[Construct]] internal method.
1796 { 1804 {
1797 // Overwrite the original receiver with the (original) target. 1805 // Overwrite the original receiver with the (original) target.
1798 __ sll(at, a0, kPointerSizeLog2); 1806 __ sll(at, a0, kPointerSizeLog2);
1799 __ addu(at, sp, at); 1807 __ addu(at, sp, at);
1800 __ sw(a1, MemOperand(at)); 1808 __ sw(a1, MemOperand(at));
1801 // Let the "call_as_constructor_delegate" take care of the rest. 1809 // Let the "call_as_constructor_delegate" take care of the rest.
1802 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); 1810 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1);
1803 __ Jump(masm->isolate()->builtins()->CallFunction(), 1811 __ Jump(masm->isolate()->builtins()->CallFunction(),
1804 RelocInfo::CODE_TARGET); 1812 RelocInfo::CODE_TARGET);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 } 1974 }
1967 } 1975 }
1968 1976
1969 1977
1970 #undef __ 1978 #undef __
1971 1979
1972 } // namespace internal 1980 } // namespace internal
1973 } // namespace v8 1981 } // namespace v8
1974 1982
1975 #endif // V8_TARGET_ARCH_MIPS 1983 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/messages.h ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698