Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 8775002: Simplify stack check instruction in Crankshaft. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4536 matching lines...) Expand 10 before | Expand all | Expand 10 after
4547 class DeferredStackCheck: public LDeferredCode { 4547 class DeferredStackCheck: public LDeferredCode {
4548 public: 4548 public:
4549 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) 4549 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr)
4550 : LDeferredCode(codegen), instr_(instr) { } 4550 : LDeferredCode(codegen), instr_(instr) { }
4551 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } 4551 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); }
4552 virtual LInstruction* instr() { return instr_; } 4552 virtual LInstruction* instr() { return instr_; }
4553 private: 4553 private:
4554 LStackCheck* instr_; 4554 LStackCheck* instr_;
4555 }; 4555 };
4556 4556
4557 DeferredStackCheck* deferred_stack_check =
4558 new DeferredStackCheck(this, instr);
4559 ExternalReference stack_limit =
4560 ExternalReference::address_of_stack_limit(isolate());
4561 __ cmp(esp, Operand::StaticVariable(stack_limit));
4562 __ j(below, deferred_stack_check->entry());
4563 EnsureSpaceForLazyDeopt();
4564 __ bind(instr->done_label());
4565 deferred_stack_check->SetExit(instr->done_label());
4566 // There is no LLazyBailout instruction for stack-checks. We have to
4567 // prepare for lazy deoptimization explicitly here.
4557 ASSERT(instr->HasEnvironment()); 4568 ASSERT(instr->HasEnvironment());
4558 LEnvironment* env = instr->environment(); 4569 LEnvironment* env = instr->environment();
4559 // There is no LLazyBailout instruction for stack-checks. We have to 4570 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
4560 // prepare for lazy deoptimization explicitly here. 4571 // Don't record a deoptimization index for the safepoint here.
4561 if (instr->hydrogen()->is_function_entry()) { 4572 // This will be done explicitly when emitting call and the safepoint in
4562 // Perform stack overflow check. 4573 // the deferred code.
4563 Label done;
4564 ExternalReference stack_limit =
4565 ExternalReference::address_of_stack_limit(isolate());
4566 __ cmp(esp, Operand::StaticVariable(stack_limit));
4567 __ j(above_equal, &done, Label::kNear);
4568
4569 ASSERT(instr->context()->IsRegister());
4570 ASSERT(ToRegister(instr->context()).is(esi));
4571 StackCheckStub stub;
4572 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4573 EnsureSpaceForLazyDeopt();
4574 __ bind(&done);
4575 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
4576 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
4577 } else {
4578 ASSERT(instr->hydrogen()->is_backwards_branch());
4579 // Perform stack overflow check if this goto needs it before jumping.
4580 DeferredStackCheck* deferred_stack_check =
4581 new DeferredStackCheck(this, instr);
4582 ExternalReference stack_limit =
4583 ExternalReference::address_of_stack_limit(isolate());
4584 __ cmp(esp, Operand::StaticVariable(stack_limit));
4585 __ j(below, deferred_stack_check->entry());
4586 EnsureSpaceForLazyDeopt();
4587 __ bind(instr->done_label());
4588 deferred_stack_check->SetExit(instr->done_label());
4589 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
4590 // Don't record a deoptimization index for the safepoint here.
4591 // This will be done explicitly when emitting call and the safepoint in
4592 // the deferred code.
4593 }
4594 } 4574 }
4595 4575
4596 4576
4597 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 4577 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
4598 // This is a pseudo-instruction that ensures that the environment here is 4578 // This is a pseudo-instruction that ensures that the environment here is
4599 // properly registered for deoptimization and records the assembler's PC 4579 // properly registered for deoptimization and records the assembler's PC
4600 // offset. 4580 // offset.
4601 LEnvironment* environment = instr->environment(); 4581 LEnvironment* environment = instr->environment();
4602 environment->SetSpilledRegisters(instr->SpilledRegisterArray(), 4582 environment->SetSpilledRegisters(instr->SpilledRegisterArray(),
4603 instr->SpilledDoubleRegisterArray()); 4583 instr->SpilledDoubleRegisterArray());
(...skipping 27 matching lines...) Expand all
4631 this, pointers, Safepoint::kLazyDeopt); 4611 this, pointers, Safepoint::kLazyDeopt);
4632 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4612 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4633 } 4613 }
4634 4614
4635 4615
4636 #undef __ 4616 #undef __
4637 4617
4638 } } // namespace v8::internal 4618 } } // namespace v8::internal
4639 4619
4640 #endif // V8_TARGET_ARCH_IA32 4620 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698