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

Unified Diff: vm/intermediate_language.h

Issue 10825035: Add an explicit push-argument instruction to the IL. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « vm/il_printer.cc ('k') | vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/intermediate_language.h
===================================================================
--- vm/intermediate_language.h (revision 9930)
+++ vm/intermediate_language.h (working copy)
@@ -113,6 +113,7 @@
class BufferFormatter;
class ComparisonComp;
class Instruction;
+class PushArgumentInstr;
class Value;
class Computation : public ZoneAllocated {
@@ -459,7 +460,7 @@
public:
ClosureCallComp(ClosureCallNode* node,
intptr_t try_index,
- ZoneGrowableArray<Value*>* arguments)
+ ZoneGrowableArray<PushArgumentInstr*>* arguments)
: ast_node_(*node),
try_index_(try_index),
arguments_(arguments) { }
@@ -471,20 +472,23 @@
intptr_t try_index() const { return try_index_; }
intptr_t ArgumentCount() const { return arguments_->length(); }
- Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; }
+ PushArgumentInstr* ArgumentAt(intptr_t index) const {
+ return (*arguments_)[index];
+ }
- virtual intptr_t InputCount() const;
- virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); }
- virtual void SetInputAt(intptr_t i, Value* value) {
- (*arguments_)[i] = value;
+ virtual intptr_t InputCount() const { return 0; }
+ virtual Value* InputAt(intptr_t i) const {
+ UNREACHABLE();
+ return NULL;
}
+ virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
virtual void PrintOperandsTo(BufferFormatter* f) const;
private:
const ClosureCallNode& ast_node_;
const intptr_t try_index_;
- ZoneGrowableArray<Value*>* arguments_;
+ ZoneGrowableArray<PushArgumentInstr*>* arguments_;
DISALLOW_COPY_AND_ASSIGN(ClosureCallComp);
};
@@ -1235,33 +1239,32 @@
};
-class CreateClosureComp : public TemplateComputation<2> {
+class CreateClosureComp : public TemplateComputation<0> {
public:
CreateClosureComp(ClosureNode* node,
intptr_t try_index,
- Value* type_arguments,
- Value* receiver)
+ ZoneGrowableArray<PushArgumentInstr*>* arguments)
: ast_node_(*node),
- try_index_(try_index) {
- ASSERT(type_arguments != NULL);
- ASSERT(receiver != NULL);
- inputs_[0] = type_arguments;
- inputs_[1] = receiver;
- }
+ try_index_(try_index),
+ arguments_(arguments) { }
DECLARE_COMPUTATION(CreateClosure)
intptr_t token_pos() const { return ast_node_.token_pos(); }
intptr_t try_index() const { return try_index_; }
const Function& function() const { return ast_node_.function(); }
- Value* type_arguments() const { return inputs_[0]; }
- Value* receiver() const { return inputs_[1]; }
+ intptr_t ArgumentCount() const { return arguments_->length(); }
+ PushArgumentInstr* ArgumentAt(intptr_t index) const {
+ return (*arguments_)[index];
+ }
+
virtual void PrintOperandsTo(BufferFormatter* f) const;
private:
const ClosureNode& ast_node_;
const intptr_t try_index_;
+ ZoneGrowableArray<PushArgumentInstr*>* arguments_;
DISALLOW_COPY_AND_ASSIGN(CreateClosureComp);
};
@@ -1680,6 +1683,7 @@
M(Bind) \
M(Parameter) \
M(ParallelMove) \
+ M(PushArgument) \
M(Return) \
M(Throw) \
M(ReThrow) \
@@ -2223,6 +2227,25 @@
};
+class PushArgumentInstr : public InstructionWithInputs {
+ public:
+ explicit PushArgumentInstr(Value* value) : value_(value) { }
+
+ DECLARE_INSTRUCTION(PushArgument)
+
+ Value* value() const { return value_; }
+
+ virtual LocationSummary* MakeLocationSummary() const;
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler);
+
+ private:
+ Value* value_;
+
+ DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr);
+};
+
+
class ReturnInstr : public InstructionWithInputs {
public:
ReturnInstr(intptr_t token_pos, Value* value)
« no previous file with comments | « vm/il_printer.cc ('k') | vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698