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

Unified Diff: src/codegen.cc

Issue 118226: Simplify the processing of deferred code in the code generator. Our... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codegen.h ('k') | src/codegen-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen.cc
===================================================================
--- src/codegen.cc (revision 2099)
+++ src/codegen.cc (working copy)
@@ -45,33 +45,54 @@
CodeGenerator* CodeGeneratorScope::top_ = NULL;
-DeferredCode::DeferredCode() : exit_(JumpTarget::BIDIRECTIONAL) {
- MacroAssembler* masm = cgen()->masm();
- statement_position_ = masm->current_statement_position();
- position_ = masm->current_position();
+DeferredCode::DeferredCode()
+ : masm_(CodeGeneratorScope::Current()->masm()),
+ statement_position_(masm_->current_statement_position()),
+ position_(masm_->current_position()) {
ASSERT(statement_position_ != RelocInfo::kNoPosition);
ASSERT(position_ != RelocInfo::kNoPosition);
- cgen()->AddDeferred(this);
+ CodeGeneratorScope::Current()->AddDeferred(this);
#ifdef DEBUG
comment_ = "";
#endif
+
+ // Copy the register locations from the code generator's frame.
+ // These are the registers that will be spilled on entry to the
+ // deferred code and restored on exit.
+ VirtualFrame* frame = CodeGeneratorScope::Current()->frame();
+ int sp_offset = frame->fp_relative(frame->stack_pointer_);
+ for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) {
+ int loc = frame->register_location(i);
+ if (loc == VirtualFrame::kIllegalIndex) {
+ registers_[i] = kIgnore;
+ } else if (frame->elements_[loc].is_synced()) {
+ // Needs to be restored on exit but not saved on entry.
+ registers_[i] = frame->fp_relative(loc) | kSyncedFlag;
+ } else {
+ int offset = frame->fp_relative(loc);
+ registers_[i] = (offset < sp_offset) ? kPush : offset;
+ }
+ }
}
void CodeGenerator::ProcessDeferred() {
while (!deferred_.is_empty()) {
DeferredCode* code = deferred_.RemoveLast();
- MacroAssembler* masm = code->cgen()->masm();
+ ASSERT(masm_ == code->masm());
// Record position of deferred code stub.
- masm->RecordStatementPosition(code->statement_position());
+ masm_->RecordStatementPosition(code->statement_position());
if (code->position() != RelocInfo::kNoPosition) {
- masm->RecordPosition(code->position());
+ masm_->RecordPosition(code->position());
}
// Generate the code.
- Comment cmnt(masm, code->comment());
+ Comment cmnt(masm_, code->comment());
+ masm_->bind(code->entry_label());
+ code->SaveRegisters();
code->Generate();
- ASSERT(code->enter()->is_bound());
+ code->RestoreRegisters();
+ masm_->jmp(code->exit_label());
}
}
« no previous file with comments | « src/codegen.h ('k') | src/codegen-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698