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 #include "src/deoptimizer.h" | 5 #include "src/deoptimizer.h" |
6 #include "src/codegen.h" | 6 #include "src/codegen.h" |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/register-configuration.h" | 8 #include "src/register-configuration.h" |
9 #include "src/safepoint-table.h" | 9 #include "src/safepoint-table.h" |
10 | 10 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // Get the address of the location in the code object (r5)(return | 144 // Get the address of the location in the code object (r5)(return |
145 // address for lazy deoptimization) and compute the fp-to-sp delta in | 145 // address for lazy deoptimization) and compute the fp-to-sp delta in |
146 // register r6. | 146 // register r6. |
147 __ LoadRR(r5, r14); | 147 __ LoadRR(r5, r14); |
148 __ la(r6, MemOperand(sp, kSavedRegistersAreaSize + (1 * kPointerSize))); | 148 __ la(r6, MemOperand(sp, kSavedRegistersAreaSize + (1 * kPointerSize))); |
149 __ SubP(r6, fp, r6); | 149 __ SubP(r6, fp, r6); |
150 | 150 |
151 // Allocate a new deoptimizer object. | 151 // Allocate a new deoptimizer object. |
152 // Pass six arguments in r2 to r7. | 152 // Pass six arguments in r2 to r7. |
153 __ PrepareCallCFunction(6, r7); | 153 __ PrepareCallCFunction(6, r7); |
| 154 __ LoadImmP(r2, Operand::Zero()); |
| 155 Label context_check; |
| 156 __ LoadP(r3, MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); |
| 157 __ JumpIfSmi(r3, &context_check); |
154 __ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 158 __ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 159 __ bind(&context_check); |
155 __ LoadImmP(r3, Operand(type())); // bailout type, | 160 __ LoadImmP(r3, Operand(type())); // bailout type, |
156 // r4: bailout id already loaded. | 161 // r4: bailout id already loaded. |
157 // r5: code address or 0 already loaded. | 162 // r5: code address or 0 already loaded. |
158 // r6: Fp-to-sp delta. | 163 // r6: Fp-to-sp delta. |
159 // Parm6: isolate is passed on the stack. | 164 // Parm6: isolate is passed on the stack. |
160 __ mov(r7, Operand(ExternalReference::isolate_address(isolate()))); | 165 __ mov(r7, Operand(ExternalReference::isolate_address(isolate()))); |
161 __ StoreP(r7, MemOperand(sp, kStackFrameExtraParamSlot * kPointerSize)); | 166 __ StoreP(r7, MemOperand(sp, kStackFrameExtraParamSlot * kPointerSize)); |
162 | 167 |
163 // Call Deoptimizer::New(). | 168 // Call Deoptimizer::New(). |
164 { | 169 { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // r2: deoptimizer object; r3: scratch. | 228 // r2: deoptimizer object; r3: scratch. |
224 __ PrepareCallCFunction(1, r3); | 229 __ PrepareCallCFunction(1, r3); |
225 // Call Deoptimizer::ComputeOutputFrames(). | 230 // Call Deoptimizer::ComputeOutputFrames(). |
226 { | 231 { |
227 AllowExternalCallThatCantCauseGC scope(masm()); | 232 AllowExternalCallThatCantCauseGC scope(masm()); |
228 __ CallCFunction( | 233 __ CallCFunction( |
229 ExternalReference::compute_output_frames_function(isolate()), 1); | 234 ExternalReference::compute_output_frames_function(isolate()), 1); |
230 } | 235 } |
231 __ pop(r2); // Restore deoptimizer object (class Deoptimizer). | 236 __ pop(r2); // Restore deoptimizer object (class Deoptimizer). |
232 | 237 |
| 238 __ LoadP(sp, MemOperand(r2, Deoptimizer::caller_frame_top_offset())); |
| 239 |
233 // Replace the current (input) frame with the output frames. | 240 // Replace the current (input) frame with the output frames. |
234 Label outer_push_loop, inner_push_loop, outer_loop_header, inner_loop_header; | 241 Label outer_push_loop, inner_push_loop, outer_loop_header, inner_loop_header; |
235 // Outer loop state: r6 = current "FrameDescription** output_", | 242 // Outer loop state: r6 = current "FrameDescription** output_", |
236 // r3 = one past the last FrameDescription**. | 243 // r3 = one past the last FrameDescription**. |
237 __ LoadlW(r3, MemOperand(r2, Deoptimizer::output_count_offset())); | 244 __ LoadlW(r3, MemOperand(r2, Deoptimizer::output_count_offset())); |
238 __ LoadP(r6, MemOperand(r2, Deoptimizer::output_offset())); // r6 is output_. | 245 __ LoadP(r6, MemOperand(r2, Deoptimizer::output_offset())); // r6 is output_. |
239 __ ShiftLeftP(r3, r3, Operand(kPointerSizeLog2)); | 246 __ ShiftLeftP(r3, r3, Operand(kPointerSizeLog2)); |
240 __ AddP(r3, r6, r3); | 247 __ AddP(r3, r6, r3); |
241 __ b(&outer_loop_header, Label::kNear); | 248 __ b(&outer_loop_header, Label::kNear); |
242 | 249 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 329 |
323 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { | 330 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { |
324 // No out-of-line constant pool support. | 331 // No out-of-line constant pool support. |
325 UNREACHABLE(); | 332 UNREACHABLE(); |
326 } | 333 } |
327 | 334 |
328 #undef __ | 335 #undef __ |
329 | 336 |
330 } // namespace internal | 337 } // namespace internal |
331 } // namespace v8 | 338 } // namespace v8 |
OLD | NEW |