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 14288006: Inline Float32x4 comparison. (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
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language_arm.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) 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 V(Float32x4, Float32x4.zero, Float32x4Zero, 927169529) \ 75 V(Float32x4, Float32x4.zero, Float32x4Zero, 927169529) \
76 V(Float32x4, Float32x4.splat, Float32x4Splat, 1778587275) \ 76 V(Float32x4, Float32x4.splat, Float32x4Splat, 1778587275) \
77 V(_Float32x4, get:xxxx, Float32x4ShuffleXXXX, 42621627) \ 77 V(_Float32x4, get:xxxx, Float32x4ShuffleXXXX, 42621627) \
78 V(_Float32x4, get:yyyy, Float32x4ShuffleYYYY, 42621627) \ 78 V(_Float32x4, get:yyyy, Float32x4ShuffleYYYY, 42621627) \
79 V(_Float32x4, get:zzzz, Float32x4ShuffleZZZZ, 42621627) \ 79 V(_Float32x4, get:zzzz, Float32x4ShuffleZZZZ, 42621627) \
80 V(_Float32x4, get:wwww, Float32x4ShuffleWWWW, 42621627) \ 80 V(_Float32x4, get:wwww, Float32x4ShuffleWWWW, 42621627) \
81 V(_Float32x4, get:x, Float32x4ShuffleX, 211144022) \ 81 V(_Float32x4, get:x, Float32x4ShuffleX, 211144022) \
82 V(_Float32x4, get:y, Float32x4ShuffleY, 211144022) \ 82 V(_Float32x4, get:y, Float32x4ShuffleY, 211144022) \
83 V(_Float32x4, get:z, Float32x4ShuffleZ, 211144022) \ 83 V(_Float32x4, get:z, Float32x4ShuffleZ, 211144022) \
84 V(_Float32x4, get:w, Float32x4ShuffleW, 211144022) \ 84 V(_Float32x4, get:w, Float32x4ShuffleW, 211144022) \
85 V(_Float32x4, _cmpequal, Float32x4Equal, 548944488) \
86 V(_Float32x4, _cmpgt, Float32x4GreaterThan, 548944488) \
87 V(_Float32x4, _cmpgte, Float32x4GreaterThanOrEqual, 548944488) \
88 V(_Float32x4, _cmplt, Float32x4LessThan, 548944488) \
89 V(_Float32x4, _cmplte, Float32x4LessThanOrEqual, 548944488) \
90 V(_Float32x4, _cmpnequal, Float32x4NotEqual, 548944488) \
85 91
86 // Class that recognizes the name and owner of a function and returns the 92 // Class that recognizes the name and owner of a function and returns the
87 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable 93 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable
88 // functions. 94 // functions.
89 class MethodRecognizer : public AllStatic { 95 class MethodRecognizer : public AllStatic {
90 public: 96 public:
91 enum Kind { 97 enum Kind {
92 kUnknown, 98 kUnknown,
93 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name, fp) k##enum_name, 99 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name, fp) k##enum_name,
94 RECOGNIZED_LIST(DEFINE_ENUM_LIST) 100 RECOGNIZED_LIST(DEFINE_ENUM_LIST)
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 M(CheckClass) \ 503 M(CheckClass) \
498 M(CheckSmi) \ 504 M(CheckSmi) \
499 M(Constant) \ 505 M(Constant) \
500 M(CheckEitherNonSmi) \ 506 M(CheckEitherNonSmi) \
501 M(BinaryDoubleOp) \ 507 M(BinaryDoubleOp) \
502 M(MathSqrt) \ 508 M(MathSqrt) \
503 M(UnboxDouble) \ 509 M(UnboxDouble) \
504 M(BoxDouble) \ 510 M(BoxDouble) \
505 M(BoxFloat32x4) \ 511 M(BoxFloat32x4) \
506 M(UnboxFloat32x4) \ 512 M(UnboxFloat32x4) \
513 M(BoxUint32x4) \
514 M(UnboxUint32x4) \
507 M(UnboxInteger) \ 515 M(UnboxInteger) \
508 M(BoxInteger) \ 516 M(BoxInteger) \
509 M(BinaryMintOp) \ 517 M(BinaryMintOp) \
510 M(ShiftMintOp) \ 518 M(ShiftMintOp) \
511 M(UnaryMintOp) \ 519 M(UnaryMintOp) \
512 M(CheckArrayBound) \ 520 M(CheckArrayBound) \
513 M(Constraint) \ 521 M(Constraint) \
514 M(StringFromCharCode) \ 522 M(StringFromCharCode) \
515 M(InvokeMathCFunction) \ 523 M(InvokeMathCFunction) \
516 M(GuardField) \ 524 M(GuardField) \
517 M(IfThenElse) \ 525 M(IfThenElse) \
518 M(BinaryFloat32x4Op) \ 526 M(BinaryFloat32x4Op) \
519 M(Float32x4Shuffle) \ 527 M(Float32x4Shuffle) \
520 M(Float32x4Constructor) \ 528 M(Float32x4Constructor) \
521 M(Float32x4Zero) \ 529 M(Float32x4Zero) \
522 M(Float32x4Splat) \ 530 M(Float32x4Splat) \
531 M(Float32x4Comparison) \
523 532
524 533
525 #define FORWARD_DECLARATION(type) class type##Instr; 534 #define FORWARD_DECLARATION(type) class type##Instr;
526 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) 535 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION)
527 #undef FORWARD_DECLARATION 536 #undef FORWARD_DECLARATION
528 537
529 538
530 // Functions required in all concrete instruction classes. 539 // Functions required in all concrete instruction classes.
531 #define DECLARE_INSTRUCTION(type) \ 540 #define DECLARE_INSTRUCTION(type) \
532 virtual Tag tag() const { return k##type; } \ 541 virtual Tag tag() const { return k##type; } \
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 return deopt_id_; 771 return deopt_id_;
763 } 772 }
764 773
765 private: 774 private:
766 friend class Definition; // Needed for InsertBefore, InsertAfter. 775 friend class Definition; // Needed for InsertBefore, InsertAfter.
767 776
768 // Classes that set deopt_id_. 777 // Classes that set deopt_id_.
769 friend class UnboxIntegerInstr; 778 friend class UnboxIntegerInstr;
770 friend class UnboxDoubleInstr; 779 friend class UnboxDoubleInstr;
771 friend class UnboxFloat32x4Instr; 780 friend class UnboxFloat32x4Instr;
781 friend class UnboxUint32x4Instr;
772 friend class BinaryDoubleOpInstr; 782 friend class BinaryDoubleOpInstr;
773 friend class BinaryFloat32x4OpInstr; 783 friend class BinaryFloat32x4OpInstr;
774 friend class Float32x4ZeroInstr; 784 friend class Float32x4ZeroInstr;
775 friend class Float32x4SplatInstr; 785 friend class Float32x4SplatInstr;
776 friend class Float32x4ShuffleInstr; 786 friend class Float32x4ShuffleInstr;
777 friend class Float32x4ConstructorInstr; 787 friend class Float32x4ConstructorInstr;
788 friend class Float32x4ComparisonInstr;
778 friend class BinaryMintOpInstr; 789 friend class BinaryMintOpInstr;
779 friend class BinarySmiOpInstr; 790 friend class BinarySmiOpInstr;
780 friend class UnarySmiOpInstr; 791 friend class UnarySmiOpInstr;
781 friend class ShiftMintOpInstr; 792 friend class ShiftMintOpInstr;
782 friend class UnaryMintOpInstr; 793 friend class UnaryMintOpInstr;
783 friend class MathSqrtInstr; 794 friend class MathSqrtInstr;
784 friend class CheckClassInstr; 795 friend class CheckClassInstr;
785 friend class GuardFieldInstr; 796 friend class GuardFieldInstr;
786 friend class CheckSmiInstr; 797 friend class CheckSmiInstr;
787 friend class CheckArrayBoundInstr; 798 friend class CheckArrayBoundInstr;
(...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 } 3892 }
3882 3893
3883 DECLARE_INSTRUCTION(BoxFloat32x4) 3894 DECLARE_INSTRUCTION(BoxFloat32x4)
3884 virtual CompileType ComputeType() const; 3895 virtual CompileType ComputeType() const;
3885 3896
3886 private: 3897 private:
3887 DISALLOW_COPY_AND_ASSIGN(BoxFloat32x4Instr); 3898 DISALLOW_COPY_AND_ASSIGN(BoxFloat32x4Instr);
3888 }; 3899 };
3889 3900
3890 3901
3902 class BoxUint32x4Instr : public TemplateDefinition<1> {
3903 public:
3904 explicit BoxUint32x4Instr(Value* value) {
3905 SetInputAt(0, value);
3906 }
3907
3908 Value* value() const { return inputs_[0]; }
3909
3910 virtual bool CanDeoptimize() const { return false; }
3911
3912 virtual bool HasSideEffect() const { return false; }
3913
3914 virtual bool AffectedBySideEffect() const { return false; }
3915 virtual bool AttributesEqual(Instruction* other) const { return true; }
3916
3917 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3918 ASSERT(idx == 0);
3919 return kUnboxedUint32x4;
3920 }
3921
3922 DECLARE_INSTRUCTION(BoxUint32x4)
3923 virtual CompileType ComputeType() const;
3924
3925 private:
3926 DISALLOW_COPY_AND_ASSIGN(BoxUint32x4Instr);
3927 };
3928
3929
3891 class BoxIntegerInstr : public TemplateDefinition<1> { 3930 class BoxIntegerInstr : public TemplateDefinition<1> {
3892 public: 3931 public:
3893 explicit BoxIntegerInstr(Value* value) { 3932 explicit BoxIntegerInstr(Value* value) {
3894 SetInputAt(0, value); 3933 SetInputAt(0, value);
3895 } 3934 }
3896 3935
3897 Value* value() const { return inputs_[0]; } 3936 Value* value() const { return inputs_[0]; }
3898 3937
3899 virtual bool CanDeoptimize() const { return false; } 3938 virtual bool CanDeoptimize() const { return false; }
3900 3939
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
3970 virtual bool AttributesEqual(Instruction* other) const { return true; } 4009 virtual bool AttributesEqual(Instruction* other) const { return true; }
3971 4010
3972 DECLARE_INSTRUCTION(UnboxFloat32x4) 4011 DECLARE_INSTRUCTION(UnboxFloat32x4)
3973 virtual CompileType ComputeType() const; 4012 virtual CompileType ComputeType() const;
3974 4013
3975 private: 4014 private:
3976 DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr); 4015 DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr);
3977 }; 4016 };
3978 4017
3979 4018
4019 class UnboxUint32x4Instr : public TemplateDefinition<1> {
4020 public:
4021 UnboxUint32x4Instr(Value* value, intptr_t deopt_id) {
4022 SetInputAt(0, value);
4023 deopt_id_ = deopt_id;
4024 }
4025
4026 Value* value() const { return inputs_[0]; }
4027
4028 virtual bool CanDeoptimize() const {
4029 return (value()->Type()->ToCid() != kUint32x4Cid);
4030 }
4031
4032 virtual bool HasSideEffect() const { return false; }
4033
4034 virtual Representation representation() const {
4035 return kUnboxedUint32x4;
4036 }
4037
4038 virtual bool AffectedBySideEffect() const { return false; }
4039 virtual bool AttributesEqual(Instruction* other) const { return true; }
4040
4041 DECLARE_INSTRUCTION(UnboxUint32x4)
4042 virtual CompileType ComputeType() const;
4043
4044 private:
4045 DISALLOW_COPY_AND_ASSIGN(UnboxUint32x4Instr);
4046 };
4047
4048
3980 class UnboxIntegerInstr : public TemplateDefinition<1> { 4049 class UnboxIntegerInstr : public TemplateDefinition<1> {
3981 public: 4050 public:
3982 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { 4051 UnboxIntegerInstr(Value* value, intptr_t deopt_id) {
3983 SetInputAt(0, value); 4052 SetInputAt(0, value);
3984 deopt_id_ = deopt_id; 4053 deopt_id_ = deopt_id;
3985 } 4054 }
3986 4055
3987 Value* value() const { return inputs_[0]; } 4056 Value* value() const { return inputs_[0]; }
3988 4057
3989 virtual bool CanDeoptimize() const { 4058 virtual bool CanDeoptimize() const {
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
4341 } 4410 }
4342 4411
4343 DECLARE_INSTRUCTION(Float32x4Zero) 4412 DECLARE_INSTRUCTION(Float32x4Zero)
4344 virtual CompileType ComputeType() const; 4413 virtual CompileType ComputeType() const;
4345 4414
4346 private: 4415 private:
4347 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr); 4416 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr);
4348 }; 4417 };
4349 4418
4350 4419
4420 class Float32x4ComparisonInstr : public TemplateDefinition<2> {
4421 public:
4422 Float32x4ComparisonInstr(MethodRecognizer::Kind op_kind, Value* left,
4423 Value* right, InstanceCallInstr* instance_call)
4424 : op_kind_(op_kind) {
4425 SetInputAt(0, left);
4426 SetInputAt(1, right);
4427 deopt_id_ = instance_call->deopt_id();
4428 }
4429
4430 Value* left() const { return inputs_[0]; }
4431 Value* right() const { return inputs_[1]; }
4432
4433 MethodRecognizer::Kind op_kind() const { return op_kind_; }
4434
4435 virtual void PrintOperandsTo(BufferFormatter* f) const;
4436
4437 virtual bool CanDeoptimize() const { return false; }
4438
4439 virtual bool HasSideEffect() const { return false; }
4440
4441 virtual bool AffectedBySideEffect() const { return false; }
4442
4443 virtual bool AttributesEqual(Instruction* other) const {
4444 return op_kind() == other->AsFloat32x4Comparison()->op_kind();
4445 }
4446
4447 virtual Representation representation() const {
4448 return kUnboxedUint32x4;
4449 }
4450
4451 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4452 ASSERT((idx == 0) || (idx == 1));
4453 return kUnboxedFloat32x4;
4454 }
4455
4456 virtual intptr_t DeoptimizationTarget() const {
4457 // Direct access since this instruction cannot deoptimize, and the deopt-id
4458 // was inherited from another instruction that could deoptimize.
4459 return deopt_id_;
4460 }
4461
4462 DECLARE_INSTRUCTION(Float32x4Comparison)
4463 virtual CompileType ComputeType() const;
4464
4465 private:
4466 const MethodRecognizer::Kind op_kind_;
4467
4468 DISALLOW_COPY_AND_ASSIGN(Float32x4ComparisonInstr);
4469 };
4470
4471
4351 class BinaryMintOpInstr : public TemplateDefinition<2> { 4472 class BinaryMintOpInstr : public TemplateDefinition<2> {
4352 public: 4473 public:
4353 BinaryMintOpInstr(Token::Kind op_kind, 4474 BinaryMintOpInstr(Token::Kind op_kind,
4354 Value* left, 4475 Value* left,
4355 Value* right, 4476 Value* right,
4356 InstanceCallInstr* instance_call) 4477 InstanceCallInstr* instance_call)
4357 : op_kind_(op_kind), 4478 : op_kind_(op_kind),
4358 instance_call_(instance_call) { 4479 instance_call_(instance_call) {
4359 SetInputAt(0, left); 4480 SetInputAt(0, left);
4360 SetInputAt(1, right); 4481 SetInputAt(1, right);
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
5163 ForwardInstructionIterator* current_iterator_; 5284 ForwardInstructionIterator* current_iterator_;
5164 5285
5165 private: 5286 private:
5166 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 5287 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
5167 }; 5288 };
5168 5289
5169 5290
5170 } // namespace dart 5291 } // namespace dart
5171 5292
5172 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 5293 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698