| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 M(InstanceOf) \ | 631 M(InstanceOf) \ |
| 632 M(CreateArray) \ | 632 M(CreateArray) \ |
| 633 M(CreateClosure) \ | 633 M(CreateClosure) \ |
| 634 M(AllocateObject) \ | 634 M(AllocateObject) \ |
| 635 M(LoadField) \ | 635 M(LoadField) \ |
| 636 M(StoreVMField) \ | 636 M(StoreVMField) \ |
| 637 M(LoadUntagged) \ | 637 M(LoadUntagged) \ |
| 638 M(LoadClassId) \ | 638 M(LoadClassId) \ |
| 639 M(InstantiateType) \ | 639 M(InstantiateType) \ |
| 640 M(InstantiateTypeArguments) \ | 640 M(InstantiateTypeArguments) \ |
| 641 M(ExtractConstructorTypeArguments) \ | |
| 642 M(ExtractConstructorInstantiator) \ | |
| 643 M(AllocateContext) \ | 641 M(AllocateContext) \ |
| 644 M(CloneContext) \ | 642 M(CloneContext) \ |
| 645 M(BinarySmiOp) \ | 643 M(BinarySmiOp) \ |
| 646 M(UnarySmiOp) \ | 644 M(UnarySmiOp) \ |
| 647 M(UnaryDoubleOp) \ | 645 M(UnaryDoubleOp) \ |
| 648 M(CheckStackOverflow) \ | 646 M(CheckStackOverflow) \ |
| 649 M(SmiToDouble) \ | 647 M(SmiToDouble) \ |
| 650 M(DoubleToInteger) \ | 648 M(DoubleToInteger) \ |
| 651 M(DoubleToSmi) \ | 649 M(DoubleToSmi) \ |
| 652 M(DoubleToDouble) \ | 650 M(DoubleToDouble) \ |
| (...skipping 3279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3932 AllocateObjectInstr(intptr_t token_pos, | 3930 AllocateObjectInstr(intptr_t token_pos, |
| 3933 const Class& cls, | 3931 const Class& cls, |
| 3934 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 3932 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
| 3935 : token_pos_(token_pos), | 3933 : token_pos_(token_pos), |
| 3936 cls_(cls), | 3934 cls_(cls), |
| 3937 arguments_(arguments), | 3935 arguments_(arguments), |
| 3938 identity_(kUnknown), | 3936 identity_(kUnknown), |
| 3939 closure_function_(Function::ZoneHandle()), | 3937 closure_function_(Function::ZoneHandle()), |
| 3940 context_field_(Field::ZoneHandle()) { | 3938 context_field_(Field::ZoneHandle()) { |
| 3941 // Either no arguments or one type-argument and one instantiator. | 3939 // Either no arguments or one type-argument and one instantiator. |
| 3942 ASSERT(arguments->is_empty() || (arguments->length() == 2)); | 3940 ASSERT(arguments->is_empty() || (arguments->length() == 1)); |
| 3943 } | 3941 } |
| 3944 | 3942 |
| 3945 DECLARE_INSTRUCTION(AllocateObject) | 3943 DECLARE_INSTRUCTION(AllocateObject) |
| 3946 virtual CompileType ComputeType() const; | 3944 virtual CompileType ComputeType() const; |
| 3947 | 3945 |
| 3948 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 3946 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 3949 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 3947 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| 3950 return (*arguments_)[index]; | 3948 return (*arguments_)[index]; |
| 3951 } | 3949 } |
| 3952 | 3950 |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4381 intptr_t token_pos() const { return token_pos_; } | 4379 intptr_t token_pos() const { return token_pos_; } |
| 4382 | 4380 |
| 4383 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4381 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 4384 | 4382 |
| 4385 virtual bool CanDeoptimize() const { return true; } | 4383 virtual bool CanDeoptimize() const { return true; } |
| 4386 | 4384 |
| 4387 virtual EffectSet Effects() const { return EffectSet::None(); } | 4385 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 4388 | 4386 |
| 4389 virtual bool MayThrow() const { return true; } | 4387 virtual bool MayThrow() const { return true; } |
| 4390 | 4388 |
| 4389 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
| 4390 |
| 4391 private: | 4391 private: |
| 4392 const intptr_t token_pos_; | 4392 const intptr_t token_pos_; |
| 4393 const TypeArguments& type_arguments_; | 4393 const TypeArguments& type_arguments_; |
| 4394 const Class& instantiator_class_; | 4394 const Class& instantiator_class_; |
| 4395 | 4395 |
| 4396 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr); | 4396 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr); |
| 4397 }; | 4397 }; |
| 4398 | 4398 |
| 4399 | 4399 |
| 4400 class ExtractConstructorTypeArgumentsInstr : public TemplateDefinition<1> { | |
| 4401 public: | |
| 4402 ExtractConstructorTypeArgumentsInstr( | |
| 4403 intptr_t token_pos, | |
| 4404 const TypeArguments& type_arguments, | |
| 4405 const Class& instantiator_class, | |
| 4406 Value* instantiator) | |
| 4407 : token_pos_(token_pos), | |
| 4408 type_arguments_(type_arguments), | |
| 4409 instantiator_class_(instantiator_class) { | |
| 4410 SetInputAt(0, instantiator); | |
| 4411 } | |
| 4412 | |
| 4413 DECLARE_INSTRUCTION(ExtractConstructorTypeArguments) | |
| 4414 | |
| 4415 Value* instantiator() const { return inputs_[0]; } | |
| 4416 const TypeArguments& type_arguments() const { | |
| 4417 return type_arguments_; | |
| 4418 } | |
| 4419 const Class& instantiator_class() const { return instantiator_class_; } | |
| 4420 intptr_t token_pos() const { return token_pos_; } | |
| 4421 | |
| 4422 virtual void PrintOperandsTo(BufferFormatter* f) const; | |
| 4423 | |
| 4424 virtual bool CanDeoptimize() const { return false; } | |
| 4425 | |
| 4426 virtual EffectSet Effects() const { return EffectSet::None(); } | |
| 4427 | |
| 4428 virtual bool MayThrow() const { return false; } | |
| 4429 | |
| 4430 private: | |
| 4431 const intptr_t token_pos_; | |
| 4432 const TypeArguments& type_arguments_; | |
| 4433 const Class& instantiator_class_; | |
| 4434 | |
| 4435 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsInstr); | |
| 4436 }; | |
| 4437 | |
| 4438 | |
| 4439 class ExtractConstructorInstantiatorInstr : public TemplateDefinition<1> { | |
| 4440 public: | |
| 4441 ExtractConstructorInstantiatorInstr(ConstructorCallNode* ast_node, | |
| 4442 const Class& instantiator_class, | |
| 4443 Value* instantiator) | |
| 4444 : ast_node_(*ast_node), instantiator_class_(instantiator_class) { | |
| 4445 SetInputAt(0, instantiator); | |
| 4446 } | |
| 4447 | |
| 4448 DECLARE_INSTRUCTION(ExtractConstructorInstantiator) | |
| 4449 | |
| 4450 Value* instantiator() const { return inputs_[0]; } | |
| 4451 const TypeArguments& type_arguments() const { | |
| 4452 return ast_node_.type_arguments(); | |
| 4453 } | |
| 4454 const Function& constructor() const { return ast_node_.constructor(); } | |
| 4455 const Class& instantiator_class() const { return instantiator_class_; } | |
| 4456 intptr_t token_pos() const { return ast_node_.token_pos(); } | |
| 4457 | |
| 4458 virtual bool CanDeoptimize() const { return false; } | |
| 4459 | |
| 4460 virtual EffectSet Effects() const { return EffectSet::None(); } | |
| 4461 | |
| 4462 virtual bool MayThrow() const { return false; } | |
| 4463 | |
| 4464 private: | |
| 4465 const ConstructorCallNode& ast_node_; | |
| 4466 const Class& instantiator_class_; | |
| 4467 | |
| 4468 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorInstr); | |
| 4469 }; | |
| 4470 | |
| 4471 | |
| 4472 class AllocateContextInstr : public TemplateDefinition<0> { | 4400 class AllocateContextInstr : public TemplateDefinition<0> { |
| 4473 public: | 4401 public: |
| 4474 AllocateContextInstr(intptr_t token_pos, | 4402 AllocateContextInstr(intptr_t token_pos, |
| 4475 intptr_t num_context_variables) | 4403 intptr_t num_context_variables) |
| 4476 : token_pos_(token_pos), | 4404 : token_pos_(token_pos), |
| 4477 num_context_variables_(num_context_variables) {} | 4405 num_context_variables_(num_context_variables) {} |
| 4478 | 4406 |
| 4479 DECLARE_INSTRUCTION(AllocateContext) | 4407 DECLARE_INSTRUCTION(AllocateContext) |
| 4480 virtual CompileType ComputeType() const; | 4408 virtual CompileType ComputeType() const; |
| 4481 | 4409 |
| (...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7096 ForwardInstructionIterator* current_iterator_; | 7024 ForwardInstructionIterator* current_iterator_; |
| 7097 | 7025 |
| 7098 private: | 7026 private: |
| 7099 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7027 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 7100 }; | 7028 }; |
| 7101 | 7029 |
| 7102 | 7030 |
| 7103 } // namespace dart | 7031 } // namespace dart |
| 7104 | 7032 |
| 7105 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7033 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |