Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 | 254 |
| 255 private: | 255 private: |
| 256 Definition* const definition_; | 256 Definition* const definition_; |
| 257 | 257 |
| 258 DISALLOW_COPY_AND_ASSIGN(UseVal); | 258 DISALLOW_COPY_AND_ASSIGN(UseVal); |
| 259 }; | 259 }; |
| 260 | 260 |
| 261 | 261 |
| 262 class ConstantVal: public Value { | 262 class ConstantVal: public Value { |
| 263 public: | 263 public: |
| 264 explicit ConstantVal(const Object& value) : value_(value) { | 264 explicit ConstantVal(const Object& value) |
| 265 : value_(value), | |
| 266 location_summary_(MakeLocationSummary()) { | |
| 265 ASSERT(value.IsZoneHandle()); | 267 ASSERT(value.IsZoneHandle()); |
| 266 } | 268 } |
| 267 | 269 |
| 268 DECLARE_VALUE(Constant) | 270 DECLARE_VALUE(Constant) |
| 269 | 271 |
| 270 const Object& value() const { return value_; } | 272 const Object& value() const { return value_; } |
| 271 | 273 |
| 274 virtual LocationSummary* locs() const { | |
|
Vyacheslav Egorov (Google)
2012/05/22 02:47:59
we starting to duplicate boilerplate. maybe macros
Florian Schneider
2012/05/22 06:33:08
Yes, I think location_summary_ should move to a su
srdjan
2012/05/22 16:50:32
Maybe move it to class Computation right now and i
| |
| 275 return location_summary_; | |
| 276 } | |
| 277 | |
| 278 // Platform specific summary factory for this instruction. | |
| 279 LocationSummary* MakeLocationSummary(); | |
| 280 | |
| 281 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | |
| 282 | |
| 272 private: | 283 private: |
| 273 const Object& value_; | 284 const Object& value_; |
| 285 LocationSummary* location_summary_; | |
| 274 | 286 |
| 275 DISALLOW_COPY_AND_ASSIGN(ConstantVal); | 287 DISALLOW_COPY_AND_ASSIGN(ConstantVal); |
| 276 }; | 288 }; |
| 277 | 289 |
| 278 #undef DECLARE_VALUE | 290 #undef DECLARE_VALUE |
| 279 | 291 |
| 280 | 292 |
| 281 class AssertAssignableComp : public Computation { | 293 class AssertAssignableComp : public Computation { |
| 282 public: | 294 public: |
| 283 AssertAssignableComp(intptr_t token_index, | 295 AssertAssignableComp(intptr_t token_index, |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 ZoneGrowableArray<Value*>* arguments_; | 616 ZoneGrowableArray<Value*>* arguments_; |
| 605 LocationSummary* location_summary_; | 617 LocationSummary* location_summary_; |
| 606 | 618 |
| 607 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); | 619 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); |
| 608 }; | 620 }; |
| 609 | 621 |
| 610 | 622 |
| 611 class LoadLocalComp : public TemplateComputation<0> { | 623 class LoadLocalComp : public TemplateComputation<0> { |
| 612 public: | 624 public: |
| 613 LoadLocalComp(const LocalVariable& local, intptr_t context_level) | 625 LoadLocalComp(const LocalVariable& local, intptr_t context_level) |
| 614 : local_(local), context_level_(context_level) { } | 626 : local_(local), |
| 627 context_level_(context_level), | |
| 628 location_summary_(MakeLocationSummary()) { } | |
| 615 | 629 |
| 616 DECLARE_COMPUTATION(LoadLocal) | 630 DECLARE_COMPUTATION(LoadLocal) |
| 617 | 631 |
| 618 const LocalVariable& local() const { return local_; } | 632 const LocalVariable& local() const { return local_; } |
| 619 intptr_t context_level() const { return context_level_; } | 633 intptr_t context_level() const { return context_level_; } |
| 620 | 634 |
| 621 virtual void PrintOperandsTo(BufferFormatter* f) const; | 635 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 622 | 636 |
| 637 virtual LocationSummary* locs() const { | |
| 638 return location_summary_; | |
| 639 } | |
| 640 | |
| 641 // Platform specific summary factory for this instruction. | |
| 642 LocationSummary* MakeLocationSummary(); | |
| 643 | |
| 644 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | |
| 645 | |
| 623 private: | 646 private: |
| 624 const LocalVariable& local_; | 647 const LocalVariable& local_; |
| 625 const intptr_t context_level_; | 648 const intptr_t context_level_; |
| 649 LocationSummary* location_summary_; | |
| 626 | 650 |
| 627 DISALLOW_COPY_AND_ASSIGN(LoadLocalComp); | 651 DISALLOW_COPY_AND_ASSIGN(LoadLocalComp); |
| 628 }; | 652 }; |
| 629 | 653 |
| 630 | 654 |
| 631 class StoreLocalComp : public TemplateComputation<1> { | 655 class StoreLocalComp : public TemplateComputation<1> { |
| 632 public: | 656 public: |
| 633 StoreLocalComp(const LocalVariable& local, | 657 StoreLocalComp(const LocalVariable& local, |
| 634 Value* value, | 658 Value* value, |
| 635 intptr_t context_level) | 659 intptr_t context_level) |
| 636 : local_(local), context_level_(context_level) { | 660 : local_(local), |
| 661 context_level_(context_level), | |
| 662 location_summary_(MakeLocationSummary()) { | |
| 637 inputs_[0] = value; | 663 inputs_[0] = value; |
| 638 } | 664 } |
| 639 | 665 |
| 640 DECLARE_COMPUTATION(StoreLocal) | 666 DECLARE_COMPUTATION(StoreLocal) |
| 641 | 667 |
| 642 const LocalVariable& local() const { return local_; } | 668 const LocalVariable& local() const { return local_; } |
| 643 Value* value() const { return inputs_[0]; } | 669 Value* value() const { return inputs_[0]; } |
| 644 intptr_t context_level() const { return context_level_; } | 670 intptr_t context_level() const { return context_level_; } |
| 645 | 671 |
| 646 virtual void RecordAssignedVars(BitVector* assigned_vars); | 672 virtual void RecordAssignedVars(BitVector* assigned_vars); |
| 647 | 673 |
| 648 virtual void PrintOperandsTo(BufferFormatter* f) const; | 674 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 649 | 675 |
| 676 virtual LocationSummary* locs() const { | |
| 677 return location_summary_; | |
| 678 } | |
| 679 | |
| 680 // Platform specific summary factory for this instruction. | |
| 681 LocationSummary* MakeLocationSummary(); | |
| 682 | |
| 683 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | |
| 684 | |
| 650 private: | 685 private: |
| 651 const LocalVariable& local_; | 686 const LocalVariable& local_; |
| 652 const intptr_t context_level_; | 687 const intptr_t context_level_; |
| 688 LocationSummary* location_summary_; | |
| 653 | 689 |
| 654 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp); | 690 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp); |
| 655 }; | 691 }; |
| 656 | 692 |
| 657 | 693 |
| 658 class NativeCallComp : public TemplateComputation<0> { | 694 class NativeCallComp : public TemplateComputation<0> { |
| 659 public: | 695 public: |
| 660 NativeCallComp(NativeBodyNode* node, intptr_t try_index) | 696 NativeCallComp(NativeBodyNode* node, intptr_t try_index) |
| 661 : ast_node_(*node), try_index_(try_index) {} | 697 : ast_node_(*node), try_index_(try_index) {} |
| 662 | 698 |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1899 const GrowableArray<BlockEntryInstr*>& block_order_; | 1935 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 1900 | 1936 |
| 1901 private: | 1937 private: |
| 1902 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 1938 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 1903 }; | 1939 }; |
| 1904 | 1940 |
| 1905 | 1941 |
| 1906 } // namespace dart | 1942 } // namespace dart |
| 1907 | 1943 |
| 1908 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 1944 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |