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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 154393003: Implement eager instantiation and canonicalization of type arguments at run (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 M(LoadIndexed) \ 625 M(LoadIndexed) \
626 M(StoreIndexed) \ 626 M(StoreIndexed) \
627 M(StoreInstanceField) \ 627 M(StoreInstanceField) \
628 M(LoadStaticField) \ 628 M(LoadStaticField) \
629 M(StoreStaticField) \ 629 M(StoreStaticField) \
630 M(BooleanNegate) \ 630 M(BooleanNegate) \
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(AllocateObjectWithBoundsCheck) \
636 M(LoadField) \ 635 M(LoadField) \
637 M(StoreVMField) \ 636 M(StoreVMField) \
638 M(LoadUntagged) \ 637 M(LoadUntagged) \
639 M(LoadClassId) \ 638 M(LoadClassId) \
640 M(InstantiateType) \ 639 M(InstantiateType) \
641 M(InstantiateTypeArguments) \ 640 M(InstantiateTypeArguments) \
642 M(ExtractConstructorTypeArguments) \ 641 M(ExtractConstructorTypeArguments) \
643 M(ExtractConstructorInstantiator) \ 642 M(ExtractConstructorInstantiator) \
644 M(AllocateContext) \ 643 M(AllocateContext) \
645 M(CloneContext) \ 644 M(CloneContext) \
(...skipping 3410 matching lines...) Expand 10 before | Expand all | Expand 10 after
4056 4055
4057 const Class& cls_; 4056 const Class& cls_;
4058 const ZoneGrowableArray<const Field*>& fields_; 4057 const ZoneGrowableArray<const Field*>& fields_;
4059 ZoneGrowableArray<Value*>* values_; 4058 ZoneGrowableArray<Value*>* values_;
4060 Location* locations_; 4059 Location* locations_;
4061 4060
4062 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); 4061 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr);
4063 }; 4062 };
4064 4063
4065 4064
4066 class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<0> {
4067 public:
4068 explicit AllocateObjectWithBoundsCheckInstr(ConstructorCallNode* node)
4069 : ast_node_(*node) {
4070 }
4071
4072 DECLARE_INSTRUCTION(AllocateObjectWithBoundsCheck)
4073
4074 virtual intptr_t ArgumentCount() const { return 4; }
4075
4076 const Function& constructor() const { return ast_node_.constructor(); }
4077 intptr_t token_pos() const { return ast_node_.token_pos(); }
4078
4079 virtual void PrintOperandsTo(BufferFormatter* f) const;
4080
4081 virtual bool CanDeoptimize() const { return true; }
4082
4083 virtual EffectSet Effects() const { return EffectSet::None(); }
4084
4085 virtual bool MayThrow() const { return false; }
4086
4087 private:
4088 const ConstructorCallNode& ast_node_;
4089
4090 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckInstr);
4091 };
4092
4093
4094 class CreateArrayInstr : public TemplateDefinition<2> { 4065 class CreateArrayInstr : public TemplateDefinition<2> {
4095 public: 4066 public:
4096 CreateArrayInstr(intptr_t token_pos, 4067 CreateArrayInstr(intptr_t token_pos,
4097 Value* element_type, 4068 Value* element_type,
4098 Value* num_elements) 4069 Value* num_elements)
4099 : token_pos_(token_pos) { 4070 : token_pos_(token_pos) {
4100 SetInputAt(kElementTypePos, element_type); 4071 SetInputAt(kElementTypePos, element_type);
4101 SetInputAt(kLengthPos, num_elements); 4072 SetInputAt(kLengthPos, num_elements);
4102 } 4073 }
4103 4074
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
4383 const AbstractType& type_; 4354 const AbstractType& type_;
4384 const Class& instantiator_class_; 4355 const Class& instantiator_class_;
4385 4356
4386 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); 4357 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr);
4387 }; 4358 };
4388 4359
4389 4360
4390 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> { 4361 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> {
4391 public: 4362 public:
4392 InstantiateTypeArgumentsInstr(intptr_t token_pos, 4363 InstantiateTypeArgumentsInstr(intptr_t token_pos,
4393 const AbstractTypeArguments& type_arguments, 4364 const TypeArguments& type_arguments,
4394 const Class& instantiator_class, 4365 const Class& instantiator_class,
4395 Value* instantiator) 4366 Value* instantiator)
4396 : token_pos_(token_pos), 4367 : token_pos_(token_pos),
4397 type_arguments_(type_arguments), 4368 type_arguments_(type_arguments),
4398 instantiator_class_(instantiator_class) { 4369 instantiator_class_(instantiator_class) {
4399 ASSERT(type_arguments.IsZoneHandle()); 4370 ASSERT(type_arguments.IsZoneHandle());
4400 SetInputAt(0, instantiator); 4371 SetInputAt(0, instantiator);
4401 } 4372 }
4402 4373
4403 DECLARE_INSTRUCTION(InstantiateTypeArguments) 4374 DECLARE_INSTRUCTION(InstantiateTypeArguments)
4404 4375
4405 Value* instantiator() const { return inputs_[0]; } 4376 Value* instantiator() const { return inputs_[0]; }
4406 const AbstractTypeArguments& type_arguments() const { 4377 const TypeArguments& type_arguments() const {
4407 return type_arguments_; 4378 return type_arguments_;
4408 } 4379 }
4409 const Class& instantiator_class() const { return instantiator_class_; } 4380 const Class& instantiator_class() const { return instantiator_class_; }
4410 intptr_t token_pos() const { return token_pos_; } 4381 intptr_t token_pos() const { return token_pos_; }
4411 4382
4412 virtual void PrintOperandsTo(BufferFormatter* f) const; 4383 virtual void PrintOperandsTo(BufferFormatter* f) const;
4413 4384
4414 virtual bool CanDeoptimize() const { return true; } 4385 virtual bool CanDeoptimize() const { return true; }
4415 4386
4416 virtual EffectSet Effects() const { return EffectSet::None(); } 4387 virtual EffectSet Effects() const { return EffectSet::None(); }
4417 4388
4418 virtual bool MayThrow() const { return true; } 4389 virtual bool MayThrow() const { return true; }
4419 4390
4420 private: 4391 private:
4421 const intptr_t token_pos_; 4392 const intptr_t token_pos_;
4422 const AbstractTypeArguments& type_arguments_; 4393 const TypeArguments& type_arguments_;
4423 const Class& instantiator_class_; 4394 const Class& instantiator_class_;
4424 4395
4425 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr); 4396 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr);
4426 }; 4397 };
4427 4398
4428 4399
4429 class ExtractConstructorTypeArgumentsInstr : public TemplateDefinition<1> { 4400 class ExtractConstructorTypeArgumentsInstr : public TemplateDefinition<1> {
4430 public: 4401 public:
4431 ExtractConstructorTypeArgumentsInstr( 4402 ExtractConstructorTypeArgumentsInstr(
4432 intptr_t token_pos, 4403 intptr_t token_pos,
4433 const AbstractTypeArguments& type_arguments, 4404 const TypeArguments& type_arguments,
4434 const Class& instantiator_class, 4405 const Class& instantiator_class,
4435 Value* instantiator) 4406 Value* instantiator)
4436 : token_pos_(token_pos), 4407 : token_pos_(token_pos),
4437 type_arguments_(type_arguments), 4408 type_arguments_(type_arguments),
4438 instantiator_class_(instantiator_class) { 4409 instantiator_class_(instantiator_class) {
4439 SetInputAt(0, instantiator); 4410 SetInputAt(0, instantiator);
4440 } 4411 }
4441 4412
4442 DECLARE_INSTRUCTION(ExtractConstructorTypeArguments) 4413 DECLARE_INSTRUCTION(ExtractConstructorTypeArguments)
4443 4414
4444 Value* instantiator() const { return inputs_[0]; } 4415 Value* instantiator() const { return inputs_[0]; }
4445 const AbstractTypeArguments& type_arguments() const { 4416 const TypeArguments& type_arguments() const {
4446 return type_arguments_; 4417 return type_arguments_;
4447 } 4418 }
4448 const Class& instantiator_class() const { return instantiator_class_; } 4419 const Class& instantiator_class() const { return instantiator_class_; }
4449 intptr_t token_pos() const { return token_pos_; } 4420 intptr_t token_pos() const { return token_pos_; }
4450 4421
4451 virtual void PrintOperandsTo(BufferFormatter* f) const; 4422 virtual void PrintOperandsTo(BufferFormatter* f) const;
4452 4423
4453 virtual bool CanDeoptimize() const { return false; } 4424 virtual bool CanDeoptimize() const { return false; }
4454 4425
4455 virtual EffectSet Effects() const { return EffectSet::None(); } 4426 virtual EffectSet Effects() const { return EffectSet::None(); }
4456 4427
4457 virtual bool MayThrow() const { return false; } 4428 virtual bool MayThrow() const { return false; }
4458 4429
4459 private: 4430 private:
4460 const intptr_t token_pos_; 4431 const intptr_t token_pos_;
4461 const AbstractTypeArguments& type_arguments_; 4432 const TypeArguments& type_arguments_;
4462 const Class& instantiator_class_; 4433 const Class& instantiator_class_;
4463 4434
4464 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsInstr); 4435 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsInstr);
4465 }; 4436 };
4466 4437
4467 4438
4468 class ExtractConstructorInstantiatorInstr : public TemplateDefinition<1> { 4439 class ExtractConstructorInstantiatorInstr : public TemplateDefinition<1> {
4469 public: 4440 public:
4470 ExtractConstructorInstantiatorInstr(ConstructorCallNode* ast_node, 4441 ExtractConstructorInstantiatorInstr(ConstructorCallNode* ast_node,
4471 const Class& instantiator_class, 4442 const Class& instantiator_class,
4472 Value* instantiator) 4443 Value* instantiator)
4473 : ast_node_(*ast_node), instantiator_class_(instantiator_class) { 4444 : ast_node_(*ast_node), instantiator_class_(instantiator_class) {
4474 SetInputAt(0, instantiator); 4445 SetInputAt(0, instantiator);
4475 } 4446 }
4476 4447
4477 DECLARE_INSTRUCTION(ExtractConstructorInstantiator) 4448 DECLARE_INSTRUCTION(ExtractConstructorInstantiator)
4478 4449
4479 Value* instantiator() const { return inputs_[0]; } 4450 Value* instantiator() const { return inputs_[0]; }
4480 const AbstractTypeArguments& type_arguments() const { 4451 const TypeArguments& type_arguments() const {
4481 return ast_node_.type_arguments(); 4452 return ast_node_.type_arguments();
4482 } 4453 }
4483 const Function& constructor() const { return ast_node_.constructor(); } 4454 const Function& constructor() const { return ast_node_.constructor(); }
4484 const Class& instantiator_class() const { return instantiator_class_; } 4455 const Class& instantiator_class() const { return instantiator_class_; }
4485 intptr_t token_pos() const { return ast_node_.token_pos(); } 4456 intptr_t token_pos() const { return ast_node_.token_pos(); }
4486 4457
4487 virtual bool CanDeoptimize() const { return false; } 4458 virtual bool CanDeoptimize() const { return false; }
4488 4459
4489 virtual EffectSet Effects() const { return EffectSet::None(); } 4460 virtual EffectSet Effects() const { return EffectSet::None(); }
4490 4461
(...skipping 2631 matching lines...) Expand 10 before | Expand all | Expand 10 after
7122 ForwardInstructionIterator* current_iterator_; 7093 ForwardInstructionIterator* current_iterator_;
7123 7094
7124 private: 7095 private:
7125 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 7096 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
7126 }; 7097 };
7127 7098
7128 7099
7129 } // namespace dart 7100 } // namespace dart
7130 7101
7131 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 7102 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698