Chromium Code Reviews| 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 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4011 return kUnboxedDouble; | 4015 return kUnboxedDouble; |
| 4012 } | 4016 } |
| 4013 | 4017 |
| 4014 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } | 4018 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } |
| 4015 | 4019 |
| 4016 private: | 4020 private: |
| 4017 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); | 4021 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); |
| 4018 }; | 4022 }; |
| 4019 | 4023 |
| 4020 | 4024 |
| 4025 class DoubleToDoubleInstr : public TemplateDefinition<1> { | |
| 4026 public: | |
| 4027 DoubleToDoubleInstr(Value* value, | |
| 4028 InstanceCallInstr* instance_call, | |
| 4029 MethodRecognizer::Kind recognized_kind) | |
| 4030 : recognized_kind_(recognized_kind) { | |
| 4031 ASSERT(value != NULL); | |
| 4032 inputs_[0] = value; | |
| 4033 deopt_id_ = instance_call->deopt_id(); | |
| 4034 } | |
| 4035 | |
| 4036 Value* value() const { return inputs_[0]; } | |
| 4037 | |
| 4038 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } | |
| 4039 | |
| 4040 DECLARE_INSTRUCTION(DoubleToDouble) | |
| 4041 virtual RawAbstractType* CompileType() const; | |
| 4042 | |
| 4043 virtual bool CanDeoptimize() const { return false; } | |
| 4044 | |
| 4045 virtual bool HasSideEffect() const { return false; } | |
| 4046 | |
| 4047 // Result could be any of the int types. | |
|
Florian Schneider
2013/01/11 09:49:30
I don't understand this comment. It seems not appl
srdjan
2013/01/11 19:41:08
Sorry removed that comment, but forgot to upload.
| |
| 4048 virtual intptr_t ResultCid() const { return kDoubleCid; } | |
| 4049 | |
| 4050 virtual Representation representation() const { | |
| 4051 return kUnboxedDouble; | |
| 4052 } | |
| 4053 | |
| 4054 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | |
| 4055 ASSERT(idx == 0); | |
| 4056 return kUnboxedDouble; | |
| 4057 } | |
| 4058 | |
| 4059 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } | |
| 4060 | |
| 4061 private: | |
| 4062 const MethodRecognizer::Kind recognized_kind_; | |
| 4063 | |
| 4064 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr); | |
| 4065 }; | |
| 4066 | |
| 4067 | |
| 4021 class CheckClassInstr : public TemplateInstruction<1> { | 4068 class CheckClassInstr : public TemplateInstruction<1> { |
| 4022 public: | 4069 public: |
| 4023 CheckClassInstr(Value* value, | 4070 CheckClassInstr(Value* value, |
| 4024 intptr_t deopt_id, | 4071 intptr_t deopt_id, |
| 4025 const ICData& unary_checks); | 4072 const ICData& unary_checks); |
| 4026 | 4073 |
| 4027 DECLARE_INSTRUCTION(CheckClass) | 4074 DECLARE_INSTRUCTION(CheckClass) |
| 4028 virtual RawAbstractType* CompileType() const; | 4075 virtual RawAbstractType* CompileType() const; |
| 4029 | 4076 |
| 4030 virtual intptr_t ArgumentCount() const { return 0; } | 4077 virtual intptr_t ArgumentCount() const { return 0; } |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4336 ForwardInstructionIterator* current_iterator_; | 4383 ForwardInstructionIterator* current_iterator_; |
| 4337 | 4384 |
| 4338 private: | 4385 private: |
| 4339 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4386 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4340 }; | 4387 }; |
| 4341 | 4388 |
| 4342 | 4389 |
| 4343 } // namespace dart | 4390 } // namespace dart |
| 4344 | 4391 |
| 4345 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4392 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |