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