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

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

Issue 11970038: Remove StringCharCodeAtInstr and handle it as part of LoadIndexed. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/flow_graph_optimizer.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) 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 M(MathSqrt) \ 265 M(MathSqrt) \
266 M(UnboxDouble) \ 266 M(UnboxDouble) \
267 M(BoxDouble) \ 267 M(BoxDouble) \
268 M(UnboxInteger) \ 268 M(UnboxInteger) \
269 M(BoxInteger) \ 269 M(BoxInteger) \
270 M(BinaryMintOp) \ 270 M(BinaryMintOp) \
271 M(ShiftMintOp) \ 271 M(ShiftMintOp) \
272 M(UnaryMintOp) \ 272 M(UnaryMintOp) \
273 M(CheckArrayBound) \ 273 M(CheckArrayBound) \
274 M(Constraint) \ 274 M(Constraint) \
275 M(StringCharCodeAt) \
276 M(StringFromCharCode) 275 M(StringFromCharCode)
277 276
278 277
279 #define FORWARD_DECLARATION(type) class type##Instr; 278 #define FORWARD_DECLARATION(type) class type##Instr;
280 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) 279 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION)
281 #undef FORWARD_DECLARATION 280 #undef FORWARD_DECLARATION
282 281
283 282
284 // Functions required in all concrete instruction classes. 283 // Functions required in all concrete instruction classes.
285 #define DECLARE_INSTRUCTION(type) \ 284 #define DECLARE_INSTRUCTION(type) \
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 friend class BinaryMintOpInstr; 503 friend class BinaryMintOpInstr;
505 friend class BinarySmiOpInstr; 504 friend class BinarySmiOpInstr;
506 friend class UnarySmiOpInstr; 505 friend class UnarySmiOpInstr;
507 friend class ShiftMintOpInstr; 506 friend class ShiftMintOpInstr;
508 friend class UnaryMintOpInstr; 507 friend class UnaryMintOpInstr;
509 friend class MathSqrtInstr; 508 friend class MathSqrtInstr;
510 friend class CheckClassInstr; 509 friend class CheckClassInstr;
511 friend class CheckSmiInstr; 510 friend class CheckSmiInstr;
512 friend class CheckArrayBoundInstr; 511 friend class CheckArrayBoundInstr;
513 friend class CheckEitherNonSmiInstr; 512 friend class CheckEitherNonSmiInstr;
514 friend class StringCharCodeAtInstr;
515 friend class LICM; 513 friend class LICM;
516 friend class DoubleToSmiInstr; 514 friend class DoubleToSmiInstr;
517 friend class DoubleToDoubleInstr; 515 friend class DoubleToDoubleInstr;
518 516
519 intptr_t deopt_id_; 517 intptr_t deopt_id_;
520 intptr_t lifetime_position_; // Position used by register allocator. 518 intptr_t lifetime_position_; // Position used by register allocator.
521 Instruction* previous_; 519 Instruction* previous_;
522 Instruction* next_; 520 Instruction* next_;
523 Environment* env_; 521 Environment* env_;
524 intptr_t expr_id_; 522 intptr_t expr_id_;
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 2668
2671 virtual intptr_t ResultCid() const { return kDynamicCid; } 2669 virtual intptr_t ResultCid() const { return kDynamicCid; }
2672 2670
2673 private: 2671 private:
2674 const Field& field_; 2672 const Field& field_;
2675 2673
2676 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); 2674 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr);
2677 }; 2675 };
2678 2676
2679 2677
2680 class StringCharCodeAtInstr : public TemplateDefinition<2> { 2678 class LoadIndexedInstr : public TemplateDefinition<2> {
2681 public: 2679 public:
2682 StringCharCodeAtInstr(Value* receiver, 2680 LoadIndexedInstr(Value* array, Value* index, intptr_t class_id)
2683 Value* index,
2684 intptr_t class_id)
2685 : class_id_(class_id) { 2681 : class_id_(class_id) {
2686 ASSERT(receiver != NULL); 2682 ASSERT(array != NULL);
2687 ASSERT(index != NULL); 2683 ASSERT(index != NULL);
2688 inputs_[0] = receiver; 2684 inputs_[0] = array;
2689 inputs_[1] = index; 2685 inputs_[1] = index;
2690 } 2686 }
2691 2687
2692 DECLARE_INSTRUCTION(StringCharCodeAt) 2688 DECLARE_INSTRUCTION(LoadIndexed)
2693 virtual RawAbstractType* CompileType() const; 2689 virtual RawAbstractType* CompileType() const;
2694 2690
2695 Value* receiver() const { return inputs_[0]; } 2691 Value* array() const { return inputs_[0]; }
2696 Value* index() const { return inputs_[1]; } 2692 Value* index() const { return inputs_[1]; }
2697 intptr_t class_id() const { return class_id_; } 2693 intptr_t class_id() const { return class_id_; }
2698 2694
2699 virtual bool CanDeoptimize() const { return false; } 2695 virtual bool CanDeoptimize() const { return false; }
2700 2696
2701 virtual bool HasSideEffect() const { return false; } 2697 virtual bool HasSideEffect() const { return false; }
2702 2698
2703 virtual intptr_t ResultCid() const; 2699 virtual intptr_t ResultCid() const;
2704 2700
2701 virtual Representation representation() const;
2702
2705 virtual bool AttributesEqual(Instruction* other) const; 2703 virtual bool AttributesEqual(Instruction* other) const;
2706 2704
2707 virtual bool AffectedBySideEffect() const { return true; } 2705 virtual bool AffectedBySideEffect() const { return true; }
2708 2706
2709 virtual void InferRange(); 2707 virtual void InferRange();
2710 2708
2711 private: 2709 private:
2712 const intptr_t class_id_; 2710 const intptr_t class_id_;
2713 2711
2714 DISALLOW_COPY_AND_ASSIGN(StringCharCodeAtInstr); 2712 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr);
2715 }; 2713 };
2716 2714
2717 2715
2718 class StringFromCharCodeInstr : public TemplateDefinition<1> { 2716 class StringFromCharCodeInstr : public TemplateDefinition<1> {
2719 public: 2717 public:
2720 explicit StringFromCharCodeInstr(Value* char_code, 2718 explicit StringFromCharCodeInstr(Value* char_code,
2721 intptr_t cid) : cid_(cid) { 2719 intptr_t cid) : cid_(cid) {
2722 ASSERT(char_code != NULL); 2720 ASSERT(char_code != NULL);
2723 ASSERT(char_code->definition()->IsStringCharCodeAt() && 2721 ASSERT(char_code->definition()->IsLoadIndexed() &&
2724 (char_code->definition()->AsStringCharCodeAt()->class_id() == 2722 (char_code->definition()->AsLoadIndexed()->class_id() ==
2725 kOneByteStringCid)); 2723 kOneByteStringCid));
2726 inputs_[0] = char_code; 2724 inputs_[0] = char_code;
2727 } 2725 }
2728 2726
2729 DECLARE_INSTRUCTION(StringFromCharCode) 2727 DECLARE_INSTRUCTION(StringFromCharCode)
2730 virtual RawAbstractType* CompileType() const; 2728 virtual RawAbstractType* CompileType() const;
2731 2729
2732 Value* char_code() const { return inputs_[0]; } 2730 Value* char_code() const { return inputs_[0]; }
2733 2731
2734 virtual bool CanDeoptimize() const { return false; } 2732 virtual bool CanDeoptimize() const { return false; }
2735 2733
2736 virtual bool HasSideEffect() const { return false; } 2734 virtual bool HasSideEffect() const { return false; }
2737 2735
2738 virtual intptr_t ResultCid() const { return cid_; } 2736 virtual intptr_t ResultCid() const { return cid_; }
2739 2737
2740 virtual bool AttributesEqual(Instruction* other) const { return true; } 2738 virtual bool AttributesEqual(Instruction* other) const { return true; }
2741 2739
2742 virtual bool AffectedBySideEffect() const { return false; } 2740 virtual bool AffectedBySideEffect() const { return false; }
2743 2741
2744 private: 2742 private:
2745 const intptr_t cid_; 2743 const intptr_t cid_;
2746 2744
2747 DISALLOW_COPY_AND_ASSIGN(StringFromCharCodeInstr); 2745 DISALLOW_COPY_AND_ASSIGN(StringFromCharCodeInstr);
2748 }; 2746 };
2749 2747
2750 2748
2751 class LoadIndexedInstr : public TemplateDefinition<2> {
2752 public:
2753 LoadIndexedInstr(Value* array, Value* index, intptr_t class_id)
2754 : class_id_(class_id) {
2755 ASSERT(array != NULL);
2756 ASSERT(index != NULL);
2757 inputs_[0] = array;
2758 inputs_[1] = index;
2759 }
2760
2761 DECLARE_INSTRUCTION(LoadIndexed)
2762 virtual RawAbstractType* CompileType() const;
2763
2764 Value* array() const { return inputs_[0]; }
2765 Value* index() const { return inputs_[1]; }
2766 intptr_t class_id() const { return class_id_; }
2767
2768 virtual bool CanDeoptimize() const { return false; }
2769
2770 virtual bool HasSideEffect() const { return false; }
2771
2772 virtual intptr_t ResultCid() const;
2773
2774 virtual Representation representation() const;
2775
2776 virtual bool AttributesEqual(Instruction* other) const;
2777
2778 virtual bool AffectedBySideEffect() const { return true; }
2779
2780 virtual void InferRange();
2781
2782 private:
2783 const intptr_t class_id_;
2784
2785 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr);
2786 };
2787
2788
2789 class StoreIndexedInstr : public TemplateDefinition<3> { 2749 class StoreIndexedInstr : public TemplateDefinition<3> {
2790 public: 2750 public:
2791 StoreIndexedInstr(Value* array, 2751 StoreIndexedInstr(Value* array,
2792 Value* index, 2752 Value* index,
2793 Value* value, 2753 Value* value,
2794 bool emit_store_barrier, 2754 bool emit_store_barrier,
2795 intptr_t class_id, 2755 intptr_t class_id,
2796 intptr_t deopt_id) 2756 intptr_t deopt_id)
2797 : emit_store_barrier_(emit_store_barrier), 2757 : emit_store_barrier_(emit_store_barrier),
2798 class_id_(class_id), 2758 class_id_(class_id),
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after
4396 ForwardInstructionIterator* current_iterator_; 4356 ForwardInstructionIterator* current_iterator_;
4397 4357
4398 private: 4358 private:
4399 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4359 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4400 }; 4360 };
4401 4361
4402 4362
4403 } // namespace dart 4363 } // namespace dart
4404 4364
4405 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4365 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698