| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 if (FLAG_code_comments && instr->HasInterestingComment(this)) { | 264 if (FLAG_code_comments && instr->HasInterestingComment(this)) { |
| 265 Comment(";;; <@%d,#%d> %s", | 265 Comment(";;; <@%d,#%d> %s", |
| 266 current_instruction_, | 266 current_instruction_, |
| 267 instr->hydrogen_value()->id(), | 267 instr->hydrogen_value()->id(), |
| 268 instr->Mnemonic()); | 268 instr->Mnemonic()); |
| 269 } | 269 } |
| 270 | 270 |
| 271 instr->CompileToNative(this); | 271 instr->CompileToNative(this); |
| 272 } | 272 } |
| 273 EnsureSpaceForLazyDeopt(); | 273 EnsureSpaceForLazyDeopt(); |
| 274 last_lazy_deopt_pc_ = masm()->pc_offset(); |
| 274 return !is_aborted(); | 275 return !is_aborted(); |
| 275 } | 276 } |
| 276 | 277 |
| 277 | 278 |
| 278 bool LCodeGen::GenerateDeferredCode() { | 279 bool LCodeGen::GenerateDeferredCode() { |
| 279 ASSERT(is_generating()); | 280 ASSERT(is_generating()); |
| 280 if (deferred_.length() > 0) { | 281 if (deferred_.length() > 0) { |
| 281 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { | 282 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { |
| 282 LDeferredCode* code = deferred_[i]; | 283 LDeferredCode* code = deferred_[i]; |
| 283 Comment(";;; <@%d,#%d> " | 284 Comment(";;; <@%d,#%d> " |
| (...skipping 5345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5629 int current_pc = masm()->pc_offset(); | 5630 int current_pc = masm()->pc_offset(); |
| 5630 int patch_size = Deoptimizer::patch_size(); | 5631 int patch_size = Deoptimizer::patch_size(); |
| 5631 if (current_pc < last_lazy_deopt_pc_ + patch_size) { | 5632 if (current_pc < last_lazy_deopt_pc_ + patch_size) { |
| 5632 int padding_size = last_lazy_deopt_pc_ + patch_size - current_pc; | 5633 int padding_size = last_lazy_deopt_pc_ + patch_size - current_pc; |
| 5633 ASSERT_EQ(0, padding_size % Assembler::kInstrSize); | 5634 ASSERT_EQ(0, padding_size % Assembler::kInstrSize); |
| 5634 while (padding_size > 0) { | 5635 while (padding_size > 0) { |
| 5635 __ nop(); | 5636 __ nop(); |
| 5636 padding_size -= Assembler::kInstrSize; | 5637 padding_size -= Assembler::kInstrSize; |
| 5637 } | 5638 } |
| 5638 } | 5639 } |
| 5639 last_lazy_deopt_pc_ = masm()->pc_offset(); | |
| 5640 } | 5640 } |
| 5641 | 5641 |
| 5642 | 5642 |
| 5643 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { | 5643 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { |
| 5644 EnsureSpaceForLazyDeopt(); | 5644 EnsureSpaceForLazyDeopt(); |
| 5645 last_lazy_deopt_pc_ = masm()->pc_offset(); |
| 5645 ASSERT(instr->HasEnvironment()); | 5646 ASSERT(instr->HasEnvironment()); |
| 5646 LEnvironment* env = instr->environment(); | 5647 LEnvironment* env = instr->environment(); |
| 5647 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 5648 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
| 5648 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5649 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 5649 } | 5650 } |
| 5650 | 5651 |
| 5651 | 5652 |
| 5652 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 5653 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
| 5653 if (instr->hydrogen_value()->IsSoftDeoptimize()) { | 5654 if (instr->hydrogen_value()->IsSoftDeoptimize()) { |
| 5654 SoftDeoptimize(instr->environment(), zero_reg, Operand(zero_reg)); | 5655 SoftDeoptimize(instr->environment(), zero_reg, Operand(zero_reg)); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5717 // There is no LLazyBailout instruction for stack-checks. We have to | 5718 // There is no LLazyBailout instruction for stack-checks. We have to |
| 5718 // prepare for lazy deoptimization explicitly here. | 5719 // prepare for lazy deoptimization explicitly here. |
| 5719 if (instr->hydrogen()->is_function_entry()) { | 5720 if (instr->hydrogen()->is_function_entry()) { |
| 5720 // Perform stack overflow check. | 5721 // Perform stack overflow check. |
| 5721 Label done; | 5722 Label done; |
| 5722 __ LoadRoot(at, Heap::kStackLimitRootIndex); | 5723 __ LoadRoot(at, Heap::kStackLimitRootIndex); |
| 5723 __ Branch(&done, hs, sp, Operand(at)); | 5724 __ Branch(&done, hs, sp, Operand(at)); |
| 5724 StackCheckStub stub; | 5725 StackCheckStub stub; |
| 5725 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 5726 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 5726 EnsureSpaceForLazyDeopt(); | 5727 EnsureSpaceForLazyDeopt(); |
| 5728 last_lazy_deopt_pc_ = masm()->pc_offset(); |
| 5727 __ bind(&done); | 5729 __ bind(&done); |
| 5728 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 5730 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
| 5729 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5731 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 5730 } else { | 5732 } else { |
| 5731 ASSERT(instr->hydrogen()->is_backwards_branch()); | 5733 ASSERT(instr->hydrogen()->is_backwards_branch()); |
| 5732 // Perform stack overflow check if this goto needs it before jumping. | 5734 // Perform stack overflow check if this goto needs it before jumping. |
| 5733 DeferredStackCheck* deferred_stack_check = | 5735 DeferredStackCheck* deferred_stack_check = |
| 5734 new(zone()) DeferredStackCheck(this, instr); | 5736 new(zone()) DeferredStackCheck(this, instr); |
| 5735 __ LoadRoot(at, Heap::kStackLimitRootIndex); | 5737 __ LoadRoot(at, Heap::kStackLimitRootIndex); |
| 5736 __ Branch(deferred_stack_check->entry(), lo, sp, Operand(at)); | 5738 __ Branch(deferred_stack_check->entry(), lo, sp, Operand(at)); |
| 5737 EnsureSpaceForLazyDeopt(); | 5739 EnsureSpaceForLazyDeopt(); |
| 5740 last_lazy_deopt_pc_ = masm()->pc_offset(); |
| 5738 __ bind(instr->done_label()); | 5741 __ bind(instr->done_label()); |
| 5739 deferred_stack_check->SetExit(instr->done_label()); | 5742 deferred_stack_check->SetExit(instr->done_label()); |
| 5740 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 5743 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
| 5741 // Don't record a deoptimization index for the safepoint here. | 5744 // Don't record a deoptimization index for the safepoint here. |
| 5742 // This will be done explicitly when emitting call and the safepoint in | 5745 // This will be done explicitly when emitting call and the safepoint in |
| 5743 // the deferred code. | 5746 // the deferred code. |
| 5744 } | 5747 } |
| 5745 } | 5748 } |
| 5746 | 5749 |
| 5747 | 5750 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5850 __ Subu(scratch, result, scratch); | 5853 __ Subu(scratch, result, scratch); |
| 5851 __ lw(result, FieldMemOperand(scratch, | 5854 __ lw(result, FieldMemOperand(scratch, |
| 5852 FixedArray::kHeaderSize - kPointerSize)); | 5855 FixedArray::kHeaderSize - kPointerSize)); |
| 5853 __ bind(&done); | 5856 __ bind(&done); |
| 5854 } | 5857 } |
| 5855 | 5858 |
| 5856 | 5859 |
| 5857 #undef __ | 5860 #undef __ |
| 5858 | 5861 |
| 5859 } } // namespace v8::internal | 5862 } } // namespace v8::internal |
| OLD | NEW |