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

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

Issue 15037: Experimental: use the Result class to manage the lifetime of registers... (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
Index: src/virtual-frame-ia32.h
===================================================================
--- src/virtual-frame-ia32.h (revision 999)
+++ src/virtual-frame-ia32.h (working copy)
@@ -33,68 +33,6 @@
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.
- 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() {
- if (is_register()) {
- Unuse();
- }
- }
-
- void Unuse();
-
- bool is_register() const { return type() == REGISTER; }
- bool is_constant() const { return type() == CONSTANT; }
- bool is_valid() const { return type() != INVALID; }
-
- Register reg() const {
- ASSERT(type() == REGISTER);
- return data_.reg_;
- }
-
- Handle<Object> handle() const {
- ASSERT(type() == CONSTANT);
- return Handle<Object>(data_.handle_);
- }
-
- // Change a result to a register result. If the result is not already
- // in a register, allocate a register from the code generator, and emit
- // code to move the value into that register.
- void ToRegister();
- private:
- enum Type {
- REGISTER,
- CONSTANT,
- INVALID
- };
-
- Type type_;
-
- Type type() const { return type_; }
-
- union {
- Register reg_;
- Object** handle_;
- } data_;
-
- CodeGenerator* cgen_;
-};
-
-
// -------------------------------------------------------------------------
// Virtual frame elements
//
@@ -401,6 +339,10 @@
void Push(Register reg);
void Push(Handle<Object> value);
+ // Pushing a result invalidates it (its contents become owned by the
+ // frame).
+ void Push(Result* result);
+
#ifdef DEBUG
bool IsSpilled();
#endif

Powered by Google App Engine
This is Rietveld 408576698