OLD | NEW |
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 bool IsEqualTo(CompileType* other) { | 151 bool IsEqualTo(CompileType* other) { |
152 return (is_nullable_ == other->is_nullable_) && | 152 return (is_nullable_ == other->is_nullable_) && |
153 (ToNullableCid() == other->ToNullableCid()) && | 153 (ToNullableCid() == other->ToNullableCid()) && |
154 (ToAbstractType()->Equals(*other->ToAbstractType())); | 154 (ToAbstractType()->Equals(*other->ToAbstractType())); |
155 } | 155 } |
156 | 156 |
157 bool IsNone() const { | 157 bool IsNone() const { |
158 return (cid_ == kIllegalCid) && (type_ == NULL); | 158 return (cid_ == kIllegalCid) && (type_ == NULL); |
159 } | 159 } |
160 | 160 |
| 161 bool IsInt() { |
| 162 return !is_nullable() && |
| 163 ((ToCid() == kSmiCid) || |
| 164 (ToCid() == kMintCid) || |
| 165 ((type_ != NULL) && (type_->Equals(Type::Handle(Type::IntType()))))); |
| 166 } |
| 167 |
161 void PrintTo(BufferFormatter* f) const; | 168 void PrintTo(BufferFormatter* f) const; |
162 const char* ToCString() const; | 169 const char* ToCString() const; |
163 | 170 |
164 private: | 171 private: |
165 bool CanComputeIsInstanceOf(const AbstractType& type, | 172 bool CanComputeIsInstanceOf(const AbstractType& type, |
166 bool is_nullable, | 173 bool is_nullable, |
167 bool* is_instance); | 174 bool* is_instance); |
168 | 175 |
169 bool is_nullable_; | 176 bool is_nullable_; |
170 intptr_t cid_; | 177 intptr_t cid_; |
(...skipping 4501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4672 : UnboxInteger32Instr(kUnboxedUint32, kTruncate, value, deopt_id) { | 4679 : UnboxInteger32Instr(kUnboxedUint32, kTruncate, value, deopt_id) { |
4673 ASSERT(is_truncating()); | 4680 ASSERT(is_truncating()); |
4674 } | 4681 } |
4675 | 4682 |
4676 virtual bool CanDeoptimize() const { | 4683 virtual bool CanDeoptimize() const { |
4677 ASSERT(is_truncating()); | 4684 ASSERT(is_truncating()); |
4678 return (value()->Type()->ToCid() != kSmiCid) | 4685 return (value()->Type()->ToCid() != kSmiCid) |
4679 && (value()->Type()->ToCid() != kMintCid); | 4686 && (value()->Type()->ToCid() != kMintCid); |
4680 } | 4687 } |
4681 | 4688 |
| 4689 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
| 4690 |
4682 DECLARE_INSTRUCTION_NO_BACKEND(UnboxUint32) | 4691 DECLARE_INSTRUCTION_NO_BACKEND(UnboxUint32) |
4683 | 4692 |
4684 private: | 4693 private: |
4685 DISALLOW_COPY_AND_ASSIGN(UnboxUint32Instr); | 4694 DISALLOW_COPY_AND_ASSIGN(UnboxUint32Instr); |
4686 }; | 4695 }; |
4687 | 4696 |
4688 | 4697 |
4689 class UnboxInt32Instr : public UnboxInteger32Instr { | 4698 class UnboxInt32Instr : public UnboxInteger32Instr { |
4690 public: | 4699 public: |
4691 UnboxInt32Instr(TruncationMode truncation_mode, | 4700 UnboxInt32Instr(TruncationMode truncation_mode, |
(...skipping 2825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7517 UnboxedIntConverterInstr* converter = other->AsUnboxedIntConverter(); | 7526 UnboxedIntConverterInstr* converter = other->AsUnboxedIntConverter(); |
7518 return (converter->from() == from()) && | 7527 return (converter->from() == from()) && |
7519 (converter->to() == to()) && | 7528 (converter->to() == to()) && |
7520 (converter->is_truncating() == is_truncating()); | 7529 (converter->is_truncating() == is_truncating()); |
7521 } | 7530 } |
7522 | 7531 |
7523 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 7532 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
7524 | 7533 |
7525 virtual void PrintOperandsTo(BufferFormatter* f) const; | 7534 virtual void PrintOperandsTo(BufferFormatter* f) const; |
7526 | 7535 |
| 7536 virtual CompileType ComputeType() const { |
| 7537 // TODO(vegorov) use range information to improve type. |
| 7538 return CompileType::Int(); |
| 7539 } |
| 7540 |
7527 DECLARE_INSTRUCTION(UnboxedIntConverter); | 7541 DECLARE_INSTRUCTION(UnboxedIntConverter); |
7528 | 7542 |
7529 private: | 7543 private: |
7530 const Representation from_representation_; | 7544 const Representation from_representation_; |
7531 const Representation to_representation_; | 7545 const Representation to_representation_; |
7532 bool is_truncating_; | 7546 bool is_truncating_; |
7533 | 7547 |
7534 DISALLOW_COPY_AND_ASSIGN(UnboxedIntConverterInstr); | 7548 DISALLOW_COPY_AND_ASSIGN(UnboxedIntConverterInstr); |
7535 }; | 7549 }; |
7536 | 7550 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7768 Isolate* isolate, bool opt) const { \ | 7782 Isolate* isolate, bool opt) const { \ |
7769 UNIMPLEMENTED(); \ | 7783 UNIMPLEMENTED(); \ |
7770 return NULL; \ | 7784 return NULL; \ |
7771 } \ | 7785 } \ |
7772 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 7786 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
7773 | 7787 |
7774 | 7788 |
7775 } // namespace dart | 7789 } // namespace dart |
7776 | 7790 |
7777 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7791 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |