| 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 20 matching lines...) Expand all Loading... |
| 31 // TODO(srdjan): Add _ByteArrayBase, get:length. | 31 // TODO(srdjan): Add _ByteArrayBase, get:length. |
| 32 | 32 |
| 33 #define RECOGNIZED_LIST(V) \ | 33 #define RECOGNIZED_LIST(V) \ |
| 34 V(_ObjectArray, get:length, ObjectArrayLength) \ | 34 V(_ObjectArray, get:length, ObjectArrayLength) \ |
| 35 V(_ImmutableArray, get:length, ImmutableArrayLength) \ | 35 V(_ImmutableArray, get:length, ImmutableArrayLength) \ |
| 36 V(_GrowableObjectArray, get:length, GrowableArrayLength) \ | 36 V(_GrowableObjectArray, get:length, GrowableArrayLength) \ |
| 37 V(_GrowableObjectArray, get:capacity, GrowableArrayCapacity) \ | 37 V(_GrowableObjectArray, get:capacity, GrowableArrayCapacity) \ |
| 38 V(_StringBase, get:length, StringBaseLength) \ | 38 V(_StringBase, get:length, StringBaseLength) \ |
| 39 V(_StringBase, get:isEmpty, StringBaseIsEmpty) \ | 39 V(_StringBase, get:isEmpty, StringBaseIsEmpty) \ |
| 40 V(_StringBase, charCodeAt, StringBaseCharCodeAt) \ | 40 V(_StringBase, charCodeAt, StringBaseCharCodeAt) \ |
| 41 V(_StringBase, [], StringBaseCharAt) \ |
| 41 V(_IntegerImplementation, toDouble, IntegerToDouble) \ | 42 V(_IntegerImplementation, toDouble, IntegerToDouble) \ |
| 42 V(_Double, toInt, DoubleToInteger) \ | 43 V(_Double, toInt, DoubleToInteger) \ |
| 43 V(::, sqrt, MathSqrt) \ | 44 V(::, sqrt, MathSqrt) \ |
| 44 | 45 |
| 45 // Class that recognizes the name and owner of a function and returns the | 46 // Class that recognizes the name and owner of a function and returns the |
| 46 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable | 47 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable |
| 47 // functions. | 48 // functions. |
| 48 class MethodRecognizer : public AllStatic { | 49 class MethodRecognizer : public AllStatic { |
| 49 public: | 50 public: |
| 50 enum Kind { | 51 enum Kind { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 M(MathSqrt) \ | 258 M(MathSqrt) \ |
| 258 M(UnboxDouble) \ | 259 M(UnboxDouble) \ |
| 259 M(BoxDouble) \ | 260 M(BoxDouble) \ |
| 260 M(UnboxInteger) \ | 261 M(UnboxInteger) \ |
| 261 M(BoxInteger) \ | 262 M(BoxInteger) \ |
| 262 M(BinaryMintOp) \ | 263 M(BinaryMintOp) \ |
| 263 M(ShiftMintOp) \ | 264 M(ShiftMintOp) \ |
| 264 M(UnaryMintOp) \ | 265 M(UnaryMintOp) \ |
| 265 M(CheckArrayBound) \ | 266 M(CheckArrayBound) \ |
| 266 M(Constraint) \ | 267 M(Constraint) \ |
| 267 M(StringCharCodeAt) | 268 M(StringCharCodeAt) \ |
| 269 M(StringFromCharCode) |
| 268 | 270 |
| 269 | 271 |
| 270 #define FORWARD_DECLARATION(type) class type##Instr; | 272 #define FORWARD_DECLARATION(type) class type##Instr; |
| 271 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) | 273 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) |
| 272 #undef FORWARD_DECLARATION | 274 #undef FORWARD_DECLARATION |
| 273 | 275 |
| 274 | 276 |
| 275 // Functions required in all concrete instruction classes. | 277 // Functions required in all concrete instruction classes. |
| 276 #define DECLARE_INSTRUCTION(type) \ | 278 #define DECLARE_INSTRUCTION(type) \ |
| 277 virtual Tag tag() const { return k##type; } \ | 279 virtual Tag tag() const { return k##type; } \ |
| (...skipping 2397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2675 | 2677 |
| 2676 virtual bool AffectedBySideEffect() const { return true; } | 2678 virtual bool AffectedBySideEffect() const { return true; } |
| 2677 | 2679 |
| 2678 private: | 2680 private: |
| 2679 const intptr_t class_id_; | 2681 const intptr_t class_id_; |
| 2680 | 2682 |
| 2681 DISALLOW_COPY_AND_ASSIGN(StringCharCodeAtInstr); | 2683 DISALLOW_COPY_AND_ASSIGN(StringCharCodeAtInstr); |
| 2682 }; | 2684 }; |
| 2683 | 2685 |
| 2684 | 2686 |
| 2687 class StringFromCharCodeInstr : public TemplateDefinition<1> { |
| 2688 public: |
| 2689 explicit StringFromCharCodeInstr(Value* char_code) { |
| 2690 ASSERT(char_code != NULL); |
| 2691 ASSERT(char_code->definition()->IsStringCharCodeAt() && |
| 2692 (char_code->definition()->AsStringCharCodeAt()->class_id() == |
| 2693 kOneByteStringCid)); |
| 2694 inputs_[0] = char_code; |
| 2695 } |
| 2696 |
| 2697 DECLARE_INSTRUCTION(StringFromCharCode) |
| 2698 virtual RawAbstractType* CompileType() const; |
| 2699 |
| 2700 Value* char_code() const { return inputs_[0]; } |
| 2701 |
| 2702 virtual bool CanDeoptimize() const { return false; } |
| 2703 |
| 2704 virtual bool HasSideEffect() const { return false; } |
| 2705 |
| 2706 virtual intptr_t ResultCid() const; |
| 2707 |
| 2708 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 2709 |
| 2710 virtual bool AffectedBySideEffect() const { return false; } |
| 2711 |
| 2712 private: |
| 2713 DISALLOW_COPY_AND_ASSIGN(StringFromCharCodeInstr); |
| 2714 }; |
| 2715 |
| 2716 |
| 2685 class LoadIndexedInstr : public TemplateDefinition<2> { | 2717 class LoadIndexedInstr : public TemplateDefinition<2> { |
| 2686 public: | 2718 public: |
| 2687 LoadIndexedInstr(Value* array, Value* index, intptr_t class_id) | 2719 LoadIndexedInstr(Value* array, Value* index, intptr_t class_id) |
| 2688 : class_id_(class_id) { | 2720 : class_id_(class_id) { |
| 2689 ASSERT(array != NULL); | 2721 ASSERT(array != NULL); |
| 2690 ASSERT(index != NULL); | 2722 ASSERT(index != NULL); |
| 2691 inputs_[0] = array; | 2723 inputs_[0] = array; |
| 2692 inputs_[1] = index; | 2724 inputs_[1] = index; |
| 2693 } | 2725 } |
| 2694 | 2726 |
| (...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4241 ForwardInstructionIterator* current_iterator_; | 4273 ForwardInstructionIterator* current_iterator_; |
| 4242 | 4274 |
| 4243 private: | 4275 private: |
| 4244 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4276 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4245 }; | 4277 }; |
| 4246 | 4278 |
| 4247 | 4279 |
| 4248 } // namespace dart | 4280 } // namespace dart |
| 4249 | 4281 |
| 4250 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4282 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |