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

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, 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, 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(MethodRecognizer::Kind op_kind,
srdjan 2013/04/25 20:19:25 Why do you need the op_kind (here and below). Do y
Cutch 2013/04/25 20:52:07 I left it there so that it would be easy to suppor
4222 Value* value0,
4223 Value* value1,
4224 Value* value2,
4225 Value* value3,
4226 StaticCallInstr* static_call)
4227 : op_kind_(op_kind) {
4228 SetInputAt(0, value0);
4229 SetInputAt(1, value1);
4230 SetInputAt(2, value2);
4231 SetInputAt(3, value3);
4232 deopt_id_ = static_call->deopt_id();
4233 }
4234
4235 Value* value0() const { return inputs_[0]; }
4236 Value* value1() const { return inputs_[1]; }
4237 Value* value2() const { return inputs_[2]; }
4238 Value* value3() const { return inputs_[3]; }
4239
4240 MethodRecognizer::Kind op_kind() const { return op_kind_; }
4241
4242 virtual void PrintOperandsTo(BufferFormatter* f) const;
4243
4244 virtual bool CanDeoptimize() const { return false; }
4245
4246 virtual bool HasSideEffect() const { return false; }
4247
4248 virtual bool AffectedBySideEffect() const { return false; }
4249
4250 virtual bool AttributesEqual(Instruction* other) const {
4251 return op_kind() == other->AsFloat32x4Constructor()->op_kind();
4252 }
4253
4254 virtual Representation representation() const {
4255 return kUnboxedFloat32x4;
4256 }
4257
4258 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4259 ASSERT(idx >= 0 && idx < 4);
4260 return kUnboxedDouble;
4261 }
4262
4263 virtual intptr_t DeoptimizationTarget() const {
4264 // Direct access since this instruction cannot deoptimize, and the deopt-id
4265 // was inherited from another instruction that could deoptimize.
4266 return deopt_id_;
4267 }
4268
4269 DECLARE_INSTRUCTION(Float32x4Constructor)
4270 virtual CompileType ComputeType() const;
4271
4272 private:
4273 const MethodRecognizer::Kind op_kind_;
4274
4275 DISALLOW_COPY_AND_ASSIGN(Float32x4ConstructorInstr);
4276 };
4277
4278
4279 class Float32x4SplatInstr : public TemplateDefinition<1> {
4280 public:
4281 Float32x4SplatInstr(MethodRecognizer::Kind op_kind, Value* value,
4282 StaticCallInstr* static_call)
srdjan 2013/04/25 20:19:25 Bad indent
4283 : op_kind_(op_kind) {
4284 SetInputAt(0, value);
4285 deopt_id_ = static_call->deopt_id();
4286 }
4287
4288 Value* value() const { return inputs_[0]; }
4289
4290 MethodRecognizer::Kind op_kind() const { return op_kind_; }
4291
4292 virtual void PrintOperandsTo(BufferFormatter* f) const;
4293
4294 virtual bool CanDeoptimize() const { return false; }
4295
4296 virtual bool HasSideEffect() const { return false; }
4297
4298 virtual bool AffectedBySideEffect() const { return false; }
4299
4300 virtual bool AttributesEqual(Instruction* other) const {
4301 return op_kind() == other->AsFloat32x4Splat()->op_kind();
4302 }
4303
4304 virtual Representation representation() const {
4305 return kUnboxedFloat32x4;
4306 }
4307
4308 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4309 ASSERT(idx == 0);
4310 return kUnboxedDouble;
4311 }
4312
4313 virtual intptr_t DeoptimizationTarget() const {
4314 // Direct access since this instruction cannot deoptimize, and the deopt-id
4315 // was inherited from another instruction that could deoptimize.
4316 return deopt_id_;
4317 }
4318
4319 DECLARE_INSTRUCTION(Float32x4Splat)
4320 virtual CompileType ComputeType() const;
4321
4322 private:
4323 const MethodRecognizer::Kind op_kind_;
4324
4325 DISALLOW_COPY_AND_ASSIGN(Float32x4SplatInstr);
4326 };
4327
4328
4329 class Float32x4ZeroInstr : public TemplateDefinition<0> {
4330 public:
4331 Float32x4ZeroInstr(MethodRecognizer::Kind op_kind,
4332 StaticCallInstr* static_call)
4333 : op_kind_(op_kind) {
4334 deopt_id_ = static_call->deopt_id();
4335 }
4336
4337 Value* value() const { return inputs_[0]; }
4338
4339 MethodRecognizer::Kind op_kind() const { return op_kind_; }
4340
4341 virtual void PrintOperandsTo(BufferFormatter* f) const;
4342
4343 virtual bool CanDeoptimize() const { return false; }
4344
4345 virtual bool HasSideEffect() const { return false; }
4346
4347 virtual bool AffectedBySideEffect() const { return false; }
4348
4349 virtual bool AttributesEqual(Instruction* other) const {
4350 return op_kind() == other->AsFloat32x4Zero()->op_kind();
4351 }
4352
4353 virtual Representation representation() const {
4354 return kUnboxedFloat32x4;
4355 }
4356
4357 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4358 UNIMPLEMENTED();
4359 return kUnboxedFloat32x4;
4360 }
4361
4362 virtual intptr_t DeoptimizationTarget() const {
4363 // Direct access since this instruction cannot deoptimize, and the deopt-id
4364 // was inherited from another instruction that could deoptimize.
4365 return deopt_id_;
4366 }
4367
4368 DECLARE_INSTRUCTION(Float32x4Zero)
4369 virtual CompileType ComputeType() const;
4370
4371 private:
4372 const MethodRecognizer::Kind op_kind_;
4373
4374 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr);
4375 };
4376
4377
4209 class BinaryMintOpInstr : public TemplateDefinition<2> { 4378 class BinaryMintOpInstr : public TemplateDefinition<2> {
4210 public: 4379 public:
4211 BinaryMintOpInstr(Token::Kind op_kind, 4380 BinaryMintOpInstr(Token::Kind op_kind,
4212 Value* left, 4381 Value* left,
4213 Value* right, 4382 Value* right,
4214 InstanceCallInstr* instance_call) 4383 InstanceCallInstr* instance_call)
4215 : op_kind_(op_kind), 4384 : op_kind_(op_kind),
4216 instance_call_(instance_call) { 4385 instance_call_(instance_call) {
4217 SetInputAt(0, left); 4386 SetInputAt(0, left);
4218 SetInputAt(1, right); 4387 SetInputAt(1, right);
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
5007 ForwardInstructionIterator* current_iterator_; 5176 ForwardInstructionIterator* current_iterator_;
5008 5177
5009 private: 5178 private:
5010 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 5179 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
5011 }; 5180 };
5012 5181
5013 5182
5014 } // namespace dart 5183 } // namespace dart
5015 5184
5016 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 5185 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698