| 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 26 matching lines...) Expand all Loading... |
| 37 V(_ImmutableArray, get:length, ImmutableArrayLength, 433698233) \ | 37 V(_ImmutableArray, get:length, ImmutableArrayLength, 433698233) \ |
| 38 V(_ByteArrayBase, get:length, ByteArrayBaseLength, 1098081765) \ | 38 V(_ByteArrayBase, get:length, ByteArrayBaseLength, 1098081765) \ |
| 39 V(_GrowableObjectArray, get:length, GrowableArrayLength, 725548050) \ | 39 V(_GrowableObjectArray, get:length, GrowableArrayLength, 725548050) \ |
| 40 V(_GrowableObjectArray, get:_capacity, GrowableArrayCapacity, 725548050) \ | 40 V(_GrowableObjectArray, get:_capacity, GrowableArrayCapacity, 725548050) \ |
| 41 V(_StringBase, get:length, StringBaseLength, 320803993) \ | 41 V(_StringBase, get:length, StringBaseLength, 320803993) \ |
| 42 V(_StringBase, get:isEmpty, StringBaseIsEmpty, 711547329) \ | 42 V(_StringBase, get:isEmpty, StringBaseIsEmpty, 711547329) \ |
| 43 V(_StringBase, charCodeAt, StringBaseCharCodeAt, 984449525) \ | 43 V(_StringBase, charCodeAt, StringBaseCharCodeAt, 984449525) \ |
| 44 V(_StringBase, [], StringBaseCharAt, 1062366987) \ | 44 V(_StringBase, [], StringBaseCharAt, 1062366987) \ |
| 45 V(_IntegerImplementation, toDouble, IntegerToDouble, 733149324) \ | 45 V(_IntegerImplementation, toDouble, IntegerToDouble, 733149324) \ |
| 46 V(_Double, toInt, DoubleToInteger, 362666636) \ | 46 V(_Double, toInt, DoubleToInteger, 362666636) \ |
| 47 V(_Double, truncate, DoubleTruncate, 620870996) \ |
| 48 V(_Double, round, DoubleRound, 620870996) \ |
| 47 V(::, sqrt, MathSqrt, 1662640002) \ | 49 V(::, sqrt, MathSqrt, 1662640002) \ |
| 48 | 50 |
| 49 // Class that recognizes the name and owner of a function and returns the | 51 // Class that recognizes the name and owner of a function and returns the |
| 50 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable | 52 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable |
| 51 // functions. | 53 // functions. |
| 52 class MethodRecognizer : public AllStatic { | 54 class MethodRecognizer : public AllStatic { |
| 53 public: | 55 public: |
| 54 enum Kind { | 56 enum Kind { |
| 55 kUnknown, | 57 kUnknown, |
| 56 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name, fp) k##enum_name, | 58 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name, fp) k##enum_name, |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 M(AllocateContext) \ | 249 M(AllocateContext) \ |
| 248 M(ChainContext) \ | 250 M(ChainContext) \ |
| 249 M(CloneContext) \ | 251 M(CloneContext) \ |
| 250 M(CatchEntry) \ | 252 M(CatchEntry) \ |
| 251 M(BinarySmiOp) \ | 253 M(BinarySmiOp) \ |
| 252 M(UnarySmiOp) \ | 254 M(UnarySmiOp) \ |
| 253 M(CheckStackOverflow) \ | 255 M(CheckStackOverflow) \ |
| 254 M(SmiToDouble) \ | 256 M(SmiToDouble) \ |
| 255 M(DoubleToInteger) \ | 257 M(DoubleToInteger) \ |
| 256 M(DoubleToSmi) \ | 258 M(DoubleToSmi) \ |
| 259 M(DoubleToDouble) \ |
| 257 M(CheckClass) \ | 260 M(CheckClass) \ |
| 258 M(CheckSmi) \ | 261 M(CheckSmi) \ |
| 259 M(Constant) \ | 262 M(Constant) \ |
| 260 M(CheckEitherNonSmi) \ | 263 M(CheckEitherNonSmi) \ |
| 261 M(BinaryDoubleOp) \ | 264 M(BinaryDoubleOp) \ |
| 262 M(MathSqrt) \ | 265 M(MathSqrt) \ |
| 263 M(UnboxDouble) \ | 266 M(UnboxDouble) \ |
| 264 M(BoxDouble) \ | 267 M(BoxDouble) \ |
| 265 M(UnboxInteger) \ | 268 M(UnboxInteger) \ |
| 266 M(BoxInteger) \ | 269 M(BoxInteger) \ |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 friend class ShiftMintOpInstr; | 507 friend class ShiftMintOpInstr; |
| 505 friend class UnaryMintOpInstr; | 508 friend class UnaryMintOpInstr; |
| 506 friend class MathSqrtInstr; | 509 friend class MathSqrtInstr; |
| 507 friend class CheckClassInstr; | 510 friend class CheckClassInstr; |
| 508 friend class CheckSmiInstr; | 511 friend class CheckSmiInstr; |
| 509 friend class CheckArrayBoundInstr; | 512 friend class CheckArrayBoundInstr; |
| 510 friend class CheckEitherNonSmiInstr; | 513 friend class CheckEitherNonSmiInstr; |
| 511 friend class StringCharCodeAtInstr; | 514 friend class StringCharCodeAtInstr; |
| 512 friend class LICM; | 515 friend class LICM; |
| 513 friend class DoubleToSmiInstr; | 516 friend class DoubleToSmiInstr; |
| 517 friend class DoubleToDoubleInstr; |
| 514 | 518 |
| 515 intptr_t deopt_id_; | 519 intptr_t deopt_id_; |
| 516 intptr_t lifetime_position_; // Position used by register allocator. | 520 intptr_t lifetime_position_; // Position used by register allocator. |
| 517 Instruction* previous_; | 521 Instruction* previous_; |
| 518 Instruction* next_; | 522 Instruction* next_; |
| 519 Environment* env_; | 523 Environment* env_; |
| 520 intptr_t expr_id_; | 524 intptr_t expr_id_; |
| 521 | 525 |
| 522 DISALLOW_COPY_AND_ASSIGN(Instruction); | 526 DISALLOW_COPY_AND_ASSIGN(Instruction); |
| 523 }; | 527 }; |
| (...skipping 3491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4015 return kUnboxedDouble; | 4019 return kUnboxedDouble; |
| 4016 } | 4020 } |
| 4017 | 4021 |
| 4018 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } | 4022 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } |
| 4019 | 4023 |
| 4020 private: | 4024 private: |
| 4021 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); | 4025 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); |
| 4022 }; | 4026 }; |
| 4023 | 4027 |
| 4024 | 4028 |
| 4029 class DoubleToDoubleInstr : public TemplateDefinition<1> { |
| 4030 public: |
| 4031 DoubleToDoubleInstr(Value* value, |
| 4032 InstanceCallInstr* instance_call, |
| 4033 MethodRecognizer::Kind recognized_kind) |
| 4034 : recognized_kind_(recognized_kind) { |
| 4035 ASSERT(value != NULL); |
| 4036 inputs_[0] = value; |
| 4037 deopt_id_ = instance_call->deopt_id(); |
| 4038 } |
| 4039 |
| 4040 Value* value() const { return inputs_[0]; } |
| 4041 |
| 4042 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } |
| 4043 |
| 4044 DECLARE_INSTRUCTION(DoubleToDouble) |
| 4045 virtual RawAbstractType* CompileType() const; |
| 4046 |
| 4047 virtual bool CanDeoptimize() const { return false; } |
| 4048 |
| 4049 virtual bool HasSideEffect() const { return false; } |
| 4050 |
| 4051 virtual intptr_t ResultCid() const { return kDoubleCid; } |
| 4052 |
| 4053 virtual Representation representation() const { |
| 4054 return kUnboxedDouble; |
| 4055 } |
| 4056 |
| 4057 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 4058 ASSERT(idx == 0); |
| 4059 return kUnboxedDouble; |
| 4060 } |
| 4061 |
| 4062 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } |
| 4063 |
| 4064 private: |
| 4065 const MethodRecognizer::Kind recognized_kind_; |
| 4066 |
| 4067 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr); |
| 4068 }; |
| 4069 |
| 4070 |
| 4025 class CheckClassInstr : public TemplateInstruction<1> { | 4071 class CheckClassInstr : public TemplateInstruction<1> { |
| 4026 public: | 4072 public: |
| 4027 CheckClassInstr(Value* value, | 4073 CheckClassInstr(Value* value, |
| 4028 intptr_t deopt_id, | 4074 intptr_t deopt_id, |
| 4029 const ICData& unary_checks); | 4075 const ICData& unary_checks); |
| 4030 | 4076 |
| 4031 DECLARE_INSTRUCTION(CheckClass) | 4077 DECLARE_INSTRUCTION(CheckClass) |
| 4032 virtual RawAbstractType* CompileType() const; | 4078 virtual RawAbstractType* CompileType() const; |
| 4033 | 4079 |
| 4034 virtual intptr_t ArgumentCount() const { return 0; } | 4080 virtual intptr_t ArgumentCount() const { return 0; } |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4340 ForwardInstructionIterator* current_iterator_; | 4386 ForwardInstructionIterator* current_iterator_; |
| 4341 | 4387 |
| 4342 private: | 4388 private: |
| 4343 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4389 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4344 }; | 4390 }; |
| 4345 | 4391 |
| 4346 | 4392 |
| 4347 } // namespace dart | 4393 } // namespace dart |
| 4348 | 4394 |
| 4349 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4395 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |