OLD | NEW |
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 __ Daddu(a0, a0, num_extra_args + 1); | 64 __ Daddu(a0, a0, num_extra_args + 1); |
65 __ bind(&done_argc); | 65 __ bind(&done_argc); |
66 | 66 |
67 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 67 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 // Load the built-in InternalArray function from the current context. | 71 // Load the built-in InternalArray function from the current context. |
72 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, | 72 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, |
73 Register result) { | 73 Register result) { |
74 // Load the native context. | |
75 | |
76 __ ld(result, | |
77 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
78 __ ld(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset)); | |
79 // Load the InternalArray function from the native context. | 74 // Load the InternalArray function from the native context. |
80 __ ld(result, | 75 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result); |
81 MemOperand(result, | |
82 Context::SlotOffset( | |
83 Context::INTERNAL_ARRAY_FUNCTION_INDEX))); | |
84 } | 76 } |
85 | 77 |
86 | 78 |
87 // Load the built-in Array function from the current context. | 79 // Load the built-in Array function from the current context. |
88 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { | 80 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { |
89 // Load the native context. | |
90 | |
91 __ ld(result, | |
92 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
93 __ ld(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset)); | |
94 // Load the Array function from the native context. | 81 // Load the Array function from the native context. |
95 __ ld(result, | 82 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, result); |
96 MemOperand(result, | |
97 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); | |
98 } | 83 } |
99 | 84 |
100 | 85 |
101 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { | 86 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { |
102 // ----------- S t a t e ------------- | 87 // ----------- S t a t e ------------- |
103 // -- a0 : number of arguments | 88 // -- a0 : number of arguments |
104 // -- ra : return address | 89 // -- ra : return address |
105 // -- sp[...]: constructor arguments | 90 // -- sp[...]: constructor arguments |
106 // ----------------------------------- | 91 // ----------------------------------- |
107 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; | 92 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; |
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 __ bind(&non_function); | 1721 __ bind(&non_function); |
1737 // Check if target has a [[Call]] internal method. | 1722 // Check if target has a [[Call]] internal method. |
1738 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); | 1723 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); |
1739 __ And(t1, t1, Operand(1 << Map::kIsCallable)); | 1724 __ And(t1, t1, Operand(1 << Map::kIsCallable)); |
1740 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); | 1725 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); |
1741 // Overwrite the original receiver with the (original) target. | 1726 // Overwrite the original receiver with the (original) target. |
1742 __ dsll(at, a0, kPointerSizeLog2); | 1727 __ dsll(at, a0, kPointerSizeLog2); |
1743 __ daddu(at, sp, at); | 1728 __ daddu(at, sp, at); |
1744 __ sd(a1, MemOperand(at)); | 1729 __ sd(a1, MemOperand(at)); |
1745 // Let the "call_as_function_delegate" take care of the rest. | 1730 // Let the "call_as_function_delegate" take care of the rest. |
1746 __ LoadGlobalFunction(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1); | 1731 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1); |
1747 __ Jump(masm->isolate()->builtins()->CallFunction( | 1732 __ Jump(masm->isolate()->builtins()->CallFunction( |
1748 ConvertReceiverMode::kNotNullOrUndefined), | 1733 ConvertReceiverMode::kNotNullOrUndefined), |
1749 RelocInfo::CODE_TARGET); | 1734 RelocInfo::CODE_TARGET); |
1750 | 1735 |
1751 // 3. Call to something that is not callable. | 1736 // 3. Call to something that is not callable. |
1752 __ bind(&non_callable); | 1737 __ bind(&non_callable); |
1753 { | 1738 { |
1754 FrameScope scope(masm, StackFrame::INTERNAL); | 1739 FrameScope scope(masm, StackFrame::INTERNAL); |
1755 __ Push(a1); | 1740 __ Push(a1); |
1756 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | 1741 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 __ And(t2, t2, Operand(1 << Map::kIsCallable)); | 1805 __ And(t2, t2, Operand(1 << Map::kIsCallable)); |
1821 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); | 1806 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); |
1822 | 1807 |
1823 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1808 // Called Construct on an exotic Object with a [[Construct]] internal method. |
1824 { | 1809 { |
1825 // Overwrite the original receiver with the (original) target. | 1810 // Overwrite the original receiver with the (original) target. |
1826 __ dsll(at, a0, kPointerSizeLog2); | 1811 __ dsll(at, a0, kPointerSizeLog2); |
1827 __ daddu(at, sp, at); | 1812 __ daddu(at, sp, at); |
1828 __ sd(a1, MemOperand(at)); | 1813 __ sd(a1, MemOperand(at)); |
1829 // Let the "call_as_constructor_delegate" take care of the rest. | 1814 // Let the "call_as_constructor_delegate" take care of the rest. |
1830 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); | 1815 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); |
1831 __ Jump(masm->isolate()->builtins()->CallFunction(), | 1816 __ Jump(masm->isolate()->builtins()->CallFunction(), |
1832 RelocInfo::CODE_TARGET); | 1817 RelocInfo::CODE_TARGET); |
1833 } | 1818 } |
1834 | 1819 |
1835 // Called Construct on an Object that doesn't have a [[Construct]] internal | 1820 // Called Construct on an Object that doesn't have a [[Construct]] internal |
1836 // method. | 1821 // method. |
1837 __ bind(&non_constructor); | 1822 __ bind(&non_constructor); |
1838 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), | 1823 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), |
1839 RelocInfo::CODE_TARGET); | 1824 RelocInfo::CODE_TARGET); |
1840 } | 1825 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 } | 1979 } |
1995 } | 1980 } |
1996 | 1981 |
1997 | 1982 |
1998 #undef __ | 1983 #undef __ |
1999 | 1984 |
2000 } // namespace internal | 1985 } // namespace internal |
2001 } // namespace v8 | 1986 } // namespace v8 |
2002 | 1987 |
2003 #endif // V8_TARGET_ARCH_MIPS64 | 1988 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |