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

Unified Diff: src/virtual-frame-ia32.cc

Issue 16512: Experimental: begin using the register allocator across entering and... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: '' Created 11 years, 11 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
« src/virtual-frame-ia32.h ('K') | « src/virtual-frame-ia32.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/virtual-frame-ia32.cc
===================================================================
--- src/virtual-frame-ia32.cc (revision 1026)
+++ src/virtual-frame-ia32.cc (working copy)
@@ -590,11 +590,10 @@
frame_pointer_ = stack_pointer_;
__ mov(ebp, Operand(esp));
- // Store the context in the frame. The context is kept in esi, so the
- // register reference is not owned by the frame (ie, the frame is not free
- // to spill it). This is implemented by making the in-frame value be
- // memory.
- EmitPush(esi);
+ // Store the context in the frame. The context is kept in esi and a
+ // copy is stored in the frame. The external reference to esi
+ // remains in addition to the cached copy in the frame.
+ Push(esi);
// Store the function in the frame. The frame owns the register reference
// now (ie, it can keep it in edi or spill it later).
@@ -681,6 +680,38 @@
}
+void VirtualFrame::SaveContextRegister() {
+ FrameElement current = elements_[context_index()];
+ ASSERT(current.is_register() || current.is_memory());
+ if (!current.is_register() || !current.reg().is(esi)) {
+ if (current.is_register()) {
+ Unuse(current.reg());
+ }
+ Use(esi);
+ elements_[context_index()] =
+ FrameElement::RegisterElement(esi, FrameElement::NOT_SYNCED);
+ }
+}
+
+
+void VirtualFrame::RestoreContextRegister() {
+ FrameElement current = elements_[context_index()];
+ ASSERT(current.is_register() || current.is_memory());
+ if (current.is_register() && !current.reg().is(esi)) {
+ Unuse(current.reg());
+ Use(esi);
+ __ mov(esi, current.reg());
+ elements_[context_index()] =
+ FrameElement::RegisterElement(esi, FrameElement::NOT_SYNCED);
+ } else if (current.is_memory()) {
+ Use(esi);
+ __ mov(esi, Operand(ebp, fp_relative(context_index())));
+ elements_[context_index()] =
+ FrameElement::RegisterElement(esi, FrameElement::SYNCED);
+ }
+}
+
+
void VirtualFrame::LoadFrameSlotAt(int index) {
ASSERT(index >= 0);
ASSERT(index < elements_.length());
@@ -806,17 +837,25 @@
}
-void VirtualFrame::CallRuntime(Runtime::Function* f, int frame_arg_count) {
+Result VirtualFrame::CallRuntime(Runtime::Function* f,
+ int frame_arg_count) {
ASSERT(cgen_->HasValidEntryRegisters());
PrepareForCall(frame_arg_count);
__ CallRuntime(f, frame_arg_count);
+ Result result = cgen_->allocator()->Allocate(eax);
+ ASSERT(result.is_valid());
+ return result;
}
-void VirtualFrame::CallRuntime(Runtime::FunctionId id, int frame_arg_count) {
+Result VirtualFrame::CallRuntime(Runtime::FunctionId id,
+ int frame_arg_count) {
ASSERT(cgen_->HasValidEntryRegisters());
PrepareForCall(frame_arg_count);
__ CallRuntime(id, frame_arg_count);
+ Result result = cgen_->allocator()->Allocate(eax);
+ ASSERT(result.is_valid());
+ return result;
}
« src/virtual-frame-ia32.h ('K') | « src/virtual-frame-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698