OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4254 class DeferredStackCheck: public LDeferredCode { | 4254 class DeferredStackCheck: public LDeferredCode { |
4255 public: | 4255 public: |
4256 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 4256 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
4257 : LDeferredCode(codegen), instr_(instr) { } | 4257 : LDeferredCode(codegen), instr_(instr) { } |
4258 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } | 4258 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } |
4259 virtual LInstruction* instr() { return instr_; } | 4259 virtual LInstruction* instr() { return instr_; } |
4260 private: | 4260 private: |
4261 LStackCheck* instr_; | 4261 LStackCheck* instr_; |
4262 }; | 4262 }; |
4263 | 4263 |
| 4264 DeferredStackCheck* deferred_stack_check = |
| 4265 new DeferredStackCheck(this, instr); |
| 4266 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
| 4267 __ j(below, deferred_stack_check->entry()); |
| 4268 EnsureSpaceForLazyDeopt(); |
| 4269 __ bind(instr->done_label()); |
| 4270 deferred_stack_check->SetExit(instr->done_label()); |
| 4271 // There is no LLazyBailout instruction for stack-checks. We have to |
| 4272 // prepare for lazy deoptimization explicitly here. |
4264 ASSERT(instr->HasEnvironment()); | 4273 ASSERT(instr->HasEnvironment()); |
4265 LEnvironment* env = instr->environment(); | 4274 LEnvironment* env = instr->environment(); |
4266 // There is no LLazyBailout instruction for stack-checks. We have to | 4275 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
4267 // prepare for lazy deoptimization explicitly here. | 4276 // Don't record a deoptimization index for the safepoint here. |
4268 if (instr->hydrogen()->is_function_entry()) { | 4277 // This will be done explicitly when emitting call and the safepoint in |
4269 // Perform stack overflow check. | 4278 // the deferred code. |
4270 Label done; | |
4271 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | |
4272 __ j(above_equal, &done, Label::kNear); | |
4273 StackCheckStub stub; | |
4274 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | |
4275 EnsureSpaceForLazyDeopt(); | |
4276 __ bind(&done); | |
4277 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | |
4278 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | |
4279 } else { | |
4280 ASSERT(instr->hydrogen()->is_backwards_branch()); | |
4281 // Perform stack overflow check if this goto needs it before jumping. | |
4282 DeferredStackCheck* deferred_stack_check = | |
4283 new DeferredStackCheck(this, instr); | |
4284 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | |
4285 __ j(below, deferred_stack_check->entry()); | |
4286 EnsureSpaceForLazyDeopt(); | |
4287 __ bind(instr->done_label()); | |
4288 deferred_stack_check->SetExit(instr->done_label()); | |
4289 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | |
4290 // Don't record a deoptimization index for the safepoint here. | |
4291 // This will be done explicitly when emitting call and the safepoint in | |
4292 // the deferred code. | |
4293 } | |
4294 } | 4279 } |
4295 | 4280 |
4296 | 4281 |
4297 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 4282 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
4298 // This is a pseudo-instruction that ensures that the environment here is | 4283 // This is a pseudo-instruction that ensures that the environment here is |
4299 // properly registered for deoptimization and records the assembler's PC | 4284 // properly registered for deoptimization and records the assembler's PC |
4300 // offset. | 4285 // offset. |
4301 LEnvironment* environment = instr->environment(); | 4286 LEnvironment* environment = instr->environment(); |
4302 environment->SetSpilledRegisters(instr->SpilledRegisterArray(), | 4287 environment->SetSpilledRegisters(instr->SpilledRegisterArray(), |
4303 instr->SpilledDoubleRegisterArray()); | 4288 instr->SpilledDoubleRegisterArray()); |
4304 | 4289 |
4305 // If the environment were already registered, we would have no way of | 4290 // If the environment were already registered, we would have no way of |
4306 // backpatching it with the spill slot operands. | 4291 // backpatching it with the spill slot operands. |
4307 ASSERT(!environment->HasBeenRegistered()); | 4292 ASSERT(!environment->HasBeenRegistered()); |
4308 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4293 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
4309 ASSERT(osr_pc_offset_ == -1); | 4294 ASSERT(osr_pc_offset_ == -1); |
4310 osr_pc_offset_ = masm()->pc_offset(); | 4295 osr_pc_offset_ = masm()->pc_offset(); |
4311 } | 4296 } |
4312 | 4297 |
4313 #undef __ | 4298 #undef __ |
4314 | 4299 |
4315 } } // namespace v8::internal | 4300 } } // namespace v8::internal |
4316 | 4301 |
4317 #endif // V8_TARGET_ARCH_X64 | 4302 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |