| Index: src/ia32/lithium-codegen-ia32.cc
|
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
|
| index 93ed5533fbf07d4d49f2c92bf9d2767814369aee..60252379f5e0470fb1c287877b7b47f81b1e85a7 100644
|
| --- a/src/ia32/lithium-codegen-ia32.cc
|
| +++ b/src/ia32/lithium-codegen-ia32.cc
|
| @@ -1423,45 +1423,17 @@ void LCodeGen::DoBranch(LBranch* instr) {
|
| }
|
|
|
|
|
| -void LCodeGen::EmitGoto(int block, LDeferredCode* deferred_stack_check) {
|
| +void LCodeGen::EmitGoto(int block) {
|
| block = chunk_->LookupDestination(block);
|
| int next_block = GetNextEmittedBlock(current_block_);
|
| if (block != next_block) {
|
| - // Perform stack overflow check if this goto needs it before jumping.
|
| - if (deferred_stack_check != NULL) {
|
| - ExternalReference stack_limit =
|
| - ExternalReference::address_of_stack_limit(isolate());
|
| - __ cmp(esp, Operand::StaticVariable(stack_limit));
|
| - __ j(above_equal, chunk_->GetAssemblyLabel(block));
|
| - __ jmp(deferred_stack_check->entry());
|
| - deferred_stack_check->SetExit(chunk_->GetAssemblyLabel(block));
|
| - } else {
|
| - __ jmp(chunk_->GetAssemblyLabel(block));
|
| - }
|
| + __ jmp(chunk_->GetAssemblyLabel(block));
|
| }
|
| }
|
|
|
|
|
| -void LCodeGen::DoDeferredStackCheck(LGoto* instr) {
|
| - PushSafepointRegistersScope scope(this);
|
| - CallRuntimeFromDeferred(Runtime::kStackGuard, 0, instr);
|
| -}
|
| -
|
| void LCodeGen::DoGoto(LGoto* instr) {
|
| - class DeferredStackCheck: public LDeferredCode {
|
| - public:
|
| - DeferredStackCheck(LCodeGen* codegen, LGoto* instr)
|
| - : LDeferredCode(codegen), instr_(instr) { }
|
| - virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); }
|
| - private:
|
| - LGoto* instr_;
|
| - };
|
| -
|
| - DeferredStackCheck* deferred = NULL;
|
| - if (instr->include_stack_check()) {
|
| - deferred = new DeferredStackCheck(this, instr);
|
| - }
|
| - EmitGoto(instr->block_id(), deferred);
|
| + EmitGoto(instr->block_id());
|
| }
|
|
|
|
|
| @@ -4435,17 +4407,45 @@ void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
|
| }
|
|
|
|
|
| +void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) {
|
| + PushSafepointRegistersScope scope(this);
|
| + CallRuntimeFromDeferred(Runtime::kStackGuard, 0, instr);
|
| +}
|
| +
|
| +
|
| void LCodeGen::DoStackCheck(LStackCheck* instr) {
|
| - // Perform stack overflow check.
|
| - Label done;
|
| - ExternalReference stack_limit =
|
| - ExternalReference::address_of_stack_limit(isolate());
|
| - __ cmp(esp, Operand::StaticVariable(stack_limit));
|
| - __ j(above_equal, &done, Label::kNear);
|
| + class DeferredStackCheck: public LDeferredCode {
|
| + public:
|
| + DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr)
|
| + : LDeferredCode(codegen), instr_(instr) { }
|
| + virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); }
|
| + private:
|
| + LStackCheck* instr_;
|
| + };
|
|
|
| - StackCheckStub stub;
|
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT);
|
| - __ bind(&done);
|
| + if (instr->hydrogen()->is_function_entry()) {
|
| + // Perform stack overflow check.
|
| + Label done;
|
| + ExternalReference stack_limit =
|
| + ExternalReference::address_of_stack_limit(isolate());
|
| + __ cmp(esp, Operand::StaticVariable(stack_limit));
|
| + __ j(above_equal, &done, Label::kNear);
|
| +
|
| + StackCheckStub stub;
|
| + CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT);
|
| + __ bind(&done);
|
| + } else {
|
| + ASSERT(instr->hydrogen()->is_backwards_branch());
|
| + // Perform stack overflow check if this goto needs it before jumping.
|
| + DeferredStackCheck* deferred_stack_check =
|
| + new DeferredStackCheck(this, instr);
|
| + ExternalReference stack_limit =
|
| + ExternalReference::address_of_stack_limit(isolate());
|
| + __ cmp(esp, Operand::StaticVariable(stack_limit));
|
| + __ j(below, deferred_stack_check->entry());
|
| + __ bind(instr->done_label());
|
| + deferred_stack_check->SetExit(instr->done_label());
|
| + }
|
| }
|
|
|
|
|
|
|