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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 M(ExtractConstructorInstantiator) \ | 246 M(ExtractConstructorInstantiator) \ |
| 247 M(AllocateContext) \ | 247 M(AllocateContext) \ |
| 248 M(ChainContext) \ | 248 M(ChainContext) \ |
| 249 M(CloneContext) \ | 249 M(CloneContext) \ |
| 250 M(CatchEntry) \ | 250 M(CatchEntry) \ |
| 251 M(BinarySmiOp) \ | 251 M(BinarySmiOp) \ |
| 252 M(UnarySmiOp) \ | 252 M(UnarySmiOp) \ |
| 253 M(CheckStackOverflow) \ | 253 M(CheckStackOverflow) \ |
| 254 M(SmiToDouble) \ | 254 M(SmiToDouble) \ |
| 255 M(DoubleToInteger) \ | 255 M(DoubleToInteger) \ |
| 256 M(DoubleToSmi) \ | |
| 256 M(CheckClass) \ | 257 M(CheckClass) \ |
| 257 M(CheckSmi) \ | 258 M(CheckSmi) \ |
| 258 M(Constant) \ | 259 M(Constant) \ |
| 259 M(CheckEitherNonSmi) \ | 260 M(CheckEitherNonSmi) \ |
| 260 M(BinaryDoubleOp) \ | 261 M(BinaryDoubleOp) \ |
| 261 M(MathSqrt) \ | 262 M(MathSqrt) \ |
| 262 M(UnboxDouble) \ | 263 M(UnboxDouble) \ |
| 263 M(BoxDouble) \ | 264 M(BoxDouble) \ |
| 264 M(UnboxInteger) \ | 265 M(UnboxInteger) \ |
| 265 M(BoxInteger) \ | 266 M(BoxInteger) \ |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 527 friend class UnarySmiOpInstr; | 528 friend class UnarySmiOpInstr; |
| 528 friend class ShiftMintOpInstr; | 529 friend class ShiftMintOpInstr; |
| 529 friend class UnaryMintOpInstr; | 530 friend class UnaryMintOpInstr; |
| 530 friend class MathSqrtInstr; | 531 friend class MathSqrtInstr; |
| 531 friend class CheckClassInstr; | 532 friend class CheckClassInstr; |
| 532 friend class CheckSmiInstr; | 533 friend class CheckSmiInstr; |
| 533 friend class CheckArrayBoundInstr; | 534 friend class CheckArrayBoundInstr; |
| 534 friend class CheckEitherNonSmiInstr; | 535 friend class CheckEitherNonSmiInstr; |
| 535 friend class StringCharCodeAtInstr; | 536 friend class StringCharCodeAtInstr; |
| 536 friend class LICM; | 537 friend class LICM; |
| 538 friend class DoubleToSmiInstr; | |
| 537 | 539 |
| 538 intptr_t deopt_id_; | 540 intptr_t deopt_id_; |
| 539 intptr_t lifetime_position_; // Position used by register allocator. | 541 intptr_t lifetime_position_; // Position used by register allocator. |
| 540 Instruction* previous_; | 542 Instruction* previous_; |
| 541 Instruction* next_; | 543 Instruction* next_; |
| 542 Environment* env_; | 544 Environment* env_; |
| 543 intptr_t expr_id_; | 545 intptr_t expr_id_; |
| 544 | 546 |
| 545 DISALLOW_COPY_AND_ASSIGN(Instruction); | 547 DISALLOW_COPY_AND_ASSIGN(Instruction); |
| 546 }; | 548 }; |
| (...skipping 3421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3968 | 3970 |
| 3969 private: | 3971 private: |
| 3970 InstanceCallInstr* instance_call_; | 3972 InstanceCallInstr* instance_call_; |
| 3971 | 3973 |
| 3972 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); | 3974 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); |
| 3973 }; | 3975 }; |
| 3974 | 3976 |
| 3975 | 3977 |
| 3976 class DoubleToIntegerInstr : public TemplateDefinition<1> { | 3978 class DoubleToIntegerInstr : public TemplateDefinition<1> { |
| 3977 public: | 3979 public: |
| 3978 explicit DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) | 3980 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) |
| 3979 : instance_call_(instance_call) { | 3981 : instance_call_(instance_call) { |
| 3980 ASSERT(value != NULL); | 3982 ASSERT(value != NULL); |
| 3981 inputs_[0] = value; | 3983 inputs_[0] = value; |
| 3982 } | 3984 } |
| 3983 | 3985 |
| 3984 Value* value() const { return inputs_[0]; } | 3986 Value* value() const { return inputs_[0]; } |
| 3985 InstanceCallInstr* instance_call() const { return instance_call_; } | 3987 InstanceCallInstr* instance_call() const { return instance_call_; } |
| 3986 | 3988 |
| 3987 DECLARE_INSTRUCTION(DoubleToInteger) | 3989 DECLARE_INSTRUCTION(DoubleToInteger) |
| 3988 virtual RawAbstractType* CompileType() const; | 3990 virtual RawAbstractType* CompileType() const; |
| 3989 | 3991 |
| 3990 virtual intptr_t ArgumentCount() const { return 1; } | 3992 virtual intptr_t ArgumentCount() const { return 1; } |
|
Vyacheslav Egorov (Google)
2012/12/17 12:53:44
I think this should be 0 because pusharguments are
| |
| 3991 | 3993 |
| 3992 virtual bool CanDeoptimize() const { return true; } | 3994 virtual bool CanDeoptimize() const { return true; } |
| 3993 | 3995 |
| 3994 virtual bool HasSideEffect() const { return false; } | 3996 virtual bool HasSideEffect() const { return false; } |
| 3995 | 3997 |
| 3996 // Result could be any of the int types. | 3998 // Result could be any of the int types. |
| 3997 virtual intptr_t ResultCid() const { return kDynamicCid; } | 3999 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 3998 | 4000 |
| 3999 private: | 4001 private: |
| 4000 InstanceCallInstr* instance_call_; | 4002 InstanceCallInstr* instance_call_; |
| 4001 | 4003 |
| 4002 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); | 4004 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); |
| 4003 }; | 4005 }; |
| 4004 | 4006 |
| 4005 | 4007 |
| 4008 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input | |
| 4009 // and creates a Smi. | |
| 4010 class DoubleToSmiInstr : public TemplateDefinition<1> { | |
| 4011 public: | |
| 4012 DoubleToSmiInstr(Value* value, InstanceCallInstr* instance_call) { | |
| 4013 ASSERT(value != NULL); | |
| 4014 inputs_[0] = value; | |
| 4015 deopt_id_ = instance_call->deopt_id(); | |
| 4016 } | |
| 4017 | |
| 4018 Value* value() const { return inputs_[0]; } | |
| 4019 | |
| 4020 DECLARE_INSTRUCTION(DoubleToSmi) | |
| 4021 virtual RawAbstractType* CompileType() const; | |
| 4022 | |
| 4023 virtual intptr_t ArgumentCount() const { return 1; } | |
|
Vyacheslav Egorov (Google)
2012/12/17 12:53:44
I think this should be zero because this instructi
srdjan
2012/12/18 00:12:47
Done.
Vyacheslav Egorov (Google)
2012/12/18 11:45:10
Actually Definition has a default implementation t
srdjan
2012/12/18 16:29:47
Done, thanks.
| |
| 4024 | |
| 4025 virtual bool CanDeoptimize() const { return true; } | |
| 4026 | |
| 4027 virtual bool HasSideEffect() const { return false; } | |
| 4028 | |
| 4029 // Result could be any of the int types. | |
| 4030 virtual intptr_t ResultCid() const { return kSmiCid; } | |
|
Vyacheslav Egorov (Google)
2012/12/17 12:53:44
Comment does not match implementation.
srdjan
2012/12/18 00:12:47
Removed comment.
| |
| 4031 | |
| 4032 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | |
| 4033 ASSERT(idx == 0); | |
| 4034 return kUnboxedDouble; | |
| 4035 } | |
| 4036 | |
| 4037 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } | |
| 4038 | |
| 4039 private: | |
| 4040 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); | |
| 4041 }; | |
| 4042 | |
| 4043 | |
| 4006 class CheckClassInstr : public TemplateInstruction<1> { | 4044 class CheckClassInstr : public TemplateInstruction<1> { |
| 4007 public: | 4045 public: |
| 4008 CheckClassInstr(Value* value, | 4046 CheckClassInstr(Value* value, |
| 4009 intptr_t deopt_id, | 4047 intptr_t deopt_id, |
| 4010 const ICData& unary_checks); | 4048 const ICData& unary_checks); |
| 4011 | 4049 |
| 4012 DECLARE_INSTRUCTION(CheckClass) | 4050 DECLARE_INSTRUCTION(CheckClass) |
| 4013 virtual RawAbstractType* CompileType() const; | 4051 virtual RawAbstractType* CompileType() const; |
| 4014 | 4052 |
| 4015 virtual intptr_t ArgumentCount() const { return 0; } | 4053 virtual intptr_t ArgumentCount() const { return 0; } |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4319 ForwardInstructionIterator* current_iterator_; | 4357 ForwardInstructionIterator* current_iterator_; |
| 4320 | 4358 |
| 4321 private: | 4359 private: |
| 4322 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4360 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4323 }; | 4361 }; |
| 4324 | 4362 |
| 4325 | 4363 |
| 4326 } // namespace dart | 4364 } // namespace dart |
| 4327 | 4365 |
| 4328 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4366 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |