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

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

Issue 13201: A first stab at using the top of stack as the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: '' Created 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « 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 947)
+++ src/virtual-frame-ia32.cc (working copy)
@@ -35,7 +35,28 @@
#define __ masm_->
+
// -------------------------------------------------------------------------
+// Result implementation.
+
+
+Result::Result(Register reg, CodeGenerator* cgen)
+ : type_(REGISTER),
+ cgen_(cgen) {
+ data_.reg_ = reg;
+ ASSERT(!reg().is(no_reg));
+ cgen_->allocator()->Use(reg);
+}
+
+
+void Result::Unuse() {
+ ASSERT(!reg().is(no_reg));
+ cgen_->allocator()->Unuse(reg());
+ data_.reg_ = no_reg;
+}
+
+
+// -------------------------------------------------------------------------
// VirtualFrame implementation.
// On entry to a function, the virtual frame already contains the receiver,
@@ -594,6 +615,47 @@
void VirtualFrame::Drop() { Drop(1); }
+/*
+We need comparison with literal to work.
+It will get Result, is register or constant.
+Pop gives it this, from register, constant, memory, or
+reference to slot.
+
+In comparison to literal, we need register case to work.
+We need non-smi stub to exit and return with a non-spilled frame.
+*/
+
+
+Result VirtualFrame::Pop() {
+ FrameElement popped = elements_.RemoveLast();
+ bool pop_needed = (stack_pointer_ == elements_.length());
+
+ if (popped.is_constant()) {
+ if (pop_needed) {
+ stack_pointer_--;
+ __ add(Operand(esp), Immediate(kPointerSize));
+ }
+ return Result(popped.handle(), cgen_);
+ } else if (popped.is_register()) {
+ Unuse(popped.reg());
+ if (pop_needed) {
+ stack_pointer_--;
+ __ add(Operand(esp), Immediate(kPointerSize));
+ }
+ return Result(popped.reg(), cgen_);
+ } else {
+ ASSERT(popped.is_memory());
+ Register temp = cgen_->allocator()->Allocate();
+ ASSERT(!temp.is(no_reg));
+ ASSERT(pop_needed);
+ stack_pointer_--;
+ __ pop(temp);
+ // The register temp is double counted, by Allocate and Result(temp).
+ cgen_->allocator()->Unuse(temp);
+ return Result(temp, cgen_);
+ }
+}
+
void VirtualFrame::EmitPop(Register reg) {
ASSERT(stack_pointer_ == elements_.length() - 1);
stack_pointer_--;
« no previous file with comments | « src/virtual-frame-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698