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

Unified Diff: src/x64/lithium-x64.h

Issue 6128008: X64 Crankshaft: Add LTemplatedInstruction and some derived classes to lithium... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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
Index: src/x64/lithium-x64.h
===================================================================
--- src/x64/lithium-x64.h (revision 6249)
+++ src/x64/lithium-x64.h (working copy)
@@ -45,13 +45,23 @@
// Type hierarchy:
//
// LInstruction
+// LDeoptimize
// LGap
+// LLabel
+// LGoto
+// LLazyBailout
+// LOsrEntry
#define LITHIUM_ALL_INSTRUCTION_LIST(V) \
LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
#define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
- V(Gap)
+ V(Deoptimize) \
+ V(Gap) \
+ V(Goto) \
+ V(Label) \
+ V(LazyBailout) \
+ V(OsrEntry)
#define DECLARE_INSTRUCTION(type) \
@@ -80,20 +90,10 @@
: hydrogen_value_(NULL) { }
virtual ~LInstruction() { }
- // Predicates should be generated by macro as in lithium-ia32.h.
- virtual bool IsLabel() const {
- UNIMPLEMENTED();
- return false;
- }
- virtual bool IsOsrEntry() const {
- UNIMPLEMENTED();
- return false;
- }
-
virtual void CompileToNative(LCodeGen* generator) = 0;
virtual const char* Mnemonic() const = 0;
- virtual void PrintTo(StringStream* stream) const;
- virtual void PrintDataTo(StringStream* stream) const { }
+ virtual void PrintTo(StringStream* stream);
+ virtual void PrintDataTo(StringStream* stream) { }
// Declare virtual type testers.
#define DECLARE_DO(type) virtual bool Is##type() const { return false; }
@@ -109,9 +109,7 @@
LPointerMap* pointer_map() const { return pointer_map_.get(); }
bool HasPointerMap() const { return pointer_map_.is_set(); }
- void set_result(LOperand* operand) { result_.set(operand); }
- LOperand* result() const { return result_.get(); }
- bool HasResult() const { return result_.is_set(); }
+ virtual bool HasResult() const = 0;
void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
HValue* hydrogen_value() const { return hydrogen_value_; }
@@ -129,14 +127,38 @@
private:
SetOncePointer<LEnvironment> environment_;
SetOncePointer<LPointerMap> pointer_map_;
- SetOncePointer<LOperand> result_;
HValue* hydrogen_value_;
SetOncePointer<LEnvironment> deoptimization_environment_;
};
-class LGap: public LInstruction {
+template <int Result>
+class LTemplateInstruction: public LInstruction { };
+
+
+template<>
+class LTemplateInstruction<0>: public LInstruction {
+ virtual bool HasResult() const { return false; }
+};
+
+
+template<>
+class LTemplateInstruction<1>: public LInstruction {
public:
+ static LTemplateInstruction<1>* cast(LInstruction* instr) {
+ ASSERT(instr->HasResult());
+ return reinterpret_cast<LTemplateInstruction<1>*>(instr);
+ }
+ void set_result(LOperand* operand) { result_.set(operand); }
+ LOperand* result() const { return result_.get(); }
+ virtual bool HasResult() const { return result_.is_set(); }
+ private:
+ SetOncePointer<LOperand> result_;
+};
+
+
+class LGap: public LTemplateInstruction<0> {
+ public:
explicit LGap(HBasicBlock* block)
: block_(block) {
parallel_moves_[BEFORE] = NULL;
@@ -146,7 +168,7 @@
}
DECLARE_CONCRETE_INSTRUCTION(Gap, "gap")
- virtual void PrintDataTo(StringStream* stream) const;
+ virtual void PrintDataTo(StringStream* stream);
bool IsRedundant() const;
@@ -176,40 +198,80 @@
};
+class LGoto: public LTemplateInstruction<0> {
+ public:
+ LGoto(int block_id, bool include_stack_check = false)
+ : block_id_(block_id), include_stack_check_(include_stack_check) { }
+
+ DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
+ virtual void PrintDataTo(StringStream* stream);
+ virtual bool IsControl() const { return true; }
+
+ int block_id() const { return block_id_; }
+ bool include_stack_check() const { return include_stack_check_; }
+
+ private:
+ int block_id_;
+ bool include_stack_check_;
+};
+
+
+class LLazyBailout: public LTemplateInstruction<0> {
+ public:
+ LLazyBailout() : gap_instructions_size_(0) { }
+
+ DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
+
+ void set_gap_instructions_size(int gap_instructions_size) {
+ gap_instructions_size_ = gap_instructions_size;
+ }
+ int gap_instructions_size() { return gap_instructions_size_; }
+
+ private:
+ int gap_instructions_size_;
+};
+
+
+class LDeoptimize: public LTemplateInstruction<0> {
+ public:
+ DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
+};
+
+
class LLabel: public LGap {
public:
- explicit LLabel(HBasicBlock* block) : LGap(block) { }
+ explicit LLabel(HBasicBlock* block)
+ : LGap(block), replacement_(NULL) { }
+ DECLARE_CONCRETE_INSTRUCTION(Label, "label")
+
+ virtual void PrintDataTo(StringStream* stream);
+
+ int block_id() const { return block()->block_id(); }
+ bool is_loop_header() const { return block()->IsLoopHeader(); }
+ Label* label() { return &label_; }
+ LLabel* replacement() const { return replacement_; }
+ void set_replacement(LLabel* label) { replacement_ = label; }
+ bool HasReplacement() const { return replacement_ != NULL; }
+
private:
Label label_;
LLabel* replacement_;
};
-class LOsrEntry: public LInstruction {
+class LOsrEntry: public LTemplateInstruction<0> {
public:
- // Function could be generated by a macro as in lithium-ia32.h.
- static LOsrEntry* cast(LInstruction* instr) {
- UNIMPLEMENTED();
- return NULL;
- }
+ LOsrEntry();
- LOperand** SpilledRegisterArray() {
- UNIMPLEMENTED();
- return NULL;
- }
- LOperand** SpilledDoubleRegisterArray() {
- UNIMPLEMENTED();
- return NULL;
- }
+ DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
- void MarkSpilledRegister(int allocation_index, LOperand* spill_operand) {
- UNIMPLEMENTED();
- }
+ LOperand** SpilledRegisterArray() { return register_spills_; }
+ LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
+
+ void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
void MarkSpilledDoubleRegister(int allocation_index,
- LOperand* spill_operand) {
- UNIMPLEMENTED();
- }
+ LOperand* spill_operand);
private:
// Arrays of spill slot operands for registers with an assigned spill
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/x64/lithium-x64.cc » ('j') | src/x64/lithium-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698