Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 11568044: Add DoubleToSmi optimistically, preventing boxing/unboxing of doubles and propagate smi-nessof the … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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; }
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 bool CanDeoptimize() const { return true; }
4024
4025 virtual bool HasSideEffect() const { return false; }
4026
4027 virtual intptr_t ResultCid() const { return kSmiCid; }
4028
4029 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4030 ASSERT(idx == 0);
4031 return kUnboxedDouble;
4032 }
4033
4034 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
4035
4036 private:
4037 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr);
4038 };
4039
4040
4006 class CheckClassInstr : public TemplateInstruction<1> { 4041 class CheckClassInstr : public TemplateInstruction<1> {
4007 public: 4042 public:
4008 CheckClassInstr(Value* value, 4043 CheckClassInstr(Value* value,
4009 intptr_t deopt_id, 4044 intptr_t deopt_id,
4010 const ICData& unary_checks); 4045 const ICData& unary_checks);
4011 4046
4012 DECLARE_INSTRUCTION(CheckClass) 4047 DECLARE_INSTRUCTION(CheckClass)
4013 virtual RawAbstractType* CompileType() const; 4048 virtual RawAbstractType* CompileType() const;
4014 4049
4015 virtual intptr_t ArgumentCount() const { return 0; } 4050 virtual intptr_t ArgumentCount() const { return 0; }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
4319 ForwardInstructionIterator* current_iterator_; 4354 ForwardInstructionIterator* current_iterator_;
4320 4355
4321 private: 4356 private:
4322 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4357 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4323 }; 4358 };
4324 4359
4325 4360
4326 } // namespace dart 4361 } // namespace dart
4327 4362
4328 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4363 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698