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

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

Issue 13872020: Inline Float32x4 Getters (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 V(_StringBase, [], StringBaseCharAt, 1062366987) \ 64 V(_StringBase, [], StringBaseCharAt, 1062366987) \
65 V(_IntegerImplementation, toDouble, IntegerToDouble, 1267108971) \ 65 V(_IntegerImplementation, toDouble, IntegerToDouble, 1267108971) \
66 V(_Double, toInt, DoubleToInteger, 362666636) \ 66 V(_Double, toInt, DoubleToInteger, 362666636) \
67 V(_Double, truncateToDouble, DoubleTruncate, 620870996) \ 67 V(_Double, truncateToDouble, DoubleTruncate, 620870996) \
68 V(_Double, roundToDouble, DoubleRound, 620870996) \ 68 V(_Double, roundToDouble, DoubleRound, 620870996) \
69 V(_Double, floorToDouble, DoubleFloor, 620870996) \ 69 V(_Double, floorToDouble, DoubleFloor, 620870996) \
70 V(_Double, ceilToDouble, DoubleCeil, 620870996) \ 70 V(_Double, ceilToDouble, DoubleCeil, 620870996) \
71 V(_Double, pow, DoublePow, 631903778) \ 71 V(_Double, pow, DoublePow, 631903778) \
72 V(_Double, _modulo, DoubleMod, 437099337) \ 72 V(_Double, _modulo, DoubleMod, 437099337) \
73 V(::, sqrt, MathSqrt, 1662640002) \ 73 V(::, sqrt, MathSqrt, 1662640002) \
74 V(_Float32x4, get:xxxx, Float32x4ShuffleXXXX, 925028482) \
75 V(_Float32x4, get:yyyy, Float32x4ShuffleYYYY, 925028482) \
76 V(_Float32x4, get:zzzz, Float32x4ShuffleZZZZ, 925028482) \
77 V(_Float32x4, get:wwww, Float32x4ShuffleWWWW, 925028482) \
78 V(_Float32x4, get:x, Float32x4ShuffleX, 502733830) \
79 V(_Float32x4, get:y, Float32x4ShuffleY, 502733830) \
80 V(_Float32x4, get:z, Float32x4ShuffleZ, 502733830) \
81 V(_Float32x4, get:w, Float32x4ShuffleW, 502733830) \
74 82
75 // Class that recognizes the name and owner of a function and returns the 83 // Class that recognizes the name and owner of a function and returns the
76 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable 84 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable
77 // functions. 85 // functions.
78 class MethodRecognizer : public AllStatic { 86 class MethodRecognizer : public AllStatic {
79 public: 87 public:
80 enum Kind { 88 enum Kind {
81 kUnknown, 89 kUnknown,
82 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name, fp) k##enum_name, 90 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name, fp) k##enum_name,
83 RECOGNIZED_LIST(DEFINE_ENUM_LIST) 91 RECOGNIZED_LIST(DEFINE_ENUM_LIST)
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 M(BinaryMintOp) \ 506 M(BinaryMintOp) \
499 M(ShiftMintOp) \ 507 M(ShiftMintOp) \
500 M(UnaryMintOp) \ 508 M(UnaryMintOp) \
501 M(CheckArrayBound) \ 509 M(CheckArrayBound) \
502 M(Constraint) \ 510 M(Constraint) \
503 M(StringFromCharCode) \ 511 M(StringFromCharCode) \
504 M(InvokeMathCFunction) \ 512 M(InvokeMathCFunction) \
505 M(GuardField) \ 513 M(GuardField) \
506 M(IfThenElse) \ 514 M(IfThenElse) \
507 M(BinaryFloat32x4Op) \ 515 M(BinaryFloat32x4Op) \
516 M(Float32x4Shuffle) \
508 517
509 #define FORWARD_DECLARATION(type) class type##Instr; 518 #define FORWARD_DECLARATION(type) class type##Instr;
510 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) 519 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION)
511 #undef FORWARD_DECLARATION 520 #undef FORWARD_DECLARATION
512 521
513 522
514 // Functions required in all concrete instruction classes. 523 // Functions required in all concrete instruction classes.
515 #define DECLARE_INSTRUCTION(type) \ 524 #define DECLARE_INSTRUCTION(type) \
516 virtual Tag tag() const { return k##type; } \ 525 virtual Tag tag() const { return k##type; } \
517 virtual void Accept(FlowGraphVisitor* visitor); \ 526 virtual void Accept(FlowGraphVisitor* visitor); \
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 757
749 private: 758 private:
750 friend class Definition; // Needed for InsertBefore, InsertAfter. 759 friend class Definition; // Needed for InsertBefore, InsertAfter.
751 760
752 // Classes that set deopt_id_. 761 // Classes that set deopt_id_.
753 friend class UnboxIntegerInstr; 762 friend class UnboxIntegerInstr;
754 friend class UnboxDoubleInstr; 763 friend class UnboxDoubleInstr;
755 friend class UnboxFloat32x4Instr; 764 friend class UnboxFloat32x4Instr;
756 friend class BinaryDoubleOpInstr; 765 friend class BinaryDoubleOpInstr;
757 friend class BinaryFloat32x4OpInstr; 766 friend class BinaryFloat32x4OpInstr;
767 friend class Float32x4ShuffleInstr;
758 friend class BinaryMintOpInstr; 768 friend class BinaryMintOpInstr;
759 friend class BinarySmiOpInstr; 769 friend class BinarySmiOpInstr;
760 friend class UnarySmiOpInstr; 770 friend class UnarySmiOpInstr;
761 friend class ShiftMintOpInstr; 771 friend class ShiftMintOpInstr;
762 friend class UnaryMintOpInstr; 772 friend class UnaryMintOpInstr;
763 friend class MathSqrtInstr; 773 friend class MathSqrtInstr;
764 friend class CheckClassInstr; 774 friend class CheckClassInstr;
765 friend class GuardFieldInstr; 775 friend class GuardFieldInstr;
766 friend class CheckSmiInstr; 776 friend class CheckSmiInstr;
767 friend class CheckArrayBoundInstr; 777 friend class CheckArrayBoundInstr;
(...skipping 3364 matching lines...) Expand 10 before | Expand all | Expand 10 after
4132 DECLARE_INSTRUCTION(BinaryFloat32x4Op) 4142 DECLARE_INSTRUCTION(BinaryFloat32x4Op)
4133 virtual CompileType ComputeType() const; 4143 virtual CompileType ComputeType() const;
4134 4144
4135 private: 4145 private:
4136 const Token::Kind op_kind_; 4146 const Token::Kind op_kind_;
4137 4147
4138 DISALLOW_COPY_AND_ASSIGN(BinaryFloat32x4OpInstr); 4148 DISALLOW_COPY_AND_ASSIGN(BinaryFloat32x4OpInstr);
4139 }; 4149 };
4140 4150
4141 4151
4152 class Float32x4ShuffleInstr : public TemplateDefinition<1> {
4153 public:
4154 Float32x4ShuffleInstr(MethodRecognizer::Kind op_kind, Value* value,
4155 InstanceCallInstr* instance_call)
4156 : op_kind_(op_kind) {
4157 SetInputAt(0, value);
4158 deopt_id_ = instance_call->deopt_id();
4159 }
4160
4161 Value* value() const { return inputs_[0]; }
4162
4163 MethodRecognizer::Kind op_kind() const { return op_kind_; }
4164
4165 virtual void PrintOperandsTo(BufferFormatter* f) const;
4166
4167 virtual bool CanDeoptimize() const { return false; }
4168
4169 virtual bool HasSideEffect() const { return false; }
4170
4171 virtual bool AffectedBySideEffect() const { return false; }
4172
4173 virtual bool AttributesEqual(Instruction* other) const {
4174 return op_kind() == other->AsFloat32x4Shuffle()->op_kind();
4175 }
4176
4177 virtual Representation representation() const {
4178 if (op_kind_ == MethodRecognizer::kFloat32x4ShuffleX ||
srdjan 2013/04/22 22:28:18 Use extra parentheses.
Cutch 2013/04/22 23:05:41 Done.
4179 op_kind_ == MethodRecognizer::kFloat32x4ShuffleY ||
4180 op_kind_ == MethodRecognizer::kFloat32x4ShuffleZ ||
4181 op_kind_ == MethodRecognizer::kFloat32x4ShuffleW) {
4182 return kUnboxedDouble;
4183 }
4184 return kUnboxedFloat32x4;
4185 }
4186
4187 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4188 ASSERT((idx == 0));
srdjan 2013/04/22 22:28:18 Don't use extra parentheses :-)
Cutch 2013/04/22 23:05:41 Done.
4189 return kUnboxedFloat32x4;
4190 }
4191
4192 virtual intptr_t DeoptimizationTarget() const {
4193 // Direct access since this instruction cannot deoptimize, and the deopt-id
4194 // was inherited from another instruction that could deoptimize.
4195 return deopt_id_;
4196 }
4197
4198 DECLARE_INSTRUCTION(Float32x4Shuffle)
4199 virtual CompileType ComputeType() const;
4200
4201 private:
4202 const MethodRecognizer::Kind op_kind_;
4203
4204 DISALLOW_COPY_AND_ASSIGN(Float32x4ShuffleInstr);
4205 };
4206
4207
4142 class BinaryMintOpInstr : public TemplateDefinition<2> { 4208 class BinaryMintOpInstr : public TemplateDefinition<2> {
4143 public: 4209 public:
4144 BinaryMintOpInstr(Token::Kind op_kind, 4210 BinaryMintOpInstr(Token::Kind op_kind,
4145 Value* left, 4211 Value* left,
4146 Value* right, 4212 Value* right,
4147 InstanceCallInstr* instance_call) 4213 InstanceCallInstr* instance_call)
4148 : op_kind_(op_kind), 4214 : op_kind_(op_kind),
4149 instance_call_(instance_call) { 4215 instance_call_(instance_call) {
4150 SetInputAt(0, left); 4216 SetInputAt(0, left);
4151 SetInputAt(1, right); 4217 SetInputAt(1, right);
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
4940 ForwardInstructionIterator* current_iterator_; 5006 ForwardInstructionIterator* current_iterator_;
4941 5007
4942 private: 5008 private:
4943 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 5009 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4944 }; 5010 };
4945 5011
4946 5012
4947 } // namespace dart 5013 } // namespace dart
4948 5014
4949 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 5015 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698