OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 __ cmpi(r3, Operand::Zero()); | 924 __ cmpi(r3, Operand::Zero()); |
925 __ beq(&skip); | 925 __ beq(&skip); |
926 Generate_InterpreterPushArgs(masm, r5, r3, r7); | 926 Generate_InterpreterPushArgs(masm, r5, r3, r7); |
927 __ bind(&skip); | 927 __ bind(&skip); |
928 | 928 |
929 // Call the constructor with r3, r4, and r6 unmodified. | 929 // Call the constructor with r3, r4, and r6 unmodified. |
930 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 930 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
931 } | 931 } |
932 | 932 |
933 | 933 |
| 934 static void Generate_InterpreterNotifyDeoptimizedHelper( |
| 935 MacroAssembler* masm, Deoptimizer::BailoutType type) { |
| 936 // Enter an internal frame. |
| 937 { |
| 938 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 939 // Save accumulator register and pass the deoptimization type to |
| 940 // the runtime system. |
| 941 __ LoadSmiLiteral(r4, Smi::FromInt(static_cast<int>(type))); |
| 942 __ Push(kInterpreterAccumulatorRegister, r4); |
| 943 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 944 __ pop(kInterpreterAccumulatorRegister); // Restore accumulator register. |
| 945 // Tear down internal frame. |
| 946 } |
| 947 |
| 948 // Drop state (we don't use these for interpreter deopts) and push PC at top |
| 949 // of stack (to simulate initial call to bytecode handler in interpreter entry |
| 950 // trampoline). |
| 951 __ pop(r4); |
| 952 __ StoreP(r4, MemOperand(sp, 0)); |
| 953 |
| 954 // Initialize register file register and dispatch table register. |
| 955 __ addi(kInterpreterRegisterFileRegister, fp, |
| 956 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
| 957 __ LoadRoot(kInterpreterDispatchTableRegister, |
| 958 Heap::kInterpreterTableRootIndex); |
| 959 __ addi(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, |
| 960 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 961 |
| 962 // Get the context from the frame. |
| 963 // TODO(rmcilroy): Update interpreter frame to expect current context at the |
| 964 // context slot instead of the function context. |
| 965 __ LoadP(kContextRegister, |
| 966 MemOperand(kInterpreterRegisterFileRegister, |
| 967 InterpreterFrameConstants::kContextFromRegisterPointer)); |
| 968 |
| 969 // Get the bytecode array pointer from the frame. |
| 970 __ LoadP(r4, |
| 971 MemOperand(kInterpreterRegisterFileRegister, |
| 972 InterpreterFrameConstants::kFunctionFromRegisterPointer)); |
| 973 __ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 974 __ LoadP(kInterpreterBytecodeArrayRegister, |
| 975 FieldMemOperand(r4, SharedFunctionInfo::kFunctionDataOffset)); |
| 976 |
| 977 if (FLAG_debug_code) { |
| 978 // Check function data field is actually a BytecodeArray object. |
| 979 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); |
| 980 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
| 981 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r4, no_reg, |
| 982 BYTECODE_ARRAY_TYPE); |
| 983 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
| 984 } |
| 985 |
| 986 // Get the target bytecode offset from the frame. |
| 987 __ LoadP(kInterpreterBytecodeOffsetRegister, |
| 988 MemOperand( |
| 989 kInterpreterRegisterFileRegister, |
| 990 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); |
| 991 __ SmiUntag(kInterpreterBytecodeOffsetRegister); |
| 992 |
| 993 // Dispatch to the target bytecode. |
| 994 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, |
| 995 kInterpreterBytecodeOffsetRegister)); |
| 996 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); |
| 997 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
| 998 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 999 __ Jump(ip); |
| 1000 } |
| 1001 |
| 1002 |
| 1003 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) { |
| 1004 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
| 1005 } |
| 1006 |
| 1007 |
| 1008 void Builtins::Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm) { |
| 1009 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
| 1010 } |
| 1011 |
| 1012 |
| 1013 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) { |
| 1014 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 1015 } |
| 1016 |
| 1017 |
934 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1018 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
935 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 1019 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
936 GenerateTailCallToReturnedCode(masm); | 1020 GenerateTailCallToReturnedCode(masm); |
937 } | 1021 } |
938 | 1022 |
939 | 1023 |
940 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1024 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
941 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); | 1025 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); |
942 GenerateTailCallToReturnedCode(masm); | 1026 GenerateTailCallToReturnedCode(masm); |
943 } | 1027 } |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2138 __ bkpt(0); | 2222 __ bkpt(0); |
2139 } | 2223 } |
2140 } | 2224 } |
2141 | 2225 |
2142 | 2226 |
2143 #undef __ | 2227 #undef __ |
2144 } // namespace internal | 2228 } // namespace internal |
2145 } // namespace v8 | 2229 } // namespace v8 |
2146 | 2230 |
2147 #endif // V8_TARGET_ARCH_PPC | 2231 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |