| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 __ mov(r0, r2, LeaveCC, ne); | 60 __ mov(r0, r2, LeaveCC, ne); |
| 61 __ add(r0, r0, Operand(num_extra_args + 1)); | 61 __ add(r0, r0, Operand(num_extra_args + 1)); |
| 62 | 62 |
| 63 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 63 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
| 64 } | 64 } |
| 65 | 65 |
| 66 | 66 |
| 67 // Load the built-in InternalArray function from the current context. | 67 // Load the built-in InternalArray function from the current context. |
| 68 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, | 68 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, |
| 69 Register result) { | 69 Register result) { |
| 70 // Load the native context. | 70 // Load the InternalArray function from the current native context. |
| 71 | 71 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result); |
| 72 __ ldr(result, | |
| 73 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
| 74 __ ldr(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset)); | |
| 75 // Load the InternalArray function from the native context. | |
| 76 __ ldr(result, | |
| 77 MemOperand(result, | |
| 78 Context::SlotOffset( | |
| 79 Context::INTERNAL_ARRAY_FUNCTION_INDEX))); | |
| 80 } | 72 } |
| 81 | 73 |
| 82 | 74 |
| 83 // Load the built-in Array function from the current context. | 75 // Load the built-in Array function from the current context. |
| 84 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { | 76 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { |
| 85 // Load the native context. | 77 // Load the Array function from the current native context. |
| 86 | 78 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, result); |
| 87 __ ldr(result, | |
| 88 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
| 89 __ ldr(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset)); | |
| 90 // Load the Array function from the native context. | |
| 91 __ ldr(result, | |
| 92 MemOperand(result, | |
| 93 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); | |
| 94 } | 79 } |
| 95 | 80 |
| 96 | 81 |
| 97 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { | 82 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { |
| 98 // ----------- S t a t e ------------- | 83 // ----------- S t a t e ------------- |
| 99 // -- r0 : number of arguments | 84 // -- r0 : number of arguments |
| 100 // -- lr : return address | 85 // -- lr : return address |
| 101 // -- sp[...]: constructor arguments | 86 // -- sp[...]: constructor arguments |
| 102 // ----------------------------------- | 87 // ----------------------------------- |
| 103 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; | 88 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; |
| (...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 CompatibleReceiverCheck(masm, r2, r3, r4, r5, r6, &receiver_check_failed); | 1226 CompatibleReceiverCheck(masm, r2, r3, r4, r5, r6, &receiver_check_failed); |
| 1242 | 1227 |
| 1243 // Get the callback offset from the FunctionTemplateInfo, and jump to the | 1228 // Get the callback offset from the FunctionTemplateInfo, and jump to the |
| 1244 // beginning of the code. | 1229 // beginning of the code. |
| 1245 __ ldr(r4, FieldMemOperand(r3, FunctionTemplateInfo::kCallCodeOffset)); | 1230 __ ldr(r4, FieldMemOperand(r3, FunctionTemplateInfo::kCallCodeOffset)); |
| 1246 __ ldr(r4, FieldMemOperand(r4, CallHandlerInfo::kFastHandlerOffset)); | 1231 __ ldr(r4, FieldMemOperand(r4, CallHandlerInfo::kFastHandlerOffset)); |
| 1247 __ add(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1232 __ add(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1248 __ Jump(r4); | 1233 __ Jump(r4); |
| 1249 | 1234 |
| 1250 __ bind(&set_global_proxy); | 1235 __ bind(&set_global_proxy); |
| 1251 __ ldr(r2, GlobalObjectOperand()); | 1236 __ LoadGlobalProxy(r2); |
| 1252 __ ldr(r2, FieldMemOperand(r2, JSGlobalObject::kGlobalProxyOffset)); | |
| 1253 __ str(r2, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1237 __ str(r2, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
| 1254 __ b(&valid_receiver); | 1238 __ b(&valid_receiver); |
| 1255 | 1239 |
| 1256 // Compatible receiver check failed: throw an Illegal Invocation exception. | 1240 // Compatible receiver check failed: throw an Illegal Invocation exception. |
| 1257 __ bind(&receiver_check_failed); | 1241 __ bind(&receiver_check_failed); |
| 1258 // Drop the arguments (including the receiver) | 1242 // Drop the arguments (including the receiver) |
| 1259 __ add(r0, r0, Operand(1)); | 1243 __ add(r0, r0, Operand(1)); |
| 1260 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); | 1244 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 1261 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1); | 1245 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1); |
| 1262 } | 1246 } |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 // 2. Call to something else, which might have a [[Call]] internal method (if | 1711 // 2. Call to something else, which might have a [[Call]] internal method (if |
| 1728 // not we raise an exception). | 1712 // not we raise an exception). |
| 1729 __ bind(&non_function); | 1713 __ bind(&non_function); |
| 1730 // Check if target has a [[Call]] internal method. | 1714 // Check if target has a [[Call]] internal method. |
| 1731 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset)); | 1715 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset)); |
| 1732 __ tst(r4, Operand(1 << Map::kIsCallable)); | 1716 __ tst(r4, Operand(1 << Map::kIsCallable)); |
| 1733 __ b(eq, &non_callable); | 1717 __ b(eq, &non_callable); |
| 1734 // Overwrite the original receiver the (original) target. | 1718 // Overwrite the original receiver the (original) target. |
| 1735 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1719 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
| 1736 // Let the "call_as_function_delegate" take care of the rest. | 1720 // Let the "call_as_function_delegate" take care of the rest. |
| 1737 __ LoadGlobalFunction(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, r1); | 1721 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, r1); |
| 1738 __ Jump(masm->isolate()->builtins()->CallFunction( | 1722 __ Jump(masm->isolate()->builtins()->CallFunction( |
| 1739 ConvertReceiverMode::kNotNullOrUndefined), | 1723 ConvertReceiverMode::kNotNullOrUndefined), |
| 1740 RelocInfo::CODE_TARGET); | 1724 RelocInfo::CODE_TARGET); |
| 1741 | 1725 |
| 1742 // 3. Call to something that is not callable. | 1726 // 3. Call to something that is not callable. |
| 1743 __ bind(&non_callable); | 1727 __ bind(&non_callable); |
| 1744 { | 1728 { |
| 1745 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1729 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1746 __ Push(r1); | 1730 __ Push(r1); |
| 1747 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | 1731 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1810 // Check if target has a [[Construct]] internal method. | 1794 // Check if target has a [[Construct]] internal method. |
| 1811 __ ldrb(r2, FieldMemOperand(r4, Map::kBitFieldOffset)); | 1795 __ ldrb(r2, FieldMemOperand(r4, Map::kBitFieldOffset)); |
| 1812 __ tst(r2, Operand(1 << Map::kIsConstructor)); | 1796 __ tst(r2, Operand(1 << Map::kIsConstructor)); |
| 1813 __ b(eq, &non_constructor); | 1797 __ b(eq, &non_constructor); |
| 1814 | 1798 |
| 1815 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1799 // Called Construct on an exotic Object with a [[Construct]] internal method. |
| 1816 { | 1800 { |
| 1817 // Overwrite the original receiver with the (original) target. | 1801 // Overwrite the original receiver with the (original) target. |
| 1818 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1802 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
| 1819 // Let the "call_as_constructor_delegate" take care of the rest. | 1803 // Let the "call_as_constructor_delegate" take care of the rest. |
| 1820 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, r1); | 1804 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, r1); |
| 1821 __ Jump(masm->isolate()->builtins()->CallFunction(), | 1805 __ Jump(masm->isolate()->builtins()->CallFunction(), |
| 1822 RelocInfo::CODE_TARGET); | 1806 RelocInfo::CODE_TARGET); |
| 1823 } | 1807 } |
| 1824 | 1808 |
| 1825 // Called Construct on an Object that doesn't have a [[Construct]] internal | 1809 // Called Construct on an Object that doesn't have a [[Construct]] internal |
| 1826 // method. | 1810 // method. |
| 1827 __ bind(&non_constructor); | 1811 __ bind(&non_constructor); |
| 1828 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), | 1812 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), |
| 1829 RelocInfo::CODE_TARGET); | 1813 RelocInfo::CODE_TARGET); |
| 1830 } | 1814 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 } | 1959 } |
| 1976 } | 1960 } |
| 1977 | 1961 |
| 1978 | 1962 |
| 1979 #undef __ | 1963 #undef __ |
| 1980 | 1964 |
| 1981 } // namespace internal | 1965 } // namespace internal |
| 1982 } // namespace v8 | 1966 } // namespace v8 |
| 1983 | 1967 |
| 1984 #endif // V8_TARGET_ARCH_ARM | 1968 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |