| 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 4631 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4642   class DeferredStackCheck: public LDeferredCode { |  4642   class DeferredStackCheck: public LDeferredCode { | 
|  4643    public: |  4643    public: | 
|  4644     DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |  4644     DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 
|  4645         : LDeferredCode(codegen), instr_(instr) { } |  4645         : LDeferredCode(codegen), instr_(instr) { } | 
|  4646     virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } |  4646     virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } | 
|  4647     virtual LInstruction* instr() { return instr_; } |  4647     virtual LInstruction* instr() { return instr_; } | 
|  4648    private: |  4648    private: | 
|  4649     LStackCheck* instr_; |  4649     LStackCheck* instr_; | 
|  4650   }; |  4650   }; | 
|  4651  |  4651  | 
 |  4652   DeferredStackCheck* deferred_stack_check = | 
 |  4653       new DeferredStackCheck(this, instr); | 
 |  4654   __ LoadRoot(ip, Heap::kStackLimitRootIndex); | 
 |  4655   __ cmp(sp, Operand(ip)); | 
 |  4656   __ b(lo, deferred_stack_check->entry()); | 
 |  4657   EnsureSpaceForLazyDeopt(); | 
 |  4658   __ bind(instr->done_label()); | 
 |  4659   deferred_stack_check->SetExit(instr->done_label()); | 
 |  4660   // There is no LLazyBailout instruction for stack-checks. We have to | 
 |  4661   // prepare for lazy deoptimization explicitly here. | 
|  4652   ASSERT(instr->HasEnvironment()); |  4662   ASSERT(instr->HasEnvironment()); | 
|  4653   LEnvironment* env = instr->environment(); |  4663   LEnvironment* env = instr->environment(); | 
|  4654   // There is no LLazyBailout instruction for stack-checks. We have to |  4664   RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 
|  4655   // prepare for lazy deoptimization explicitly here. |  4665   // Don't record a deoptimization index for the safepoint here. | 
|  4656   if (instr->hydrogen()->is_function_entry()) { |  4666   // This will be done explicitly when emitting call and the safepoint in | 
|  4657     // Perform stack overflow check. |  4667   // the deferred code. | 
|  4658     Label done; |  | 
|  4659     __ LoadRoot(ip, Heap::kStackLimitRootIndex); |  | 
|  4660     __ cmp(sp, Operand(ip)); |  | 
|  4661     __ b(hs, &done); |  | 
|  4662     StackCheckStub stub; |  | 
|  4663     CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |  | 
|  4664     EnsureSpaceForLazyDeopt(); |  | 
|  4665     __ bind(&done); |  | 
|  4666     RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |  | 
|  4667     safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |  | 
|  4668   } else { |  | 
|  4669     ASSERT(instr->hydrogen()->is_backwards_branch()); |  | 
|  4670     // Perform stack overflow check if this goto needs it before jumping. |  | 
|  4671     DeferredStackCheck* deferred_stack_check = |  | 
|  4672         new DeferredStackCheck(this, instr); |  | 
|  4673     __ LoadRoot(ip, Heap::kStackLimitRootIndex); |  | 
|  4674     __ cmp(sp, Operand(ip)); |  | 
|  4675     __ b(lo, deferred_stack_check->entry()); |  | 
|  4676     EnsureSpaceForLazyDeopt(); |  | 
|  4677     __ bind(instr->done_label()); |  | 
|  4678     deferred_stack_check->SetExit(instr->done_label()); |  | 
|  4679     RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |  | 
|  4680     // Don't record a deoptimization index for the safepoint here. |  | 
|  4681     // This will be done explicitly when emitting call and the safepoint in |  | 
|  4682     // the deferred code. |  | 
|  4683   } |  | 
|  4684 } |  4668 } | 
|  4685  |  4669  | 
|  4686  |  4670  | 
|  4687 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |  4671 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 
|  4688   // This is a pseudo-instruction that ensures that the environment here is |  4672   // This is a pseudo-instruction that ensures that the environment here is | 
|  4689   // properly registered for deoptimization and records the assembler's PC |  4673   // properly registered for deoptimization and records the assembler's PC | 
|  4690   // offset. |  4674   // offset. | 
|  4691   LEnvironment* environment = instr->environment(); |  4675   LEnvironment* environment = instr->environment(); | 
|  4692   environment->SetSpilledRegisters(instr->SpilledRegisterArray(), |  4676   environment->SetSpilledRegisters(instr->SpilledRegisterArray(), | 
|  4693                                    instr->SpilledDoubleRegisterArray()); |  4677                                    instr->SpilledDoubleRegisterArray()); | 
|  4694  |  4678  | 
|  4695   // If the environment were already registered, we would have no way of |  4679   // If the environment were already registered, we would have no way of | 
|  4696   // backpatching it with the spill slot operands. |  4680   // backpatching it with the spill slot operands. | 
|  4697   ASSERT(!environment->HasBeenRegistered()); |  4681   ASSERT(!environment->HasBeenRegistered()); | 
|  4698   RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |  4682   RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 
|  4699   ASSERT(osr_pc_offset_ == -1); |  4683   ASSERT(osr_pc_offset_ == -1); | 
|  4700   osr_pc_offset_ = masm()->pc_offset(); |  4684   osr_pc_offset_ = masm()->pc_offset(); | 
|  4701 } |  4685 } | 
|  4702  |  4686  | 
|  4703  |  4687  | 
|  4704  |  4688  | 
|  4705  |  4689  | 
|  4706 #undef __ |  4690 #undef __ | 
|  4707  |  4691  | 
|  4708 } }  // namespace v8::internal |  4692 } }  // namespace v8::internal | 
| OLD | NEW |