| 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 RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define RUNTIME_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 2518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2529 DECLARE_INSTRUCTION(UnboxedConstant) | 2529 DECLARE_INSTRUCTION(UnboxedConstant) |
| 2530 | 2530 |
| 2531 private: | 2531 private: |
| 2532 const Representation representation_; | 2532 const Representation representation_; |
| 2533 uword constant_address_; // Either NULL or points to the untagged constant. | 2533 uword constant_address_; // Either NULL or points to the untagged constant. |
| 2534 | 2534 |
| 2535 DISALLOW_COPY_AND_ASSIGN(UnboxedConstantInstr); | 2535 DISALLOW_COPY_AND_ASSIGN(UnboxedConstantInstr); |
| 2536 }; | 2536 }; |
| 2537 | 2537 |
| 2538 | 2538 |
| 2539 class AssertAssignableInstr : public TemplateDefinition<2, Throws, Pure> { | 2539 class AssertAssignableInstr : public TemplateDefinition<3, Throws, Pure> { |
| 2540 public: | 2540 public: |
| 2541 AssertAssignableInstr(TokenPosition token_pos, | 2541 AssertAssignableInstr(TokenPosition token_pos, |
| 2542 Value* value, | 2542 Value* value, |
| 2543 Value* instantiator_type_arguments, | 2543 Value* instantiator_type_arguments, |
| 2544 Value* function_type_arguments, | 2544 Value* function_type_arguments, |
| 2545 const AbstractType& dst_type, | 2545 const AbstractType& dst_type, |
| 2546 const String& dst_name, | 2546 const String& dst_name, |
| 2547 intptr_t deopt_id) | 2547 intptr_t deopt_id) |
| 2548 : TemplateDefinition(deopt_id), | 2548 : TemplateDefinition(deopt_id), |
| 2549 token_pos_(token_pos), | 2549 token_pos_(token_pos), |
| 2550 dst_type_(AbstractType::ZoneHandle(dst_type.raw())), | 2550 dst_type_(AbstractType::ZoneHandle(dst_type.raw())), |
| 2551 dst_name_(dst_name) { | 2551 dst_name_(dst_name) { |
| 2552 ASSERT(!dst_type.IsNull()); | 2552 ASSERT(!dst_type.IsNull()); |
| 2553 ASSERT(!dst_type.IsTypeRef()); | 2553 ASSERT(!dst_type.IsTypeRef()); |
| 2554 ASSERT(!dst_name.IsNull()); | 2554 ASSERT(!dst_name.IsNull()); |
| 2555 SetInputAt(0, value); | 2555 SetInputAt(0, value); |
| 2556 SetInputAt(1, instantiator_type_arguments); | 2556 SetInputAt(1, instantiator_type_arguments); |
| 2557 ASSERT(function_type_arguments == NULL); // TODO(regis): Implement. | 2557 SetInputAt(2, function_type_arguments); |
| 2558 } | 2558 } |
| 2559 | 2559 |
| 2560 DECLARE_INSTRUCTION(AssertAssignable) | 2560 DECLARE_INSTRUCTION(AssertAssignable) |
| 2561 virtual CompileType ComputeType() const; | 2561 virtual CompileType ComputeType() const; |
| 2562 virtual bool RecomputeType(); | 2562 virtual bool RecomputeType(); |
| 2563 | 2563 |
| 2564 Value* value() const { return inputs_[0]; } | 2564 Value* value() const { return inputs_[0]; } |
| 2565 Value* instantiator_type_arguments() const { return inputs_[1]; } | 2565 Value* instantiator_type_arguments() const { return inputs_[1]; } |
| 2566 Value* function_type_arguments() const { return inputs_[2]; } |
| 2566 | 2567 |
| 2567 virtual TokenPosition token_pos() const { return token_pos_; } | 2568 virtual TokenPosition token_pos() const { return token_pos_; } |
| 2568 const AbstractType& dst_type() const { return dst_type_; } | 2569 const AbstractType& dst_type() const { return dst_type_; } |
| 2569 void set_dst_type(const AbstractType& dst_type) { | 2570 void set_dst_type(const AbstractType& dst_type) { |
| 2570 ASSERT(!dst_type.IsTypeRef()); | 2571 ASSERT(!dst_type.IsTypeRef()); |
| 2571 dst_type_ = dst_type.raw(); | 2572 dst_type_ = dst_type.raw(); |
| 2572 } | 2573 } |
| 2573 const String& dst_name() const { return dst_name_; } | 2574 const String& dst_name() const { return dst_name_; } |
| 2574 | 2575 |
| 2575 virtual bool ComputeCanDeoptimize() const { return true; } | 2576 virtual bool ComputeCanDeoptimize() const { return true; } |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3964 | 3965 |
| 3965 virtual EffectSet Effects() const { return EffectSet::None(); } | 3966 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 3966 | 3967 |
| 3967 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 3968 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
| 3968 | 3969 |
| 3969 private: | 3970 private: |
| 3970 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); | 3971 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); |
| 3971 }; | 3972 }; |
| 3972 | 3973 |
| 3973 | 3974 |
| 3974 class InstanceOfInstr : public TemplateDefinition<2, Throws> { | 3975 class InstanceOfInstr : public TemplateDefinition<3, Throws> { |
| 3975 public: | 3976 public: |
| 3976 InstanceOfInstr(TokenPosition token_pos, | 3977 InstanceOfInstr(TokenPosition token_pos, |
| 3977 Value* value, | 3978 Value* value, |
| 3978 Value* instantiator_type_arguments, | 3979 Value* instantiator_type_arguments, |
| 3979 Value* function_type_arguments, | 3980 Value* function_type_arguments, |
| 3980 const AbstractType& type, | 3981 const AbstractType& type, |
| 3981 intptr_t deopt_id) | 3982 intptr_t deopt_id) |
| 3982 : TemplateDefinition(deopt_id), token_pos_(token_pos), type_(type) { | 3983 : TemplateDefinition(deopt_id), token_pos_(token_pos), type_(type) { |
| 3983 ASSERT(!type.IsNull()); | 3984 ASSERT(!type.IsNull()); |
| 3984 SetInputAt(0, value); | 3985 SetInputAt(0, value); |
| 3985 SetInputAt(1, instantiator_type_arguments); | 3986 SetInputAt(1, instantiator_type_arguments); |
| 3986 ASSERT(function_type_arguments == NULL); // TODO(regis): Implement. | 3987 SetInputAt(2, function_type_arguments); |
| 3987 } | 3988 } |
| 3988 | 3989 |
| 3989 DECLARE_INSTRUCTION(InstanceOf) | 3990 DECLARE_INSTRUCTION(InstanceOf) |
| 3990 virtual CompileType ComputeType() const; | 3991 virtual CompileType ComputeType() const; |
| 3991 | 3992 |
| 3992 Value* value() const { return inputs_[0]; } | 3993 Value* value() const { return inputs_[0]; } |
| 3993 Value* instantiator_type_arguments() const { return inputs_[1]; } | 3994 Value* instantiator_type_arguments() const { return inputs_[1]; } |
| 3995 Value* function_type_arguments() const { return inputs_[2]; } |
| 3994 | 3996 |
| 3995 const AbstractType& type() const { return type_; } | 3997 const AbstractType& type() const { return type_; } |
| 3996 virtual TokenPosition token_pos() const { return token_pos_; } | 3998 virtual TokenPosition token_pos() const { return token_pos_; } |
| 3997 | 3999 |
| 3998 virtual bool ComputeCanDeoptimize() const { return true; } | 4000 virtual bool ComputeCanDeoptimize() const { return true; } |
| 3999 | 4001 |
| 4000 virtual EffectSet Effects() const { return EffectSet::None(); } | 4002 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 4001 | 4003 |
| 4002 PRINT_OPERANDS_TO_SUPPORT | 4004 PRINT_OPERANDS_TO_SUPPORT |
| 4003 | 4005 |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4391 bool immutable_; | 4393 bool immutable_; |
| 4392 | 4394 |
| 4393 MethodRecognizer::Kind recognized_kind_; | 4395 MethodRecognizer::Kind recognized_kind_; |
| 4394 const Field* field_; | 4396 const Field* field_; |
| 4395 const TokenPosition token_pos_; | 4397 const TokenPosition token_pos_; |
| 4396 | 4398 |
| 4397 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); | 4399 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); |
| 4398 }; | 4400 }; |
| 4399 | 4401 |
| 4400 | 4402 |
| 4401 class InstantiateTypeInstr : public TemplateDefinition<1, Throws> { | 4403 class InstantiateTypeInstr : public TemplateDefinition<2, Throws> { |
| 4402 public: | 4404 public: |
| 4403 InstantiateTypeInstr(TokenPosition token_pos, | 4405 InstantiateTypeInstr(TokenPosition token_pos, |
| 4404 const AbstractType& type, | 4406 const AbstractType& type, |
| 4405 Value* instantiator_type_arguments, | 4407 Value* instantiator_type_arguments, |
| 4406 Value* function_type_arguments) | 4408 Value* function_type_arguments) |
| 4407 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 4409 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
| 4408 token_pos_(token_pos), | 4410 token_pos_(token_pos), |
| 4409 type_(type) { | 4411 type_(type) { |
| 4410 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); | 4412 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); |
| 4411 ASSERT(function_type_arguments == NULL); // TODO(regis): Implement. | |
| 4412 SetInputAt(0, instantiator_type_arguments); | 4413 SetInputAt(0, instantiator_type_arguments); |
| 4414 SetInputAt(1, function_type_arguments); |
| 4413 } | 4415 } |
| 4414 | 4416 |
| 4415 DECLARE_INSTRUCTION(InstantiateType) | 4417 DECLARE_INSTRUCTION(InstantiateType) |
| 4416 | 4418 |
| 4417 Value* instantiator_type_arguments() const { return inputs_[0]; } | 4419 Value* instantiator_type_arguments() const { return inputs_[0]; } |
| 4420 Value* function_type_arguments() const { return inputs_[1]; } |
| 4418 const AbstractType& type() const { return type_; } | 4421 const AbstractType& type() const { return type_; } |
| 4419 virtual TokenPosition token_pos() const { return token_pos_; } | 4422 virtual TokenPosition token_pos() const { return token_pos_; } |
| 4420 | 4423 |
| 4421 virtual bool ComputeCanDeoptimize() const { return true; } | 4424 virtual bool ComputeCanDeoptimize() const { return true; } |
| 4422 | 4425 |
| 4423 virtual EffectSet Effects() const { return EffectSet::None(); } | 4426 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 4424 | 4427 |
| 4425 PRINT_OPERANDS_TO_SUPPORT | 4428 PRINT_OPERANDS_TO_SUPPORT |
| 4426 | 4429 |
| 4427 private: | 4430 private: |
| 4428 const TokenPosition token_pos_; | 4431 const TokenPosition token_pos_; |
| 4429 const AbstractType& type_; | 4432 const AbstractType& type_; |
| 4430 | 4433 |
| 4431 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); | 4434 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); |
| 4432 }; | 4435 }; |
| 4433 | 4436 |
| 4434 | 4437 |
| 4435 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1, Throws> { | 4438 class InstantiateTypeArgumentsInstr : public TemplateDefinition<2, Throws> { |
| 4436 public: | 4439 public: |
| 4437 InstantiateTypeArgumentsInstr(TokenPosition token_pos, | 4440 InstantiateTypeArgumentsInstr(TokenPosition token_pos, |
| 4438 const TypeArguments& type_arguments, | 4441 const TypeArguments& type_arguments, |
| 4439 const Class& instantiator_class, | 4442 const Class& instantiator_class, |
| 4440 Value* instantiator_type_arguments, | 4443 Value* instantiator_type_arguments, |
| 4441 Value* function_type_arguments) | 4444 Value* function_type_arguments) |
| 4442 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 4445 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
| 4443 token_pos_(token_pos), | 4446 token_pos_(token_pos), |
| 4444 type_arguments_(type_arguments), | 4447 type_arguments_(type_arguments), |
| 4445 instantiator_class_(instantiator_class) { | 4448 instantiator_class_(instantiator_class) { |
| 4446 ASSERT(type_arguments.IsZoneHandle()); | 4449 ASSERT(type_arguments.IsZoneHandle()); |
| 4447 ASSERT(function_type_arguments == NULL); // TODO(regis): Implement. | |
| 4448 SetInputAt(0, instantiator_type_arguments); | 4450 SetInputAt(0, instantiator_type_arguments); |
| 4451 SetInputAt(1, function_type_arguments); |
| 4449 } | 4452 } |
| 4450 | 4453 |
| 4451 DECLARE_INSTRUCTION(InstantiateTypeArguments) | 4454 DECLARE_INSTRUCTION(InstantiateTypeArguments) |
| 4452 | 4455 |
| 4453 Value* instantiator_type_arguments() const { return inputs_[0]; } | 4456 Value* instantiator_type_arguments() const { return inputs_[0]; } |
| 4457 Value* function_type_arguments() const { return inputs_[1]; } |
| 4454 const TypeArguments& type_arguments() const { return type_arguments_; } | 4458 const TypeArguments& type_arguments() const { return type_arguments_; } |
| 4455 const Class& instantiator_class() const { return instantiator_class_; } | 4459 const Class& instantiator_class() const { return instantiator_class_; } |
| 4456 virtual TokenPosition token_pos() const { return token_pos_; } | 4460 virtual TokenPosition token_pos() const { return token_pos_; } |
| 4457 | 4461 |
| 4458 virtual bool ComputeCanDeoptimize() const { return true; } | 4462 virtual bool ComputeCanDeoptimize() const { return true; } |
| 4459 | 4463 |
| 4460 virtual EffectSet Effects() const { return EffectSet::None(); } | 4464 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 4461 | 4465 |
| 4462 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 4466 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
| 4463 | 4467 |
| (...skipping 3579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8043 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8047 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
| 8044 UNIMPLEMENTED(); \ | 8048 UNIMPLEMENTED(); \ |
| 8045 return NULL; \ | 8049 return NULL; \ |
| 8046 } \ | 8050 } \ |
| 8047 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8051 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 8048 | 8052 |
| 8049 | 8053 |
| 8050 } // namespace dart | 8054 } // namespace dart |
| 8051 | 8055 |
| 8052 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 8056 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |