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

Unified Diff: runtime/vm/intermediate_language.h

Issue 10382234: Introduce locations based code generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: addressed Srdjan comments Created 8 years, 7 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: runtime/vm/intermediate_language.h
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index e5bd8d199788445cfba6b9f1a5d31cd08788015f..90cb4010f9b78073c43c46c99a434c9408426e2b 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -14,8 +14,10 @@
namespace dart {
class BitVector;
+class FlowGraphCompiler;
class FlowGraphVisitor;
class LocalVariable;
+class LocationSummary;
// M is a two argument macro. It is applied to each concrete value's
// typename and classname.
@@ -108,6 +110,19 @@ class Computation : public ZoneAllocated {
virtual void PrintTo(BufferFormatter* f) const;
virtual void PrintOperandsTo(BufferFormatter* f) const;
+ // Returns structure describing location constraints required
+ // to emit native code for this computation.
+ virtual LocationSummary* locs() const {
+ // TODO(vegorov): This should be pure virtual method.
+ // However we are temporary using NULL for instructions that
+ // were not converted to the location based code generation yet.
+ return NULL;
+ }
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
+ UNIMPLEMENTED();
+ }
+
private:
friend class Instruction;
static intptr_t GetNextCid(Isolate* isolate) {
@@ -143,15 +158,25 @@ class EmbeddedArray {
EmbeddedArray() : elements_() { }
intptr_t length() const { return N; }
+
const T& operator[](intptr_t i) const {
ASSERT(i < length());
return elements_[i];
}
+
T& operator[](intptr_t i) {
ASSERT(i < length());
return elements_[i];
}
+ const T& At(intptr_t i) const {
+ return (*this)[i];
+ }
+
+ void SetAt(intptr_t i, const T& val) {
+ (*this)[i] = val;
+ }
srdjan 2012/05/21 16:05:22 Maybe we should get rid of operators (some other C
+
private:
T elements_[N];
};
@@ -449,6 +474,7 @@ class StrictCompareComp : public TemplateComputation<2> {
ASSERT((kind_ == Token::kEQ_STRICT) || (kind_ == Token::kNE_STRICT));
inputs_[0] = left;
inputs_[1] = right;
+ location_summary_ = MakeLocationSummary();
}
DECLARE_COMPUTATION(StrictCompare)
@@ -459,9 +485,20 @@ class StrictCompareComp : public TemplateComputation<2> {
virtual void PrintOperandsTo(BufferFormatter* f) const;
+ virtual LocationSummary* locs() const {
+ return location_summary_;
+ }
+
+ // Platform specific summary factory for this instruction.
+ LocationSummary* MakeLocationSummary();
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler);
+
private:
const Token::Kind kind_;
+ LocationSummary* location_summary_;
+
DISALLOW_COPY_AND_ASSIGN(StrictCompareComp);
};
@@ -1363,6 +1400,19 @@ FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK)
return AbstractType::null();
}
+ // Returns structure describing location constraints required
+ // to emit native code for this instruction.
+ virtual LocationSummary* locs() const {
+ // TODO(vegorov): This should be pure virtual method.
+ // However we are temporary using NULL for instructions that
+ // were not converted to the location based code generation yet.
+ return NULL;
+ }
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
+ UNIMPLEMENTED();
+ }
+
private:
intptr_t cid_;
ICData* ic_data_;
@@ -1560,6 +1610,7 @@ class DoInstr : public Instruction {
virtual Instruction* StraightLineSuccessor() const {
return successor_;
}
+
virtual void SetSuccessor(Instruction* instr) {
ASSERT(successor_ == NULL);
successor_ = instr;
@@ -1567,6 +1618,14 @@ class DoInstr : public Instruction {
virtual void RecordAssignedVars(BitVector* assigned_vars);
+ virtual LocationSummary* locs() const {
+ return computation()->locs();
+ }
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
+ computation()->EmitNativeCode(compiler);
+ }
+
private:
Computation* computation_;
Instruction* successor_;
@@ -1603,6 +1662,7 @@ class BindInstr : public Definition {
virtual Instruction* StraightLineSuccessor() const {
return successor_;
}
+
virtual void SetSuccessor(Instruction* instr) {
ASSERT(successor_ == NULL);
successor_ = instr;
@@ -1615,6 +1675,12 @@ class BindInstr : public Definition {
virtual void RecordAssignedVars(BitVector* assigned_vars);
+ virtual LocationSummary* locs() const {
+ return computation()->locs();
+ }
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler);
+
private:
Computation* computation_;
Instruction* successor_;

Powered by Google App Engine
This is Rietveld 408576698