| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 383 |
| 384 // Adjust the frame size, subsuming the unoptimized frame into the | 384 // Adjust the frame size, subsuming the unoptimized frame into the |
| 385 // optimized frame. | 385 // optimized frame. |
| 386 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); | 386 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); |
| 387 ASSERT(slots >= 1); | 387 ASSERT(slots >= 1); |
| 388 __ sub(esp, Immediate((slots - 1) * kPointerSize)); | 388 __ sub(esp, Immediate((slots - 1) * kPointerSize)); |
| 389 } | 389 } |
| 390 | 390 |
| 391 | 391 |
| 392 void LCodeGen::GenerateBodyInstructionPre(LInstruction* instr) { | 392 void LCodeGen::GenerateBodyInstructionPre(LInstruction* instr) { |
| 393 if (instr->IsCall()) { |
| 394 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); |
| 395 } |
| 393 if (!instr->IsLazyBailout() && !instr->IsGap()) { | 396 if (!instr->IsLazyBailout() && !instr->IsGap()) { |
| 394 safepoints_.BumpLastLazySafepointIndex(); | 397 safepoints_.BumpLastLazySafepointIndex(); |
| 395 } | 398 } |
| 396 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr); | 399 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr); |
| 397 } | 400 } |
| 398 | 401 |
| 399 | 402 |
| 400 void LCodeGen::GenerateBodyInstructionPost(LInstruction* instr) { | 403 void LCodeGen::GenerateBodyInstructionPost(LInstruction* instr) { |
| 401 if (!CpuFeatures::IsSupported(SSE2)) { | 404 if (!CpuFeatures::IsSupported(SSE2)) { |
| 402 if (instr->IsGoto()) { | 405 if (instr->IsGoto()) { |
| (...skipping 5741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6144 if (current_pc < last_lazy_deopt_pc_ + space_needed) { | 6147 if (current_pc < last_lazy_deopt_pc_ + space_needed) { |
| 6145 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 6148 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
| 6146 __ Nop(padding_size); | 6149 __ Nop(padding_size); |
| 6147 } | 6150 } |
| 6148 } | 6151 } |
| 6149 last_lazy_deopt_pc_ = masm()->pc_offset(); | 6152 last_lazy_deopt_pc_ = masm()->pc_offset(); |
| 6150 } | 6153 } |
| 6151 | 6154 |
| 6152 | 6155 |
| 6153 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { | 6156 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { |
| 6154 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 6157 last_lazy_deopt_pc_ = masm()->pc_offset(); |
| 6155 ASSERT(instr->HasEnvironment()); | 6158 ASSERT(instr->HasEnvironment()); |
| 6156 LEnvironment* env = instr->environment(); | 6159 LEnvironment* env = instr->environment(); |
| 6157 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 6160 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
| 6158 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 6161 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 6159 } | 6162 } |
| 6160 | 6163 |
| 6161 | 6164 |
| 6162 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 6165 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
| 6163 Deoptimizer::BailoutType type = instr->hydrogen()->type(); | 6166 Deoptimizer::BailoutType type = instr->hydrogen()->type(); |
| 6164 // TODO(danno): Stubs expect all deopts to be lazy for historical reasons (the | 6167 // TODO(danno): Stubs expect all deopts to be lazy for historical reasons (the |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6220 ExternalReference stack_limit = | 6223 ExternalReference stack_limit = |
| 6221 ExternalReference::address_of_stack_limit(isolate()); | 6224 ExternalReference::address_of_stack_limit(isolate()); |
| 6222 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 6225 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 6223 __ j(above_equal, &done, Label::kNear); | 6226 __ j(above_equal, &done, Label::kNear); |
| 6224 | 6227 |
| 6225 ASSERT(instr->context()->IsRegister()); | 6228 ASSERT(instr->context()->IsRegister()); |
| 6226 ASSERT(ToRegister(instr->context()).is(esi)); | 6229 ASSERT(ToRegister(instr->context()).is(esi)); |
| 6227 CallCode(isolate()->builtins()->StackCheck(), | 6230 CallCode(isolate()->builtins()->StackCheck(), |
| 6228 RelocInfo::CODE_TARGET, | 6231 RelocInfo::CODE_TARGET, |
| 6229 instr); | 6232 instr); |
| 6230 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | |
| 6231 __ bind(&done); | 6233 __ bind(&done); |
| 6232 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | |
| 6233 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | |
| 6234 } else { | 6234 } else { |
| 6235 ASSERT(instr->hydrogen()->is_backwards_branch()); | 6235 ASSERT(instr->hydrogen()->is_backwards_branch()); |
| 6236 // Perform stack overflow check if this goto needs it before jumping. | 6236 // Perform stack overflow check if this goto needs it before jumping. |
| 6237 DeferredStackCheck* deferred_stack_check = | 6237 DeferredStackCheck* deferred_stack_check = |
| 6238 new(zone()) DeferredStackCheck(this, instr, x87_stack_); | 6238 new(zone()) DeferredStackCheck(this, instr, x87_stack_); |
| 6239 ExternalReference stack_limit = | 6239 ExternalReference stack_limit = |
| 6240 ExternalReference::address_of_stack_limit(isolate()); | 6240 ExternalReference::address_of_stack_limit(isolate()); |
| 6241 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 6241 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 6242 __ j(below, deferred_stack_check->entry()); | 6242 __ j(below, deferred_stack_check->entry()); |
| 6243 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 6243 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6352 FixedArray::kHeaderSize - kPointerSize)); | 6352 FixedArray::kHeaderSize - kPointerSize)); |
| 6353 __ bind(&done); | 6353 __ bind(&done); |
| 6354 } | 6354 } |
| 6355 | 6355 |
| 6356 | 6356 |
| 6357 #undef __ | 6357 #undef __ |
| 6358 | 6358 |
| 6359 } } // namespace v8::internal | 6359 } } // namespace v8::internal |
| 6360 | 6360 |
| 6361 #endif // V8_TARGET_ARCH_IA32 | 6361 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |