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

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

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 | « no previous file | src/virtual-frame-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/virtual-frame-ia32.h
===================================================================
--- src/virtual-frame-ia32.h (revision 947)
+++ src/virtual-frame-ia32.h (working copy)
@@ -33,6 +33,61 @@
namespace v8 { namespace internal {
+
+// The code generator's view of a frame element, when it wants to use it.
+//
+// A Result can be a register or a constant.
+class Result BASE_EMBEDDED {
+ public:
+ // Construct a register Result.
+ explicit Result(Register reg, CodeGenerator* cgen);
+
+ // Construct a Result whose value is a compile-time constant.
+ Result(Handle<Object> value, CodeGenerator * cgen) :
+ type_(CONSTANT),
+ cgen_(cgen) {
+ data_.handle_ = value.location();
+ }
+
+ ~Result() {
+ // We have called Unuse() before Result goes out of scope.
+ ASSERT(reg_.is(no_reg));
+ }
+
+ void Unuse();
+
+ bool is_register() const { return type() == REGISTER; }
+ bool is_constant() const { return type() == CONSTANT; }
+
+ Register reg() const {
+ ASSERT(type() == REGISTER);
+ return data_.reg_;
+ }
+
+ Handle<Object> handle() const {
+ ASSERT(type() == CONSTANT);
+ return Handle<Object>(data_.handle_);
+ }
+
+ private:
+ enum Type { REGISTER, CONSTANT };
+
+ Type type_;
+
+ Type type() const { return type_; }
+
+ union {
+ Register reg_;
+ Object** handle_;
+ } data_;
+
+ CodeGenerator* cgen_;
+};
+
+
+// A result in a register just means that the value can be read from the register
+
+
// -------------------------------------------------------------------------
// Virtual frame elements
//
@@ -251,6 +306,10 @@
// Drop one element.
void Drop();
+ // Pop an element from the top of the expression stack.
+ // Returns a Result, which may be a constant or a register.
+ Result Pop();
+
// Pop and save an element from the top of the expression stack and emit a
// corresponding pop instruction.
void EmitPop(Register reg);
« no previous file with comments | « no previous file | src/virtual-frame-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698