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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 __ push(r0); | 939 __ push(r0); |
940 | 940 |
941 // Push the arguments. | 941 // Push the arguments. |
942 Generate_InterpreterPushArgs(masm, r2, r4, r5); | 942 Generate_InterpreterPushArgs(masm, r2, r4, r5); |
943 | 943 |
944 // Call the constructor with r0, r1, and r3 unmodified. | 944 // Call the constructor with r0, r1, and r3 unmodified. |
945 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 945 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
946 } | 946 } |
947 | 947 |
948 | 948 |
| 949 static void Generate_InterpreterNotifyDeoptimizedHelper( |
| 950 MacroAssembler* masm, Deoptimizer::BailoutType type) { |
| 951 // Enter an internal frame. |
| 952 { |
| 953 FrameScope scope(masm, StackFrame::INTERNAL); |
| 954 __ push(kInterpreterAccumulatorRegister); // Save accumulator register. |
| 955 |
| 956 // Pass the deoptimization type to the runtime system. |
| 957 __ mov(r1, Operand(Smi::FromInt(static_cast<int>(type)))); |
| 958 __ push(r1); |
| 959 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 960 |
| 961 __ pop(kInterpreterAccumulatorRegister); // Restore accumulator register. |
| 962 // Tear down internal frame. |
| 963 } |
| 964 |
| 965 // Drop state (we don't use these for interpreter deopts) and push PC at top |
| 966 // of stack (to simulate initial call to bytecode handler in interpreter entry |
| 967 // trampoline). |
| 968 __ pop(r1); |
| 969 __ Drop(1); |
| 970 __ push(r1); |
| 971 |
| 972 // Initialize register file register and dispatch table register. |
| 973 __ add(kInterpreterRegisterFileRegister, fp, |
| 974 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
| 975 __ LoadRoot(kInterpreterDispatchTableRegister, |
| 976 Heap::kInterpreterTableRootIndex); |
| 977 __ add(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, |
| 978 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 979 |
| 980 // Get the context from the frame. |
| 981 // TODO(rmcilroy): Update interpreter frame to expect current context at the |
| 982 // context slot instead of the function context. |
| 983 __ ldr(kContextRegister, |
| 984 MemOperand(kInterpreterRegisterFileRegister, |
| 985 InterpreterFrameConstants::kContextFromRegisterPointer)); |
| 986 |
| 987 // Get the bytecode array pointer from the frame. |
| 988 __ ldr(r1, |
| 989 MemOperand(kInterpreterRegisterFileRegister, |
| 990 InterpreterFrameConstants::kFunctionFromRegisterPointer)); |
| 991 __ ldr(r1, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 992 __ ldr(kInterpreterBytecodeArrayRegister, |
| 993 FieldMemOperand(r1, SharedFunctionInfo::kFunctionDataOffset)); |
| 994 |
| 995 if (FLAG_debug_code) { |
| 996 // Check function data field is actually a BytecodeArray object. |
| 997 __ SmiTst(kInterpreterBytecodeArrayRegister); |
| 998 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
| 999 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r1, no_reg, |
| 1000 BYTECODE_ARRAY_TYPE); |
| 1001 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
| 1002 } |
| 1003 |
| 1004 // Get the target bytecode offset from the frame. |
| 1005 __ ldr(kInterpreterBytecodeOffsetRegister, |
| 1006 MemOperand( |
| 1007 kInterpreterRegisterFileRegister, |
| 1008 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); |
| 1009 __ SmiUntag(kInterpreterBytecodeOffsetRegister); |
| 1010 |
| 1011 // Dispatch to the target bytecode. |
| 1012 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister, |
| 1013 kInterpreterBytecodeOffsetRegister)); |
| 1014 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL, |
| 1015 kPointerSizeLog2)); |
| 1016 __ add(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1017 __ mov(pc, ip); |
| 1018 } |
| 1019 |
| 1020 |
| 1021 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) { |
| 1022 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
| 1023 } |
| 1024 |
| 1025 |
| 1026 void Builtins::Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm) { |
| 1027 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
| 1028 } |
| 1029 |
| 1030 |
| 1031 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) { |
| 1032 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 1033 } |
| 1034 |
| 1035 |
949 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1036 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
950 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 1037 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
951 GenerateTailCallToReturnedCode(masm); | 1038 GenerateTailCallToReturnedCode(masm); |
952 } | 1039 } |
953 | 1040 |
954 | 1041 |
955 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1042 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
956 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); | 1043 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); |
957 GenerateTailCallToReturnedCode(masm); | 1044 GenerateTailCallToReturnedCode(masm); |
958 } | 1045 } |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 } | 2174 } |
2088 } | 2175 } |
2089 | 2176 |
2090 | 2177 |
2091 #undef __ | 2178 #undef __ |
2092 | 2179 |
2093 } // namespace internal | 2180 } // namespace internal |
2094 } // namespace v8 | 2181 } // namespace v8 |
2095 | 2182 |
2096 #endif // V8_TARGET_ARCH_ARM | 2183 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |