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_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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 __ Addu(a0, a0, num_extra_args + 1); | 66 __ Addu(a0, a0, num_extra_args + 1); |
67 __ bind(&done_argc); | 67 __ bind(&done_argc); |
68 | 68 |
69 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 69 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
70 } | 70 } |
71 | 71 |
72 | 72 |
73 // Load the built-in InternalArray function from the current context. | 73 // Load the built-in InternalArray function from the current context. |
74 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, | 74 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, |
75 Register result) { | 75 Register result) { |
76 // Load the native context. | |
77 | |
78 __ lw(result, | |
79 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
80 __ lw(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset)); | |
81 // Load the InternalArray function from the native context. | 76 // Load the InternalArray function from the native context. |
82 __ lw(result, | 77 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result); |
83 MemOperand(result, | |
84 Context::SlotOffset( | |
85 Context::INTERNAL_ARRAY_FUNCTION_INDEX))); | |
86 } | 78 } |
87 | 79 |
88 | 80 |
89 // Load the built-in Array function from the current context. | 81 // Load the built-in Array function from the current context. |
90 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { | 82 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { |
91 // Load the native context. | |
92 | |
93 __ lw(result, | |
94 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
95 __ lw(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset)); | |
96 // Load the Array function from the native context. | 83 // Load the Array function from the native context. |
97 __ lw(result, | 84 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, result); |
98 MemOperand(result, | |
99 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); | |
100 } | 85 } |
101 | 86 |
102 | 87 |
103 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { | 88 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { |
104 // ----------- S t a t e ------------- | 89 // ----------- S t a t e ------------- |
105 // -- a0 : number of arguments | 90 // -- a0 : number of arguments |
106 // -- ra : return address | 91 // -- ra : return address |
107 // -- sp[...]: constructor arguments | 92 // -- sp[...]: constructor arguments |
108 // ----------------------------------- | 93 // ----------------------------------- |
109 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; | 94 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; |
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1742 __ bind(&non_function); | 1727 __ bind(&non_function); |
1743 // Check if target has a [[Call]] internal method. | 1728 // Check if target has a [[Call]] internal method. |
1744 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); | 1729 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); |
1745 __ And(t1, t1, Operand(1 << Map::kIsCallable)); | 1730 __ And(t1, t1, Operand(1 << Map::kIsCallable)); |
1746 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); | 1731 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); |
1747 // Overwrite the original receiver with the (original) target. | 1732 // Overwrite the original receiver with the (original) target. |
1748 __ sll(at, a0, kPointerSizeLog2); | 1733 __ sll(at, a0, kPointerSizeLog2); |
1749 __ addu(at, sp, at); | 1734 __ addu(at, sp, at); |
1750 __ sw(a1, MemOperand(at)); | 1735 __ sw(a1, MemOperand(at)); |
1751 // Let the "call_as_function_delegate" take care of the rest. | 1736 // Let the "call_as_function_delegate" take care of the rest. |
1752 __ LoadGlobalFunction(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1); | 1737 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1); |
1753 __ Jump(masm->isolate()->builtins()->CallFunction( | 1738 __ Jump(masm->isolate()->builtins()->CallFunction( |
1754 ConvertReceiverMode::kNotNullOrUndefined), | 1739 ConvertReceiverMode::kNotNullOrUndefined), |
1755 RelocInfo::CODE_TARGET); | 1740 RelocInfo::CODE_TARGET); |
1756 | 1741 |
1757 // 3. Call to something that is not callable. | 1742 // 3. Call to something that is not callable. |
1758 __ bind(&non_callable); | 1743 __ bind(&non_callable); |
1759 { | 1744 { |
1760 FrameScope scope(masm, StackFrame::INTERNAL); | 1745 FrameScope scope(masm, StackFrame::INTERNAL); |
1761 __ Push(a1); | 1746 __ Push(a1); |
1762 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | 1747 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 __ And(t2, t2, Operand(1 << Map::kIsCallable)); | 1812 __ And(t2, t2, Operand(1 << Map::kIsCallable)); |
1828 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); | 1813 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); |
1829 | 1814 |
1830 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1815 // Called Construct on an exotic Object with a [[Construct]] internal method. |
1831 { | 1816 { |
1832 // Overwrite the original receiver with the (original) target. | 1817 // Overwrite the original receiver with the (original) target. |
1833 __ sll(at, a0, kPointerSizeLog2); | 1818 __ sll(at, a0, kPointerSizeLog2); |
1834 __ addu(at, sp, at); | 1819 __ addu(at, sp, at); |
1835 __ sw(a1, MemOperand(at)); | 1820 __ sw(a1, MemOperand(at)); |
1836 // Let the "call_as_constructor_delegate" take care of the rest. | 1821 // Let the "call_as_constructor_delegate" take care of the rest. |
1837 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); | 1822 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); |
1838 __ Jump(masm->isolate()->builtins()->CallFunction(), | 1823 __ Jump(masm->isolate()->builtins()->CallFunction(), |
1839 RelocInfo::CODE_TARGET); | 1824 RelocInfo::CODE_TARGET); |
1840 } | 1825 } |
1841 | 1826 |
1842 // Called Construct on an Object that doesn't have a [[Construct]] internal | 1827 // Called Construct on an Object that doesn't have a [[Construct]] internal |
1843 // method. | 1828 // method. |
1844 __ bind(&non_constructor); | 1829 __ bind(&non_constructor); |
1845 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), | 1830 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), |
1846 RelocInfo::CODE_TARGET); | 1831 RelocInfo::CODE_TARGET); |
1847 } | 1832 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2001 } | 1986 } |
2002 } | 1987 } |
2003 | 1988 |
2004 | 1989 |
2005 #undef __ | 1990 #undef __ |
2006 | 1991 |
2007 } // namespace internal | 1992 } // namespace internal |
2008 } // namespace v8 | 1993 } // namespace v8 |
2009 | 1994 |
2010 #endif // V8_TARGET_ARCH_MIPS | 1995 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |