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

Unified Diff: src/cfg.h

Issue 165129: Added support for property loads to the CFG builder and fast-mode (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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/arm/cfg-arm.cc ('k') | src/cfg.cc » ('j') | src/x64/cfg-x64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cfg.h
===================================================================
--- src/cfg.h (revision 2651)
+++ src/cfg.h (working copy)
@@ -43,10 +43,11 @@
// Instructions are described by the following grammar.
//
// <Instruction> ::=
-// MoveInstr <Location> <Value>
-// | BinaryOpInstr <Location> Token::Value <Value> <Value>
-// | ReturnInstr Nowhere <Value>
-// | PositionInstr <Int>
+// Move <Location> <Value>
+// | PropRef <Location> <Value> <Value>
+// | BinaryOp <Location> Token::Value <Value> <Value>
+// | Return Nowhere <Value>
+// | Position <Int>
//
// Values are trivial expressions:
//
@@ -131,16 +132,14 @@
// Predicates:
+ virtual bool is_temporary() { return false; }
+ virtual bool is_slot() { return false; }
+ virtual bool is_constant() { return false; }
+
// True if the value is a temporary allocated to the stack in
// fast-compilation mode.
virtual bool is_on_stack() { return false; }
- // True if the value is a compiler-generated temporary location.
- virtual bool is_temporary() { return false; }
-
- // True if the value is a slot location.
- virtual bool is_slot() { return false; }
-
// Support for fast-compilation mode:
// Move the value into a register.
@@ -163,8 +162,18 @@
public:
explicit Constant(Handle<Object> handle) : handle_(handle) {}
- virtual ~Constant() {}
+ // Cast accessor.
+ static Constant* cast(Value* value) {
+ ASSERT(value->is_constant());
+ return reinterpret_cast<Constant*>(value);
+ }
+ // Accessors.
+ Handle<Object> handle() { return handle_; }
+
+ // Predicates.
+ bool is_constant() { return true; }
+
// Support for fast-compilation mode.
void Get(MacroAssembler* masm, Register reg);
void Push(MacroAssembler* masm);
@@ -410,18 +419,43 @@
};
+// Load a property from a receiver, leaving the result in a location.
William Hesse 2009/08/07 12:50:26 I like PropertyLoad better. A PropertyRef to me m
Kevin Millikin (Chromium) 2009/08/07 13:25:33 Going with PropLoad.
+class PropRefInstr : public Instruction {
+ public:
+ PropRefInstr(Location* loc, Value* object, Value* key)
+ : Instruction(loc), object_(object), key_(key) {
+ }
+
+ // Accessors.
+ Value* object() { return object_; }
+ Value* key() { return key_; }
+
+ // Support for fast-compilation mode.
+ void Compile(MacroAssembler* masm);
+ void FastAllocate(TempLocation* temp);
+
+#ifdef DEBUG
+ void Print();
+#endif
+
+ private:
+ Value* object_;
+ Value* key_;
+};
+
+
// Perform a (non-short-circuited) binary operation on a pair of values,
// leaving the result in a location.
class BinaryOpInstr : public Instruction {
public:
- BinaryOpInstr(Location* loc, Token::Value op, Value* value0, Value* value1)
- : Instruction(loc), op_(op), value0_(value0), value1_(value1) {
+ BinaryOpInstr(Location* loc, Token::Value op, Value* left, Value* right)
+ : Instruction(loc), op_(op), left_(left), right_(right) {
}
// Accessors.
Token::Value op() { return op_; }
- Value* value0() { return value0_; }
- Value* value1() { return value1_; }
+ Value* left() { return left_; }
+ Value* right() { return right_; }
// Support for fast-compilation mode.
void Compile(MacroAssembler* masm);
@@ -433,8 +467,8 @@
private:
Token::Value op_;
- Value* value0_;
- Value* value1_;
+ Value* left_;
+ Value* right_;
};
@@ -449,6 +483,9 @@
virtual ~ReturnInstr() {}
+ // Accessors.
+ Value* value() { return value_; }
+
// Support for fast-compilation mode.
void Compile(MacroAssembler* masm);
void FastAllocate(TempLocation* temp);
« no previous file with comments | « src/arm/cfg-arm.cc ('k') | src/cfg.cc » ('j') | src/x64/cfg-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698