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

Unified Diff: runtime/vm/intermediate_language.h

Issue 79653002: Merge TRUNCDIV and MOD into one instruction. Icorporated feedback from CL https://codereview.chromi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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/il_printer.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 30526)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -672,6 +672,7 @@
M(StringFromCharCode) \
M(StringInterpolate) \
M(InvokeMathCFunction) \
+ M(MergedMath) \
M(GuardField) \
M(IfThenElse) \
M(BinaryFloat32x4Op) \
@@ -998,6 +999,7 @@
friend class DoubleToSmiInstr;
friend class DoubleToDoubleInstr;
friend class InvokeMathCFunctionInstr;
+ friend class MergedMathInstr;
friend class FlowGraphOptimizer;
friend class LoadIndexedInstr;
friend class StoreIndexedInstr;
@@ -6566,6 +6568,108 @@
};
+class MergedMathInstr : public Definition {
+ public:
+ enum Kind {
+ kTruncDivMod,
+ kTruncDivRem,
+ kSinCos,
+ };
+
+ MergedMathInstr(ZoneGrowableArray<Value*>* inputs,
+ intptr_t original_deopt_id,
+ MergedMathInstr::Kind kind);
+
+ static intptr_t InputCountFor(MergedMathInstr::Kind kind) {
+ if (kind == kTruncDivMod) {
+ return 2;
+ } else {
+ UNIMPLEMENTED();
+ return -1;
+ }
+ }
+
+ MergedMathInstr::Kind kind() const { return kind_; }
+
+ virtual intptr_t InputCount() const { return inputs_->length(); }
+
+ virtual Value* InputAt(intptr_t i) const {
+ return (*inputs_)[i];
+ }
+
+ virtual CompileType ComputeType() const;
+ virtual void PrintOperandsTo(BufferFormatter* f) const;
+
+ virtual bool CanDeoptimize() const {
+ if (kind_ == kTruncDivMod) {
+ return true;
+ } else {
+ UNIMPLEMENTED();
+ return false;
+ }
+ }
+
+ virtual Representation representation() const {
+ if (kind_ == kTruncDivMod) {
+ return kTagged;
+ } else {
+ UNIMPLEMENTED();
+ return kTagged;
+ }
+ }
+
+ virtual Representation RequiredInputRepresentation(intptr_t idx) const {
+ if (kind_ == kTruncDivMod) {
+ ASSERT((0 <= idx) && (idx < InputCount()));
+ return kTagged;
+ } else {
+ UNIMPLEMENTED();
+ return kTagged;
+ }
+ }
+
+ virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
+
+ DECLARE_INSTRUCTION(MergedMath)
+
+ // Returns a structure describing the location constraints required
+ // to emit native code for this definition.
+ LocationSummary* locs() {
+ if (locs_ == NULL) {
+ locs_ = MakeLocationSummary();
+ }
+ return locs_;
+ }
+
+ 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 {
+ MergedMathInstr* other_invoke = other->AsMergedMath();
+ return other_invoke->kind() == kind();
+ }
+
+ virtual bool MayThrow() const { return false; }
+
+ static const char* KindToCString(MergedMathInstr::Kind kind) {
+ if (kind == kTruncDivMod) return "TruncDivMod";
+ UNIMPLEMENTED();
+ return "";
+ }
+
+ private:
+ virtual void RawSetInputAt(intptr_t i, Value* value) {
+ (*inputs_)[i] = value;
+ }
+
+ ZoneGrowableArray<Value*>* inputs_;
+ LocationSummary* locs_;
+ MergedMathInstr::Kind kind_;
+
+ DISALLOW_COPY_AND_ASSIGN(MergedMathInstr);
+};
+
+
class CheckClassInstr : public TemplateInstruction<1> {
public:
CheckClassInstr(Value* value,
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698