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