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

Unified Diff: runtime/vm/intermediate_language.h

Issue 9564006: Implement StaticCall and InstanceCall in the new code generator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
« runtime/vm/flow_graph_builder.cc ('K') | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.h
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index c9143b675b8a5a115e9ab764e6c85805a0959b3e..5e088caee53975becd256cc78417294228af9d00 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -6,6 +6,7 @@
#define VM_INTERMEDIATE_LANGUAGE_H_
#include "vm/allocation.h"
+#include "vm/ast.h"
#include "vm/growable_array.h"
#include "vm/handles_impl.h"
#include "vm/object.h"
@@ -17,16 +18,18 @@ class LocalVariable;
// Computations and values.
//
-// <Computation> ::= <Value>
-// | AssertAssignable <Value> <AbstractType>
-// | InstanceCall <cstring> <Value> ...
-// | StaticCall <Function> <Value> ...
-// | LoadLocal <LocalVariable>
-// | StoreLocal <LocalVariable> <Value>
-// | StrictCompare <Token::kind> <Value> <Value>
+// <Computation> ::=
+// <Value>
+// | AssertAssignable <Value> <AbstractType>
+// | InstanceCall <AstNode> <String> <Value> ...
+// | StaticCall <StaticCallNode> <Value> ...
+// | LoadLocal <LocalVariable>
+// | StoreLocal <LocalVariable> <Value>
+// | StrictCompare <Token::kind> <Value> <Value>
//
-// <Value> ::= Temp <int>
-// | Constant <Instance>
+// <Value> ::=
+// Temp <int>
+// | Constant <Instance>
// M is a two argument macro. It is applied to each concrete value's
// typename and classname.
@@ -142,20 +145,39 @@ class AssertAssignableComp : public Computation {
class InstanceCallComp : public Computation {
public:
- InstanceCallComp(const char* name, ZoneGrowableArray<Value*>* arguments)
- : name_(name), arguments_(arguments) {
+ InstanceCallComp(AstNode* node,
+ const String& function_name,
+ ZoneGrowableArray<Value*>* arguments,
+ const Array& argument_names,
+ intptr_t checked_argument_count)
+ : ast_node_(*node),
+ function_name_(function_name),
+ arguments_(arguments),
+ argument_names_(argument_names),
+ checked_argument_count_(checked_argument_count) {
+ ASSERT(function_name.IsZoneHandle());
ASSERT(!arguments->is_empty());
+ ASSERT(argument_names.IsZoneHandle());
}
DECLARE_COMPUTATION(InstanceCall)
- const char* name() const { return name_; }
+ // Accessors forwarded to the AST node.
+ intptr_t node_id() const { return ast_node_.id(); }
+ intptr_t token_index() const { return ast_node_.token_index(); }
+
+ const String& function_name() const { return function_name_; }
int ArgumentCount() const { return arguments_->length(); }
Value* ArgumentAt(int index) const { return (*arguments_)[index]; }
+ const Array& argument_names() const { return argument_names_; }
+ intptr_t checked_argument_count() const { return checked_argument_count_; }
private:
- const char* name_;
- ZoneGrowableArray<Value*>* arguments_;
+ const AstNode& ast_node_;
+ const String& function_name_;
+ ZoneGrowableArray<Value*>* const arguments_;
+ const Array& argument_names_;
+ const intptr_t checked_argument_count_;
DISALLOW_COPY_AND_ASSIGN(InstanceCallComp);
};
@@ -185,19 +207,21 @@ class StrictCompareComp : public Computation {
class StaticCallComp : public Computation {
public:
- StaticCallComp(const Function& function, ZoneGrowableArray<Value*>* arguments)
- : function_(function), arguments_(arguments) {
- ASSERT(function.IsZoneHandle());
- }
+ StaticCallComp(StaticCallNode* node, ZoneGrowableArray<Value*>* arguments)
+ : ast_node_(*node), arguments_(arguments) { }
DECLARE_COMPUTATION(StaticCall)
- const Function& function() const { return function_; }
+ // Accessors forwarded to the AST node.
+ const Function& function() const { return ast_node_.function(); }
+ const Array& argument_names() const { return ast_node_.arguments()->names(); }
+ intptr_t token_index() const { return ast_node_.token_index(); }
+
int ArgumentCount() const { return arguments_->length(); }
Value* ArgumentAt(int index) const { return (*arguments_)[index]; }
private:
- const Function& function_;
+ const StaticCallNode& ast_node_;
ZoneGrowableArray<Value*>* arguments_;
DISALLOW_COPY_AND_ASSIGN(StaticCallComp);
« runtime/vm/flow_graph_builder.cc ('K') | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698