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

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

Issue 14935005: Implement a variation of scalar replacement for non-escaping allocations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 7 years, 7 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
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 M(Float32x4Zero) \ 579 M(Float32x4Zero) \
580 M(Float32x4Splat) \ 580 M(Float32x4Splat) \
581 M(Float32x4Comparison) \ 581 M(Float32x4Comparison) \
582 M(Float32x4MinMax) \ 582 M(Float32x4MinMax) \
583 M(Float32x4Scale) \ 583 M(Float32x4Scale) \
584 M(Float32x4Sqrt) \ 584 M(Float32x4Sqrt) \
585 M(Float32x4ZeroArg) \ 585 M(Float32x4ZeroArg) \
586 M(Float32x4Clamp) \ 586 M(Float32x4Clamp) \
587 M(Float32x4With) \ 587 M(Float32x4With) \
588 M(Float32x4ToUint32x4) \ 588 M(Float32x4ToUint32x4) \
589 589 M(MaterializeObject) \
590 590
591 #define FORWARD_DECLARATION(type) class type##Instr; 591 #define FORWARD_DECLARATION(type) class type##Instr;
592 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) 592 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION)
593 #undef FORWARD_DECLARATION 593 #undef FORWARD_DECLARATION
594 594
595 595
596 // Functions required in all concrete instruction classes. 596 // Functions required in all concrete instruction classes.
597 #define DECLARE_INSTRUCTION(type) \ 597 #define DECLARE_INSTRUCTION(type) \
598 virtual Tag tag() const { return k##type; } \ 598 virtual Tag tag() const { return k##type; } \
599 virtual void Accept(FlowGraphVisitor* visitor); \ 599 virtual void Accept(FlowGraphVisitor* visitor); \
(...skipping 2895 matching lines...) Expand 10 before | Expand all | Expand 10 after
3495 private: 3495 private:
3496 const ConstructorCallNode& ast_node_; 3496 const ConstructorCallNode& ast_node_;
3497 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; 3497 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
3498 const intptr_t cid_; 3498 const intptr_t cid_;
3499 Identity identity_; 3499 Identity identity_;
3500 3500
3501 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr); 3501 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr);
3502 }; 3502 };
3503 3503
3504 3504
3505 // This instruction captures the state of the object which had its allocation
3506 // removed during the AllocationSinking pass.
3507 // It does not produce any real code only deoptimization information.
3508 class MaterializeObjectInstr : public Definition {
3509 public:
3510 MaterializeObjectInstr(const Class& cls,
3511 const ZoneGrowableArray<const Field*>& fields,
3512 ZoneGrowableArray<Value*>* values)
3513 : cls_(cls), fields_(fields), values_(values), locations_(NULL) {
3514 ASSERT(fields_.length() == values_->length());
3515 for (intptr_t i = 0; i < InputCount(); i++) {
3516 InputAt(i)->set_instruction(this);
3517 InputAt(i)->set_use_index(i);
3518 }
3519 }
3520
3521 const Class& cls() const { return cls_; }
3522 const Field& FieldAt(intptr_t i) const {
3523 return *fields_[i];
3524 }
3525 const Location& LocationAt(intptr_t i) {
3526 return locations_[i];
3527 }
3528
3529 DECLARE_INSTRUCTION(MaterializeObject)
3530 virtual void PrintOperandsTo(BufferFormatter* f) const;
3531
3532 virtual intptr_t InputCount() const {
3533 return values_->length();
3534 }
3535
3536 virtual Value* InputAt(intptr_t i) const {
3537 return (*values_)[i];
3538 }
3539
3540 virtual bool CanDeoptimize() const { return false; }
3541 virtual EffectSet Effects() const { return EffectSet::None(); }
3542
3543 LocationSummary* locs() {
3544 UNREACHABLE();
3545 return NULL;
3546 }
3547
3548 Location* locations() { return locations_; }
3549 void set_locations(Location* locations) { locations_ = locations; }
3550
3551 private:
3552 virtual void RawSetInputAt(intptr_t i, Value* value) {
3553 (*values_)[i] = value;
3554 }
3555
3556 const Class& cls_;
3557 const ZoneGrowableArray<const Field*>& fields_;
3558 ZoneGrowableArray<Value*>* values_;
3559 Location* locations_;
3560
3561 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr);
3562 };
3563
3564
3505 class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> { 3565 class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> {
3506 public: 3566 public:
3507 AllocateObjectWithBoundsCheckInstr(ConstructorCallNode* node, 3567 AllocateObjectWithBoundsCheckInstr(ConstructorCallNode* node,
3508 Value* type_arguments, 3568 Value* type_arguments,
3509 Value* instantiator) 3569 Value* instantiator)
3510 : ast_node_(*node) { 3570 : ast_node_(*node) {
3511 SetInputAt(0, type_arguments); 3571 SetInputAt(0, type_arguments);
3512 SetInputAt(1, instantiator); 3572 SetInputAt(1, instantiator);
3513 } 3573 }
3514 3574
(...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
5781 ForwardInstructionIterator* current_iterator_; 5841 ForwardInstructionIterator* current_iterator_;
5782 5842
5783 private: 5843 private:
5784 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 5844 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
5785 }; 5845 };
5786 5846
5787 5847
5788 } // namespace dart 5848 } // namespace dart
5789 5849
5790 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 5850 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698