Chromium Code Reviews| Index: runtime/vm/kernel.h |
| diff --git a/runtime/vm/kernel.h b/runtime/vm/kernel.h |
| index 81e5dcc1bc76c6a4d1499623034de9733f98ef66..06f9c5db4a0dbc0a8c671b40a5862b32a1960a0a 100644 |
| --- a/runtime/vm/kernel.h |
| +++ b/runtime/vm/kernel.h |
| @@ -21,7 +21,8 @@ |
| M(VoidType) \ |
| M(InterfaceType) \ |
| M(FunctionType) \ |
| - M(TypeParameterType) |
| + M(TypeParameterType) \ |
| + M(VectorType) |
| #define KERNEL_TREE_NODES_DO(M) \ |
| M(Library) \ |
| @@ -79,6 +80,11 @@ |
| M(AwaitExpression) \ |
| M(FunctionExpression) \ |
| M(Let) \ |
| + M(VectorCreation) \ |
| + M(VectorGet) \ |
| + M(VectorSet) \ |
| + M(VectorCopy) \ |
| + M(ClosureCreation) \ |
| M(Statement) \ |
| M(InvalidStatement) \ |
| M(ExpressionStatement) \ |
| @@ -1928,6 +1934,158 @@ class Let : public Expression { |
| }; |
| +class VectorCreation : public Expression { |
| + public: |
| + static VectorCreation* ReadFrom(Reader* reader); |
| + |
| + virtual ~VectorCreation(); |
| + |
| + DEFINE_CASTING_OPERATIONS(VectorCreation); |
| + |
| + virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
| + virtual void VisitChildren(Visitor* visitor); |
| + |
| + int64_t value() { return value_; } |
| + TokenPosition position() { return position_; } |
| + TokenPosition end_position() { return end_position_; } |
| + |
| + private: |
| + VectorCreation() |
| + : position_(TokenPosition::kNoSource), |
| + end_position_(TokenPosition::kNoSource) {} |
| + |
| + int64_t value_; |
|
Kevin Millikin (Google)
2017/04/04 11:29:33
Use intptr_t, here and elsewhere.
Dmitry Stefantsov
2017/04/04 12:51:13
Done.
|
| + TokenPosition position_; |
|
Kevin Millikin (Google)
2017/04/04 11:29:34
This does not need a token position or an end toke
Dmitry Stefantsov
2017/04/04 12:51:13
No, I guess not. Thanks! Done.
|
| + TokenPosition end_position_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(VectorCreation); |
| +}; |
| + |
| + |
| +class VectorGet : public Expression { |
| + public: |
| + static VectorGet* ReadFrom(Reader* reader); |
| + |
| + virtual ~VectorGet(); |
| + |
| + DEFINE_CASTING_OPERATIONS(VectorGet); |
| + |
| + virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
| + virtual void VisitChildren(Visitor* visitor); |
| + |
| + Expression* vector_expression() { return vector_expression_; } |
| + int64_t index() { return index_; } |
| + TokenPosition position() { return position_; } |
| + TokenPosition end_position() { return end_position_; } |
| + |
| + private: |
| + VectorGet() |
| + : position_(TokenPosition::kNoSource), |
| + end_position_(TokenPosition::kNoSource) {} |
| + |
| + Child<Expression> vector_expression_; |
|
Kevin Millikin (Google)
2017/04/04 11:29:33
Is it the case that this is always a VariableGet,
Dmitry Stefantsov
2017/04/04 12:51:13
Actually, it's not always VariableGet. In case of
|
| + int64_t index_; |
|
Kevin Millikin (Google)
2017/04/04 11:29:34
intptr_t
Dmitry Stefantsov
2017/04/04 12:51:13
Done.
|
| + TokenPosition position_; |
|
Kevin Millikin (Google)
2017/04/04 11:29:34
We don't need these token positions.
Dmitry Stefantsov
2017/04/04 12:51:13
I guess we may want these, because they replace va
|
| + TokenPosition end_position_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(VectorGet); |
| +}; |
| + |
| + |
| +class VectorSet : public Expression { |
| + public: |
| + static VectorSet* ReadFrom(Reader* reader); |
| + |
| + virtual ~VectorSet(); |
| + |
| + DEFINE_CASTING_OPERATIONS(VectorSet); |
| + |
| + virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
| + virtual void VisitChildren(Visitor* visitor); |
| + |
| + Expression* vector_expression() { return vector_expression_; } |
| + int64_t index() { return index_; } |
| + Expression* value() { return value_; } |
| + TokenPosition position() { return position_; } |
| + TokenPosition end_position() { return end_position_; } |
| + |
| + private: |
| + VectorSet() |
| + : position_(TokenPosition::kNoSource), |
| + end_position_(TokenPosition::kNoSource) {} |
| + |
| + Child<Expression> vector_expression_; |
| + int64_t index_; |
|
Kevin Millikin (Google)
2017/04/04 11:29:33
intptr_t
Dmitry Stefantsov
2017/04/04 12:51:13
Done.
|
| + Child<Expression> value_; |
| + TokenPosition position_; |
|
Kevin Millikin (Google)
2017/04/04 11:29:34
I guess this will need a position and possibly two
Dmitry Stefantsov
2017/04/04 12:51:13
Agree. Done.
|
| + TokenPosition end_position_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(VectorSet); |
| +}; |
| + |
| + |
| +class VectorCopy : public Expression { |
| + public: |
| + static VectorCopy* ReadFrom(Reader* reader); |
| + |
| + virtual ~VectorCopy(); |
| + |
| + DEFINE_CASTING_OPERATIONS(VectorCopy); |
| + |
| + virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
| + virtual void VisitChildren(Visitor* visitor); |
| + |
| + Expression* vector_expression() { return vector_expression_; } |
| + TokenPosition position() { return position_; } |
| + TokenPosition end_position() { return end_position_; } |
| + |
| + private: |
| + VectorCopy() |
| + : position_(TokenPosition::kNoSource), |
| + end_position_(TokenPosition::kNoSource) {} |
| + |
| + Child<Expression> vector_expression_; |
| + TokenPosition position_; |
|
Kevin Millikin (Google)
2017/04/04 11:29:34
We shouldn't need these positions.
Dmitry Stefantsov
2017/04/04 12:51:13
Agree. Done.
|
| + TokenPosition end_position_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(VectorCopy); |
| +}; |
| + |
| + |
| +class ClosureCreation : public Expression { |
| + public: |
| + static ClosureCreation* ReadFrom(Reader* reader); |
| + |
| + virtual ~ClosureCreation(); |
| + |
| + DEFINE_CASTING_OPERATIONS(ClosureCreation); |
| + |
| + virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
| + virtual void VisitChildren(Visitor* visitor); |
| + |
| + CanonicalName* top_level_function_reference() { |
|
Kevin Millikin (Google)
2017/04/04 11:29:33
For consistency, we don't usually put _reference i
Dmitry Stefantsov
2017/04/04 12:51:13
Somehow I've missed this convention. Thanks! Fixed
|
| + return top_level_function_reference_; |
| + } |
| + Expression* context_vector() { return context_vector_; } |
| + FunctionType* function_type() { return function_type_; } |
| + TokenPosition position() { return position_; } |
| + TokenPosition end_position() { return end_position_; } |
| + |
| + private: |
| + ClosureCreation() |
| + : position_(TokenPosition::kNoSource), |
| + end_position_(TokenPosition::kNoSource) {} |
| + |
| + Ref<CanonicalName> top_level_function_reference_; // Procedure. |
| + Child<Expression> context_vector_; |
| + Child<FunctionType> function_type_; |
| + TokenPosition position_; |
|
Kevin Millikin (Google)
2017/04/04 11:29:34
I don't think we need these positions.
Dmitry Stefantsov
2017/04/04 12:51:13
Done.
|
| + TokenPosition end_position_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ClosureCreation); |
| +}; |
| + |
| + |
| class Statement : public TreeNode { |
| public: |
| static Statement* ReadFrom(Reader* reader); |
| @@ -2703,6 +2861,24 @@ class TypeParameterType : public DartType { |
| }; |
| +class VectorType : public DartType { |
| + public: |
| + static VectorType* ReadFrom(Reader* reader); |
| + |
| + virtual ~VectorType(); |
| + |
| + DEFINE_CASTING_OPERATIONS(VectorType); |
| + |
| + virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
| + virtual void VisitChildren(Visitor* visitor); |
| + |
| + private: |
| + VectorType() {} |
| + |
| + DISALLOW_COPY_AND_ASSIGN(VectorType); |
| +}; |
| + |
| + |
| class TypeParameter : public TreeNode { |
| public: |
| TypeParameter* ReadFrom(Reader* reader); |
| @@ -2876,6 +3052,17 @@ class ExpressionVisitor { |
| VisitDefaultBasicLiteral(node); |
| } |
| virtual void VisitLet(Let* node) { VisitDefaultExpression(node); } |
| + virtual void VisitVectorCreation(VectorCreation* node) { |
| + VisitDefaultExpression(node); |
| + } |
| + virtual void VisitVectorGet(VectorGet* node) { VisitDefaultExpression(node); } |
| + virtual void VisitVectorSet(VectorSet* node) { VisitDefaultExpression(node); } |
| + virtual void VisitVectorCopy(VectorCopy* node) { |
| + VisitDefaultExpression(node); |
| + } |
| + virtual void VisitClosureCreation(ClosureCreation* node) { |
| + VisitDefaultExpression(node); |
| + } |
| }; |
| @@ -3008,6 +3195,7 @@ class DartTypeVisitor { |
| virtual void VisitTypeParameterType(TypeParameterType* node) { |
| VisitDefaultDartType(node); |
| } |
| + virtual void VisitVectorType(VectorType* node) { VisitDefaultDartType(node); } |
| }; |
| @@ -3153,7 +3341,6 @@ kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, |
| intptr_t buffer_length); |
| - |
| } // namespace dart |
| #endif // !defined(DART_PRECOMPILED_RUNTIME) |