Chromium Code Reviews| Index: runtime/vm/intermediate_language.h |
| =================================================================== |
| --- runtime/vm/intermediate_language.h (revision 5205) |
| +++ runtime/vm/intermediate_language.h (working copy) |
| @@ -35,6 +35,7 @@ |
| // | StoreStaticField <Field> <Value> |
| // | BooleanNegate <Value> |
| // | InstanceOf <Value> <Type> |
| +// | AllocateObject <ConstructorCallNode> |
| // |
| // <Value> ::= |
| // Temp <int> |
| @@ -65,7 +66,8 @@ |
| M(LoadStaticField, LoadStaticFieldComp) \ |
| M(StoreStaticField, StoreStaticFieldComp) \ |
| M(BooleanNegate, BooleanNegateComp) \ |
| - M(InstanceOf, InstanceOfComp) |
| + M(InstanceOf, InstanceOfComp) \ |
| + M(AllocateObject, AllocateObjectComp) |
| #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; |
| @@ -127,16 +129,16 @@ |
| class ConstantVal: public Value { |
| public: |
| - explicit ConstantVal(const Instance& instance) : instance_(instance) { |
| - ASSERT(instance.IsZoneHandle()); |
| + explicit ConstantVal(const Object& value) : value_(value) { |
| + ASSERT(value.IsZoneHandle()); |
|
srdjan
2012/03/09 02:37:47
This is needed in order to pass types as arguments
|
| } |
| DECLARE_VALUE(Constant) |
| - const Instance& instance() const { return instance_; } |
| + const Object& value() const { return value_; } |
| private: |
| - const Instance& instance_; |
| + const Object& value_; |
| DISALLOW_COPY_AND_ASSIGN(ConstantVal); |
| }; |
| @@ -227,21 +229,32 @@ |
| class StaticCallComp : public Computation { |
| public: |
| - StaticCallComp(StaticCallNode* node, ZoneGrowableArray<Value*>* arguments) |
| - : ast_node_(*node), arguments_(arguments) { } |
| + StaticCallComp(intptr_t token_index, |
| + const Function& function, |
| + const Array& argument_names, |
| + ZoneGrowableArray<Value*>* arguments) |
| + : token_index_(token_index), |
| + function_(function), |
| + argument_names_(argument_names), |
| + arguments_(arguments) { |
| + ASSERT(function.IsZoneHandle()); |
| + ASSERT(argument_names.IsZoneHandle()); |
| + } |
| DECLARE_COMPUTATION(StaticCall) |
| // 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(); } |
| + const Function& function() const { return function_; } |
| + const Array& argument_names() const { return argument_names_; } |
| + intptr_t token_index() const { return token_index_; } |
| int ArgumentCount() const { return arguments_->length(); } |
| Value* ArgumentAt(int index) const { return (*arguments_)[index]; } |
| private: |
| - const StaticCallNode& ast_node_; |
| + const intptr_t token_index_; |
| + const Function& function_; |
| + const Array& argument_names_; |
| ZoneGrowableArray<Value*>* arguments_; |
| DISALLOW_COPY_AND_ASSIGN(StaticCallComp); |
| @@ -510,6 +523,22 @@ |
| }; |
| +class AllocateObjectComp : public Computation { |
| + public: |
| + explicit AllocateObjectComp(ConstructorCallNode* node) : ast_node_(*node) {} |
|
srdjan
2012/03/09 02:37:47
Will add two Values: type arguments and instantiat
srdjan
2012/03/09 22:40:48
Changed opinion: adding an array of values (lebgth
|
| + |
| + DECLARE_COMPUTATION(AllocateObjectComp) |
| + |
| + const Function& constructor() const { return ast_node_.constructor(); } |
| + intptr_t token_index() const { return ast_node_.token_index(); } |
| + |
| + private: |
| + const ConstructorCallNode& ast_node_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AllocateObjectComp); |
| +}; |
| + |
| + |
| #undef DECLARE_COMPUTATION |