| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 if (!is_int24((masm()->pc_offset() / Assembler::kInstrSize) + | 336 if (!is_int24((masm()->pc_offset() / Assembler::kInstrSize) + |
| 337 deopt_jump_table_.length() * 7)) { | 337 deopt_jump_table_.length() * 7)) { |
| 338 Abort("Generated code is too large"); | 338 Abort("Generated code is too large"); |
| 339 } | 339 } |
| 340 | 340 |
| 341 if (deopt_jump_table_.length() > 0) { | 341 if (deopt_jump_table_.length() > 0) { |
| 342 Comment(";;; -------------------- Jump table --------------------"); | 342 Comment(";;; -------------------- Jump table --------------------"); |
| 343 } | 343 } |
| 344 Label table_start; | 344 Label table_start; |
| 345 __ bind(&table_start); | 345 __ bind(&table_start); |
| 346 Label needs_frame_not_call; | 346 Label needs_frame; |
| 347 Label needs_frame_is_call; | |
| 348 for (int i = 0; i < deopt_jump_table_.length(); i++) { | 347 for (int i = 0; i < deopt_jump_table_.length(); i++) { |
| 349 __ bind(&deopt_jump_table_[i].label); | 348 __ bind(&deopt_jump_table_[i].label); |
| 350 Address entry = deopt_jump_table_[i].address; | 349 Address entry = deopt_jump_table_[i].address; |
| 351 Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type; | 350 Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type; |
| 352 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); | 351 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); |
| 353 if (id == Deoptimizer::kNotDeoptimizationEntry) { | 352 if (id == Deoptimizer::kNotDeoptimizationEntry) { |
| 354 Comment(";;; jump table entry %d.", i); | 353 Comment(";;; jump table entry %d.", i); |
| 355 } else { | 354 } else { |
| 356 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); | 355 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); |
| 357 } | 356 } |
| 358 if (deopt_jump_table_[i].needs_frame) { | 357 if (deopt_jump_table_[i].needs_frame) { |
| 359 __ mov(ip, Operand(ExternalReference::ForDeoptEntry(entry))); | 358 __ mov(ip, Operand(ExternalReference::ForDeoptEntry(entry))); |
| 360 if (type == Deoptimizer::LAZY) { | 359 if (needs_frame.is_bound()) { |
| 361 if (needs_frame_is_call.is_bound()) { | 360 __ b(&needs_frame); |
| 362 __ b(&needs_frame_is_call); | |
| 363 } else { | |
| 364 __ bind(&needs_frame_is_call); | |
| 365 __ stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | |
| 366 // This variant of deopt can only be used with stubs. Since we don't | |
| 367 // have a function pointer to install in the stack frame that we're | |
| 368 // building, install a special marker there instead. | |
| 369 ASSERT(info()->IsStub()); | |
| 370 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); | |
| 371 __ push(scratch0()); | |
| 372 __ add(fp, sp, Operand(2 * kPointerSize)); | |
| 373 __ mov(lr, Operand(pc), LeaveCC, al); | |
| 374 __ mov(pc, ip); | |
| 375 } | |
| 376 } else { | 361 } else { |
| 377 if (needs_frame_not_call.is_bound()) { | 362 __ bind(&needs_frame); |
| 378 __ b(&needs_frame_not_call); | 363 __ stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |
| 379 } else { | 364 // This variant of deopt can only be used with stubs. Since we don't |
| 380 __ bind(&needs_frame_not_call); | 365 // have a function pointer to install in the stack frame that we're |
| 381 __ stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 366 // building, install a special marker there instead. |
| 382 // This variant of deopt can only be used with stubs. Since we don't | 367 ASSERT(info()->IsStub()); |
| 383 // have a function pointer to install in the stack frame that we're | 368 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); |
| 384 // building, install a special marker there instead. | 369 __ push(scratch0()); |
| 385 ASSERT(info()->IsStub()); | 370 __ add(fp, sp, Operand(2 * kPointerSize)); |
| 386 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); | 371 __ mov(lr, Operand(pc), LeaveCC, al); |
| 387 __ push(scratch0()); | 372 __ mov(pc, ip); |
| 388 __ add(fp, sp, Operand(2 * kPointerSize)); | |
| 389 __ mov(pc, ip); | |
| 390 } | |
| 391 } | 373 } |
| 392 } else { | 374 } else { |
| 393 if (type == Deoptimizer::LAZY) { | 375 __ mov(lr, Operand(pc), LeaveCC, al); |
| 394 __ mov(lr, Operand(pc), LeaveCC, al); | 376 __ mov(pc, Operand(ExternalReference::ForDeoptEntry(entry))); |
| 395 __ mov(pc, Operand(ExternalReference::ForDeoptEntry(entry))); | |
| 396 } else { | |
| 397 __ mov(pc, Operand(ExternalReference::ForDeoptEntry(entry))); | |
| 398 } | |
| 399 } | 377 } |
| 400 masm()->CheckConstPool(false, false); | 378 masm()->CheckConstPool(false, false); |
| 401 } | 379 } |
| 402 | 380 |
| 403 // Force constant pool emission at the end of the deopt jump table to make | 381 // Force constant pool emission at the end of the deopt jump table to make |
| 404 // sure that no constant pools are emitted after. | 382 // sure that no constant pools are emitted after. |
| 405 masm()->CheckConstPool(true, false); | 383 masm()->CheckConstPool(true, false); |
| 406 | 384 |
| 407 // The deoptimization jump table is the last part of the instruction | 385 // The deoptimization jump table is the last part of the instruction |
| 408 // sequence. Mark the generated code as done unless we bailed out. | 386 // sequence. Mark the generated code as done unless we bailed out. |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 info()->opt_count() == id) { | 774 info()->opt_count() == id) { |
| 797 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); | 775 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); |
| 798 return; | 776 return; |
| 799 } | 777 } |
| 800 | 778 |
| 801 if (FLAG_trap_on_deopt && info()->IsOptimizing()) { | 779 if (FLAG_trap_on_deopt && info()->IsOptimizing()) { |
| 802 __ stop("trap_on_deopt", cc); | 780 __ stop("trap_on_deopt", cc); |
| 803 } | 781 } |
| 804 | 782 |
| 805 ASSERT(info()->IsStub() || frame_is_built_); | 783 ASSERT(info()->IsStub() || frame_is_built_); |
| 806 bool needs_lazy_deopt = info()->IsStub(); | |
| 807 if (cc == al && frame_is_built_) { | 784 if (cc == al && frame_is_built_) { |
| 808 if (needs_lazy_deopt) { | 785 __ Call(entry, RelocInfo::RUNTIME_ENTRY); |
| 809 __ Call(entry, RelocInfo::RUNTIME_ENTRY); | |
| 810 } else { | |
| 811 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); | |
| 812 } | |
| 813 } else { | 786 } else { |
| 814 // We often have several deopts to the same entry, reuse the last | 787 // We often have several deopts to the same entry, reuse the last |
| 815 // jump entry if this is the case. | 788 // jump entry if this is the case. |
| 816 if (deopt_jump_table_.is_empty() || | 789 if (deopt_jump_table_.is_empty() || |
| 817 (deopt_jump_table_.last().address != entry) || | 790 (deopt_jump_table_.last().address != entry) || |
| 818 (deopt_jump_table_.last().bailout_type != bailout_type) || | 791 (deopt_jump_table_.last().bailout_type != bailout_type) || |
| 819 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { | 792 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { |
| 820 Deoptimizer::JumpTableEntry table_entry(entry, | 793 Deoptimizer::JumpTableEntry table_entry(entry, |
| 821 bailout_type, | 794 bailout_type, |
| 822 !frame_is_built_); | 795 !frame_is_built_); |
| (...skipping 5073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5896 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5869 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5897 __ ldr(result, FieldMemOperand(scratch, | 5870 __ ldr(result, FieldMemOperand(scratch, |
| 5898 FixedArray::kHeaderSize - kPointerSize)); | 5871 FixedArray::kHeaderSize - kPointerSize)); |
| 5899 __ bind(&done); | 5872 __ bind(&done); |
| 5900 } | 5873 } |
| 5901 | 5874 |
| 5902 | 5875 |
| 5903 #undef __ | 5876 #undef __ |
| 5904 | 5877 |
| 5905 } } // namespace v8::internal | 5878 } } // namespace v8::internal |
| OLD | NEW |