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

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

Issue 11573044: Inline Doubles truncate and round. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months 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
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 26 matching lines...) Expand all
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
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
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 3476 matching lines...) Expand 10 before | Expand all | Expand 10 after
4000 return kUnboxedDouble; 4004 return kUnboxedDouble;
4001 } 4005 }
4002 4006
4003 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 4007 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
4004 4008
4005 private: 4009 private:
4006 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); 4010 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr);
4007 }; 4011 };
4008 4012
4009 4013
4014 class DoubleToDoubleInstr : public TemplateDefinition<1> {
4015 public:
4016 DoubleToDoubleInstr(Value* value,
4017 InstanceCallInstr* instance_call,
4018 MethodRecognizer::Kind recognized_kind)
4019 : recognized_kind_(recognized_kind) {
4020 ASSERT(value != NULL);
4021 inputs_[0] = value;
4022 deopt_id_ = instance_call->deopt_id();
4023 }
4024
4025 Value* value() const { return inputs_[0]; }
4026
4027 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; }
4028
4029 DECLARE_INSTRUCTION(DoubleToDouble)
4030 virtual RawAbstractType* CompileType() const;
4031
4032 virtual bool CanDeoptimize() const { return false; }
4033
4034 virtual bool HasSideEffect() const { return false; }
4035
4036 // Result could be any of the int types.
Florian Schneider 2013/01/08 14:24:04 Comment is not valid here.
srdjan 2013/01/10 22:35:52 Removed
4037 virtual intptr_t ResultCid() const { return kDoubleCid; }
4038
4039 virtual Representation representation() const {
4040 return kUnboxedDouble;
4041 }
4042
4043 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4044 ASSERT(idx == 0);
4045 return kUnboxedDouble;
4046 }
4047
4048 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
4049
4050 private:
4051 const MethodRecognizer::Kind recognized_kind_;
4052
4053 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr);
4054 };
4055
4056
4010 class CheckClassInstr : public TemplateInstruction<1> { 4057 class CheckClassInstr : public TemplateInstruction<1> {
4011 public: 4058 public:
4012 CheckClassInstr(Value* value, 4059 CheckClassInstr(Value* value,
4013 intptr_t deopt_id, 4060 intptr_t deopt_id,
4014 const ICData& unary_checks); 4061 const ICData& unary_checks);
4015 4062
4016 DECLARE_INSTRUCTION(CheckClass) 4063 DECLARE_INSTRUCTION(CheckClass)
4017 virtual RawAbstractType* CompileType() const; 4064 virtual RawAbstractType* CompileType() const;
4018 4065
4019 virtual intptr_t ArgumentCount() const { return 0; } 4066 virtual intptr_t ArgumentCount() const { return 0; }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
4323 ForwardInstructionIterator* current_iterator_; 4370 ForwardInstructionIterator* current_iterator_;
4324 4371
4325 private: 4372 private:
4326 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4373 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4327 }; 4374 };
4328 4375
4329 4376
4330 } // namespace dart 4377 } // namespace dart
4331 4378
4332 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4379 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698