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

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

Issue 172293004: Explicit conversions for Float32 array loads/stores. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed ARM register constraints Created 6 years, 10 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/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 M(AllocateContext) \ 653 M(AllocateContext) \
654 M(CloneContext) \ 654 M(CloneContext) \
655 M(BinarySmiOp) \ 655 M(BinarySmiOp) \
656 M(UnarySmiOp) \ 656 M(UnarySmiOp) \
657 M(UnaryDoubleOp) \ 657 M(UnaryDoubleOp) \
658 M(CheckStackOverflow) \ 658 M(CheckStackOverflow) \
659 M(SmiToDouble) \ 659 M(SmiToDouble) \
660 M(DoubleToInteger) \ 660 M(DoubleToInteger) \
661 M(DoubleToSmi) \ 661 M(DoubleToSmi) \
662 M(DoubleToDouble) \ 662 M(DoubleToDouble) \
663 M(DoubleToFloat) \
664 M(FloatToDouble) \
663 M(CheckClass) \ 665 M(CheckClass) \
664 M(CheckSmi) \ 666 M(CheckSmi) \
665 M(Constant) \ 667 M(Constant) \
666 M(CheckEitherNonSmi) \ 668 M(CheckEitherNonSmi) \
667 M(BinaryDoubleOp) \ 669 M(BinaryDoubleOp) \
668 M(MathUnary) \ 670 M(MathUnary) \
669 M(MathMinMax) \ 671 M(MathMinMax) \
670 M(UnboxDouble) \ 672 M(UnboxDouble) \
671 M(BoxDouble) \ 673 M(BoxDouble) \
672 M(BoxFloat32x4) \ 674 M(BoxFloat32x4) \
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 friend class MathUnaryInstr; 1010 friend class MathUnaryInstr;
1009 friend class MathMinMaxInstr; 1011 friend class MathMinMaxInstr;
1010 friend class CheckClassInstr; 1012 friend class CheckClassInstr;
1011 friend class GuardFieldInstr; 1013 friend class GuardFieldInstr;
1012 friend class CheckSmiInstr; 1014 friend class CheckSmiInstr;
1013 friend class CheckArrayBoundInstr; 1015 friend class CheckArrayBoundInstr;
1014 friend class CheckEitherNonSmiInstr; 1016 friend class CheckEitherNonSmiInstr;
1015 friend class LICM; 1017 friend class LICM;
1016 friend class DoubleToSmiInstr; 1018 friend class DoubleToSmiInstr;
1017 friend class DoubleToDoubleInstr; 1019 friend class DoubleToDoubleInstr;
1020 friend class DoubleToFloatInstr;
1021 friend class FloatToDoubleInstr;
1018 friend class InvokeMathCFunctionInstr; 1022 friend class InvokeMathCFunctionInstr;
1019 friend class MergedMathInstr; 1023 friend class MergedMathInstr;
1020 friend class FlowGraphOptimizer; 1024 friend class FlowGraphOptimizer;
1021 friend class LoadIndexedInstr; 1025 friend class LoadIndexedInstr;
1022 friend class StoreIndexedInstr; 1026 friend class StoreIndexedInstr;
1023 friend class StoreInstanceFieldInstr; 1027 friend class StoreInstanceFieldInstr;
1024 friend class ComparisonInstr; 1028 friend class ComparisonInstr;
1025 friend class TargetEntryInstr; 1029 friend class TargetEntryInstr;
1026 friend class JoinEntryInstr; 1030 friend class JoinEntryInstr;
1027 friend class InstanceOfInstr; 1031 friend class InstanceOfInstr;
(...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after
3190 const Function& function, 3194 const Function& function,
3191 const Array& argument_names, 3195 const Array& argument_names,
3192 ZoneGrowableArray<PushArgumentInstr*>* arguments, 3196 ZoneGrowableArray<PushArgumentInstr*>* arguments,
3193 const Array& ic_data_array) 3197 const Array& ic_data_array)
3194 : ic_data_(GetICData(ic_data_array)), 3198 : ic_data_(GetICData(ic_data_array)),
3195 token_pos_(token_pos), 3199 token_pos_(token_pos),
3196 function_(function), 3200 function_(function),
3197 argument_names_(argument_names), 3201 argument_names_(argument_names),
3198 arguments_(arguments), 3202 arguments_(arguments),
3199 result_cid_(kDynamicCid), 3203 result_cid_(kDynamicCid),
3200 is_known_list_constructor_(false) { 3204 is_known_list_constructor_(false),
3205 is_native_list_factory_(false) {
3201 ASSERT(function.IsZoneHandle()); 3206 ASSERT(function.IsZoneHandle());
3202 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); 3207 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap());
3203 } 3208 }
3204 3209
3205 // ICData for static calls carries call count. 3210 // ICData for static calls carries call count.
3206 const ICData* ic_data() const { return ic_data_; } 3211 const ICData* ic_data() const { return ic_data_; }
3207 bool HasICData() const { 3212 bool HasICData() const {
3208 return (ic_data() != NULL) && !ic_data()->IsNull(); 3213 return (ic_data() != NULL) && !ic_data()->IsNull();
3209 } 3214 }
3210 3215
(...skipping 18 matching lines...) Expand all
3229 3234
3230 virtual EffectSet Effects() const { return EffectSet::All(); } 3235 virtual EffectSet Effects() const { return EffectSet::All(); }
3231 3236
3232 void set_result_cid(intptr_t value) { result_cid_ = value; } 3237 void set_result_cid(intptr_t value) { result_cid_ = value; }
3233 3238
3234 bool is_known_list_constructor() const { return is_known_list_constructor_; } 3239 bool is_known_list_constructor() const { return is_known_list_constructor_; }
3235 void set_is_known_list_constructor(bool value) { 3240 void set_is_known_list_constructor(bool value) {
3236 is_known_list_constructor_ = value; 3241 is_known_list_constructor_ = value;
3237 } 3242 }
3238 3243
3244 bool is_native_list_factory() const { return is_native_list_factory_; }
3245 void set_is_native_list_factory(bool value) {
3246 is_native_list_factory_ = value;
3247 }
3248
3239 virtual bool MayThrow() const { return true; } 3249 virtual bool MayThrow() const { return true; }
3240 3250
3241 private: 3251 private:
3242 const ICData* ic_data_; 3252 const ICData* ic_data_;
3243 const intptr_t token_pos_; 3253 const intptr_t token_pos_;
3244 const Function& function_; 3254 const Function& function_;
3245 const Array& argument_names_; 3255 const Array& argument_names_;
3246 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 3256 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
3247 intptr_t result_cid_; // For some library functions we know the result. 3257 intptr_t result_cid_; // For some library functions we know the result.
3248 3258
3249 // 'True' for recognized list constructors. 3259 // 'True' for recognized list constructors.
3250 bool is_known_list_constructor_; 3260 bool is_known_list_constructor_;
3261 bool is_native_list_factory_;
3251 3262
3252 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); 3263 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr);
3253 }; 3264 };
3254 3265
3255 3266
3256 class LoadLocalInstr : public TemplateDefinition<0> { 3267 class LoadLocalInstr : public TemplateDefinition<0> {
3257 public: 3268 public:
3258 explicit LoadLocalInstr(const LocalVariable& local) 3269 explicit LoadLocalInstr(const LocalVariable& local)
3259 : local_(local), is_last_(false) { } 3270 : local_(local), is_last_(false) { }
3260 3271
(...skipping 3271 matching lines...) Expand 10 before | Expand all | Expand 10 after
6532 6543
6533 virtual bool MayThrow() const { return false; } 6544 virtual bool MayThrow() const { return false; }
6534 6545
6535 private: 6546 private:
6536 const MethodRecognizer::Kind recognized_kind_; 6547 const MethodRecognizer::Kind recognized_kind_;
6537 6548
6538 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr); 6549 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr);
6539 }; 6550 };
6540 6551
6541 6552
6553 class DoubleToFloatInstr: public TemplateDefinition<1> {
6554 public:
6555 DoubleToFloatInstr(Value* value, intptr_t deopt_id) {
6556 SetInputAt(0, value);
6557 // Override generated deopt-id.
6558 deopt_id_ = deopt_id;
6559 }
6560
6561 Value* value() const { return inputs_[0]; }
6562
6563 DECLARE_INSTRUCTION(DoubleToFloat)
6564
6565 virtual CompileType ComputeType() const;
6566
6567 virtual bool CanDeoptimize() const { return false; }
6568
6569 virtual Representation representation() const {
6570 // This works since double is the representation that the typed array
6571 // store expects.
6572 // TODO(fschneider): Change this to a genuine float representation once it
6573 // is supported.
6574 return kUnboxedDouble;
6575 }
6576
6577 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6578 ASSERT(idx == 0);
6579 return kUnboxedDouble;
6580 }
6581
6582 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
6583
6584 virtual bool AllowsCSE() const { return true; }
6585 virtual EffectSet Effects() const { return EffectSet::None(); }
6586 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6587 virtual bool AttributesEqual(Instruction* other) const { return true; }
6588
6589 virtual bool MayThrow() const { return false; }
6590
6591 virtual Definition* Canonicalize(FlowGraph* flow_graph);
6592
6593 private:
6594 DISALLOW_COPY_AND_ASSIGN(DoubleToFloatInstr);
6595 };
6596
6597
6598 class FloatToDoubleInstr: public TemplateDefinition<1> {
6599 public:
6600 FloatToDoubleInstr(Value* value, intptr_t deopt_id) {
6601 SetInputAt(0, value);
6602 // Override generated deopt-id.
6603 deopt_id_ = deopt_id;
6604 }
6605
6606 Value* value() const { return inputs_[0]; }
6607
6608 DECLARE_INSTRUCTION(FloatToDouble)
6609
6610 virtual CompileType ComputeType() const;
6611
6612 virtual bool CanDeoptimize() const { return false; }
6613
6614 virtual Representation representation() const {
6615 return kUnboxedDouble;
6616 }
6617
6618 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6619 ASSERT(idx == 0);
6620 return kUnboxedDouble;
6621 }
6622
6623 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
6624
6625 virtual bool AllowsCSE() const { return true; }
6626 virtual EffectSet Effects() const { return EffectSet::None(); }
6627 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6628 virtual bool AttributesEqual(Instruction* other) const { return true; }
6629
6630 virtual bool MayThrow() const { return false; }
6631
6632 virtual Definition* Canonicalize(FlowGraph* flow_graph);
6633
6634 private:
6635 DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr);
6636 };
6637
6638
6542 class InvokeMathCFunctionInstr : public Definition { 6639 class InvokeMathCFunctionInstr : public Definition {
6543 public: 6640 public:
6544 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs, 6641 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs,
6545 intptr_t original_deopt_id, 6642 intptr_t original_deopt_id,
6546 MethodRecognizer::Kind recognized_kind); 6643 MethodRecognizer::Kind recognized_kind);
6547 6644
6548 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); 6645 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_);
6549 6646
6550 const RuntimeEntry& TargetFunction() const; 6647 const RuntimeEntry& TargetFunction() const;
6551 6648
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
7036 ForwardInstructionIterator* current_iterator_; 7133 ForwardInstructionIterator* current_iterator_;
7037 7134
7038 private: 7135 private:
7039 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 7136 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
7040 }; 7137 };
7041 7138
7042 7139
7043 } // namespace dart 7140 } // namespace dart
7044 7141
7045 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 7142 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698