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

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

Issue 13936009: Inline Float32x4 constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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, Float32x4., Float32x4Constructor, 1327837070) \
75 V(Float32x4, Float32x4.zero, Float32x4Zero, 927169529) \
76 V(Float32x4, Float32x4.splat, Float32x4Splat, 1778587275) \
74 V(_Float32x4, get:xxxx, Float32x4ShuffleXXXX, 42621627) \ 77 V(_Float32x4, get:xxxx, Float32x4ShuffleXXXX, 42621627) \
75 V(_Float32x4, get:yyyy, Float32x4ShuffleYYYY, 42621627) \ 78 V(_Float32x4, get:yyyy, Float32x4ShuffleYYYY, 42621627) \
76 V(_Float32x4, get:zzzz, Float32x4ShuffleZZZZ, 42621627) \ 79 V(_Float32x4, get:zzzz, Float32x4ShuffleZZZZ, 42621627) \
77 V(_Float32x4, get:wwww, Float32x4ShuffleWWWW, 42621627) \ 80 V(_Float32x4, get:wwww, Float32x4ShuffleWWWW, 42621627) \
78 V(_Float32x4, get:x, Float32x4ShuffleX, 211144022) \ 81 V(_Float32x4, get:x, Float32x4ShuffleX, 211144022) \
79 V(_Float32x4, get:y, Float32x4ShuffleY, 211144022) \ 82 V(_Float32x4, get:y, Float32x4ShuffleY, 211144022) \
80 V(_Float32x4, get:z, Float32x4ShuffleZ, 211144022) \ 83 V(_Float32x4, get:z, Float32x4ShuffleZ, 211144022) \
81 V(_Float32x4, get:w, Float32x4ShuffleW, 211144022) \ 84 V(_Float32x4, get:w, Float32x4ShuffleW, 211144022) \
82 85
83 // Class that recognizes the name and owner of a function and returns the 86 // Class that recognizes the name and owner of a function and returns the
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 M(ShiftMintOp) \ 510 M(ShiftMintOp) \
508 M(UnaryMintOp) \ 511 M(UnaryMintOp) \
509 M(CheckArrayBound) \ 512 M(CheckArrayBound) \
510 M(Constraint) \ 513 M(Constraint) \
511 M(StringFromCharCode) \ 514 M(StringFromCharCode) \
512 M(InvokeMathCFunction) \ 515 M(InvokeMathCFunction) \
513 M(GuardField) \ 516 M(GuardField) \
514 M(IfThenElse) \ 517 M(IfThenElse) \
515 M(BinaryFloat32x4Op) \ 518 M(BinaryFloat32x4Op) \
516 M(Float32x4Shuffle) \ 519 M(Float32x4Shuffle) \
520 M(Float32x4Constructor) \
521 M(Float32x4Zero) \
522 M(Float32x4Splat) \
523
517 524
518 #define FORWARD_DECLARATION(type) class type##Instr; 525 #define FORWARD_DECLARATION(type) class type##Instr;
519 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) 526 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION)
520 #undef FORWARD_DECLARATION 527 #undef FORWARD_DECLARATION
521 528
522 529
523 // Functions required in all concrete instruction classes. 530 // Functions required in all concrete instruction classes.
524 #define DECLARE_INSTRUCTION(type) \ 531 #define DECLARE_INSTRUCTION(type) \
525 virtual Tag tag() const { return k##type; } \ 532 virtual Tag tag() const { return k##type; } \
526 virtual void Accept(FlowGraphVisitor* visitor); \ 533 virtual void Accept(FlowGraphVisitor* visitor); \
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 764
758 private: 765 private:
759 friend class Definition; // Needed for InsertBefore, InsertAfter. 766 friend class Definition; // Needed for InsertBefore, InsertAfter.
760 767
761 // Classes that set deopt_id_. 768 // Classes that set deopt_id_.
762 friend class UnboxIntegerInstr; 769 friend class UnboxIntegerInstr;
763 friend class UnboxDoubleInstr; 770 friend class UnboxDoubleInstr;
764 friend class UnboxFloat32x4Instr; 771 friend class UnboxFloat32x4Instr;
765 friend class BinaryDoubleOpInstr; 772 friend class BinaryDoubleOpInstr;
766 friend class BinaryFloat32x4OpInstr; 773 friend class BinaryFloat32x4OpInstr;
774 friend class Float32x4ZeroInstr;
775 friend class Float32x4SplatInstr;
767 friend class Float32x4ShuffleInstr; 776 friend class Float32x4ShuffleInstr;
777 friend class Float32x4ConstructorInstr;
768 friend class BinaryMintOpInstr; 778 friend class BinaryMintOpInstr;
769 friend class BinarySmiOpInstr; 779 friend class BinarySmiOpInstr;
770 friend class UnarySmiOpInstr; 780 friend class UnarySmiOpInstr;
771 friend class ShiftMintOpInstr; 781 friend class ShiftMintOpInstr;
772 friend class UnaryMintOpInstr; 782 friend class UnaryMintOpInstr;
773 friend class MathSqrtInstr; 783 friend class MathSqrtInstr;
774 friend class CheckClassInstr; 784 friend class CheckClassInstr;
775 friend class GuardFieldInstr; 785 friend class GuardFieldInstr;
776 friend class CheckSmiInstr; 786 friend class CheckSmiInstr;
777 friend class CheckArrayBoundInstr; 787 friend class CheckArrayBoundInstr;
(...skipping 3421 matching lines...) Expand 10 before | Expand all | Expand 10 after
4199 DECLARE_INSTRUCTION(Float32x4Shuffle) 4209 DECLARE_INSTRUCTION(Float32x4Shuffle)
4200 virtual CompileType ComputeType() const; 4210 virtual CompileType ComputeType() const;
4201 4211
4202 private: 4212 private:
4203 const MethodRecognizer::Kind op_kind_; 4213 const MethodRecognizer::Kind op_kind_;
4204 4214
4205 DISALLOW_COPY_AND_ASSIGN(Float32x4ShuffleInstr); 4215 DISALLOW_COPY_AND_ASSIGN(Float32x4ShuffleInstr);
4206 }; 4216 };
4207 4217
4208 4218
4219 class Float32x4ConstructorInstr : public TemplateDefinition<4> {
4220 public:
4221 Float32x4ConstructorInstr(Value* value0, Value* value1, Value* value2,
4222 Value* value3, StaticCallInstr* static_call) {
4223 SetInputAt(0, value0);
4224 SetInputAt(1, value1);
4225 SetInputAt(2, value2);
4226 SetInputAt(3, value3);
4227 deopt_id_ = static_call->deopt_id();
4228 }
4229
4230 Value* value0() const { return inputs_[0]; }
4231 Value* value1() const { return inputs_[1]; }
4232 Value* value2() const { return inputs_[2]; }
4233 Value* value3() const { return inputs_[3]; }
4234
4235 virtual void PrintOperandsTo(BufferFormatter* f) const;
4236
4237 virtual bool CanDeoptimize() const { return false; }
4238
4239 virtual bool HasSideEffect() const { return false; }
4240
4241 virtual bool AffectedBySideEffect() const { return false; }
4242
4243 virtual bool AttributesEqual(Instruction* other) const { return true; }
4244
4245 virtual Representation representation() const {
4246 return kUnboxedFloat32x4;
4247 }
4248
4249 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4250 ASSERT(idx >= 0 && idx < 4);
4251 return kUnboxedDouble;
4252 }
4253
4254 virtual intptr_t DeoptimizationTarget() const {
4255 // Direct access since this instruction cannot deoptimize, and the deopt-id
4256 // was inherited from another instruction that could deoptimize.
4257 return deopt_id_;
4258 }
4259
4260 DECLARE_INSTRUCTION(Float32x4Constructor)
4261 virtual CompileType ComputeType() const;
4262
4263 private:
4264 DISALLOW_COPY_AND_ASSIGN(Float32x4ConstructorInstr);
4265 };
4266
4267
4268 class Float32x4SplatInstr : public TemplateDefinition<1> {
4269 public:
4270 Float32x4SplatInstr(Value* value, StaticCallInstr* static_call) {
4271 SetInputAt(0, value);
4272 deopt_id_ = static_call->deopt_id();
4273 }
4274
4275 Value* value() const { return inputs_[0]; }
4276
4277 virtual void PrintOperandsTo(BufferFormatter* f) const;
4278
4279 virtual bool CanDeoptimize() const { return false; }
4280
4281 virtual bool HasSideEffect() const { return false; }
4282
4283 virtual bool AffectedBySideEffect() const { return false; }
4284
4285 virtual bool AttributesEqual(Instruction* other) const { return true; }
4286
4287 virtual Representation representation() const {
4288 return kUnboxedFloat32x4;
4289 }
4290
4291 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4292 ASSERT(idx == 0);
4293 return kUnboxedDouble;
4294 }
4295
4296 virtual intptr_t DeoptimizationTarget() const {
4297 // Direct access since this instruction cannot deoptimize, and the deopt-id
4298 // was inherited from another instruction that could deoptimize.
4299 return deopt_id_;
4300 }
4301
4302 DECLARE_INSTRUCTION(Float32x4Splat)
4303 virtual CompileType ComputeType() const;
4304
4305 private:
4306 DISALLOW_COPY_AND_ASSIGN(Float32x4SplatInstr);
4307 };
4308
4309
4310 class Float32x4ZeroInstr : public TemplateDefinition<0> {
4311 public:
4312 explicit Float32x4ZeroInstr(StaticCallInstr* static_call) {
4313 deopt_id_ = static_call->deopt_id();
4314 }
4315
4316 Value* value() const { return inputs_[0]; }
4317
4318 virtual void PrintOperandsTo(BufferFormatter* f) const;
4319
4320 virtual bool CanDeoptimize() const { return false; }
4321
4322 virtual bool HasSideEffect() const { return false; }
4323
4324 virtual bool AffectedBySideEffect() const { return false; }
4325
4326 virtual bool AttributesEqual(Instruction* other) const { return true; }
4327
4328 virtual Representation representation() const {
4329 return kUnboxedFloat32x4;
4330 }
4331
4332 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4333 UNIMPLEMENTED();
4334 return kUnboxedFloat32x4;
4335 }
4336
4337 virtual intptr_t DeoptimizationTarget() const {
4338 // Direct access since this instruction cannot deoptimize, and the deopt-id
4339 // was inherited from another instruction that could deoptimize.
4340 return deopt_id_;
4341 }
4342
4343 DECLARE_INSTRUCTION(Float32x4Zero)
4344 virtual CompileType ComputeType() const;
4345
4346 private:
4347 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr);
4348 };
4349
4350
4209 class BinaryMintOpInstr : public TemplateDefinition<2> { 4351 class BinaryMintOpInstr : public TemplateDefinition<2> {
4210 public: 4352 public:
4211 BinaryMintOpInstr(Token::Kind op_kind, 4353 BinaryMintOpInstr(Token::Kind op_kind,
4212 Value* left, 4354 Value* left,
4213 Value* right, 4355 Value* right,
4214 InstanceCallInstr* instance_call) 4356 InstanceCallInstr* instance_call)
4215 : op_kind_(op_kind), 4357 : op_kind_(op_kind),
4216 instance_call_(instance_call) { 4358 instance_call_(instance_call) {
4217 SetInputAt(0, left); 4359 SetInputAt(0, left);
4218 SetInputAt(1, right); 4360 SetInputAt(1, right);
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
5007 ForwardInstructionIterator* current_iterator_; 5149 ForwardInstructionIterator* current_iterator_;
5008 5150
5009 private: 5151 private:
5010 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 5152 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
5011 }; 5153 };
5012 5154
5013 5155
5014 } // namespace dart 5156 } // namespace dart
5015 5157
5016 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 5158 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698