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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.h
===================================================================
--- runtime/vm/intermediate_language.h (revision 32847)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -660,6 +660,8 @@
M(DoubleToInteger) \
M(DoubleToSmi) \
M(DoubleToDouble) \
+ M(DoubleToFloat) \
+ M(FloatToDouble) \
M(CheckClass) \
M(CheckSmi) \
M(Constant) \
@@ -1015,6 +1017,8 @@
friend class LICM;
friend class DoubleToSmiInstr;
friend class DoubleToDoubleInstr;
+ friend class DoubleToFloatInstr;
+ friend class FloatToDoubleInstr;
friend class InvokeMathCFunctionInstr;
friend class MergedMathInstr;
friend class FlowGraphOptimizer;
@@ -3197,7 +3201,8 @@
argument_names_(argument_names),
arguments_(arguments),
result_cid_(kDynamicCid),
- is_known_list_constructor_(false) {
+ is_known_list_constructor_(false),
+ is_native_list_factory_(false) {
ASSERT(function.IsZoneHandle());
ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap());
}
@@ -3236,6 +3241,11 @@
is_known_list_constructor_ = value;
}
+ bool is_native_list_factory() const { return is_native_list_factory_; }
+ void set_is_native_list_factory(bool value) {
+ is_native_list_factory_ = value;
+ }
+
virtual bool MayThrow() const { return true; }
private:
@@ -3248,6 +3258,7 @@
// 'True' for recognized list constructors.
bool is_known_list_constructor_;
+ bool is_native_list_factory_;
DISALLOW_COPY_AND_ASSIGN(StaticCallInstr);
};
@@ -6539,6 +6550,92 @@
};
+class DoubleToFloatInstr: public TemplateDefinition<1> {
+ public:
+ DoubleToFloatInstr(Value* value, intptr_t deopt_id) {
+ SetInputAt(0, value);
+ // Override generated deopt-id.
+ deopt_id_ = deopt_id;
+ }
+
+ Value* value() const { return inputs_[0]; }
+
+ DECLARE_INSTRUCTION(DoubleToFloat)
+
+ virtual CompileType ComputeType() const;
+
+ virtual bool CanDeoptimize() const { return false; }
+
+ virtual Representation representation() const {
+ // This works since double is the representation that the typed array
+ // store expects.
+ // TODO(fschneider): Change this to a genuine float representation once it
+ // is supported.
+ return kUnboxedDouble;
+ }
+
+ virtual Representation RequiredInputRepresentation(intptr_t idx) const {
+ ASSERT(idx == 0);
+ return kUnboxedDouble;
+ }
+
+ virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
+
+ virtual bool AllowsCSE() const { return true; }
+ virtual EffectSet Effects() const { return EffectSet::None(); }
+ virtual EffectSet Dependencies() const { return EffectSet::None(); }
+ virtual bool AttributesEqual(Instruction* other) const { return true; }
+
+ virtual bool MayThrow() const { return false; }
+
+ virtual Definition* Canonicalize(FlowGraph* flow_graph);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DoubleToFloatInstr);
+};
+
+
+class FloatToDoubleInstr: public TemplateDefinition<1> {
+ public:
+ FloatToDoubleInstr(Value* value, intptr_t deopt_id) {
+ SetInputAt(0, value);
+ // Override generated deopt-id.
+ deopt_id_ = deopt_id;
+ }
+
+ Value* value() const { return inputs_[0]; }
+
+ DECLARE_INSTRUCTION(FloatToDouble)
+
+ virtual CompileType ComputeType() const;
+
+ virtual bool CanDeoptimize() const { return false; }
+
+ virtual Representation representation() const {
+ return kUnboxedDouble;
+ }
+
+ virtual Representation RequiredInputRepresentation(intptr_t idx) const {
+ ASSERT(idx == 0);
+ return kUnboxedDouble;
+ }
+
+ virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
+
+ virtual bool AllowsCSE() const { return true; }
+ virtual EffectSet Effects() const { return EffectSet::None(); }
+ virtual EffectSet Dependencies() const { return EffectSet::None(); }
+ virtual bool AttributesEqual(Instruction* other) const { return true; }
+
+ virtual bool MayThrow() const { return false; }
+
+ virtual Definition* Canonicalize(FlowGraph* flow_graph);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr);
+};
+
+
class InvokeMathCFunctionInstr : public Definition {
public:
InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs,
« 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