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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 if (!is_aborted()) status_ = DONE; | 296 if (!is_aborted()) status_ = DONE; |
297 return !is_aborted(); | 297 return !is_aborted(); |
298 } | 298 } |
299 | 299 |
300 | 300 |
301 bool LCodeGen::GenerateJumpTable() { | 301 bool LCodeGen::GenerateJumpTable() { |
302 if (jump_table_.length() > 0) { | 302 if (jump_table_.length() > 0) { |
303 Comment(";;; -------------------- Jump table --------------------"); | 303 Comment(";;; -------------------- Jump table --------------------"); |
304 } | 304 } |
305 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 305 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
306 Label table_start; | 306 Label table_start, call_deopt_entry; |
307 __ bind(&table_start); | 307 __ bind(&table_start); |
308 Label needs_frame; | 308 Label needs_frame; |
309 for (int i = 0; i < jump_table_.length(); i++) { | 309 for (int i = 0; i < jump_table_.length(); i++) { |
310 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i]; | 310 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i]; |
311 __ bind(&table_entry->label); | 311 __ bind(&table_entry->label); |
312 Address entry = table_entry->address; | 312 Address entry = table_entry->address; |
313 DeoptComment(table_entry->deopt_info); | 313 DeoptComment(table_entry->deopt_info); |
314 __ li(t9, Operand(ExternalReference::ForDeoptEntry(entry))); | 314 __ li(t9, Operand(ExternalReference::ForDeoptEntry(entry))); |
315 if (table_entry->needs_frame) { | 315 if (table_entry->needs_frame) { |
316 DCHECK(!info()->saves_caller_doubles()); | 316 DCHECK(!info()->saves_caller_doubles()); |
317 if (needs_frame.is_bound()) { | 317 Comment(";;; call deopt with frame"); |
318 __ Branch(&needs_frame); | 318 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); |
319 } else { | 319 __ Call(&needs_frame); |
320 __ bind(&needs_frame); | |
321 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); | |
322 // This variant of deopt can only be used with stubs. Since we don't | |
323 // have a function pointer to install in the stack frame that we're | |
324 // building, install a special marker there instead. | |
325 DCHECK(info()->IsStub()); | |
326 __ li(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); | |
327 __ push(scratch0()); | |
328 __ Daddu(fp, sp, | |
329 Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | |
330 __ Call(t9); | |
331 } | |
332 } else { | 320 } else { |
333 if (info()->saves_caller_doubles()) { | 321 __ Call(&call_deopt_entry); |
334 DCHECK(info()->IsStub()); | |
335 RestoreCallerDoubles(); | |
336 } | |
337 __ Call(t9); | |
338 } | 322 } |
339 } | 323 } |
| 324 if (needs_frame.is_linked()) { |
| 325 __ bind(&needs_frame); |
| 326 // This variant of deopt can only be used with stubs. Since we don't |
| 327 // have a function pointer to install in the stack frame that we're |
| 328 // building, install a special marker there instead. |
| 329 DCHECK(info()->IsStub()); |
| 330 __ li(at, Operand(Smi::FromInt(StackFrame::STUB))); |
| 331 __ push(at); |
| 332 __ Daddu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 333 } |
| 334 |
| 335 Comment(";;; call deopt"); |
| 336 __ bind(&call_deopt_entry); |
| 337 |
| 338 if (info()->saves_caller_doubles()) { |
| 339 DCHECK(info()->IsStub()); |
| 340 RestoreCallerDoubles(); |
| 341 } |
| 342 __ Jump(t9); |
| 343 |
340 __ RecordComment("]"); | 344 __ RecordComment("]"); |
341 | 345 |
342 // The deoptimization jump table is the last part of the instruction | 346 // The deoptimization jump table is the last part of the instruction |
343 // sequence. Mark the generated code as done unless we bailed out. | 347 // sequence. Mark the generated code as done unless we bailed out. |
344 if (!is_aborted()) status_ = DONE; | 348 if (!is_aborted()) status_ = DONE; |
345 return !is_aborted(); | 349 return !is_aborted(); |
346 } | 350 } |
347 | 351 |
348 | 352 |
349 bool LCodeGen::GenerateSafepointTable() { | 353 bool LCodeGen::GenerateSafepointTable() { |
(...skipping 5704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6054 __ li(at, scope_info); | 6058 __ li(at, scope_info); |
6055 __ Push(at, ToRegister(instr->function())); | 6059 __ Push(at, ToRegister(instr->function())); |
6056 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6060 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6057 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6061 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6058 } | 6062 } |
6059 | 6063 |
6060 | 6064 |
6061 #undef __ | 6065 #undef __ |
6062 | 6066 |
6063 } } // namespace v8::internal | 6067 } } // namespace v8::internal |
OLD | NEW |