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

Unified Diff: runtime/vm/intermediate_language.h

Issue 11360033: Inline native String.charCodeAt in optimized code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed a bug in indexed ops and added more tests Created 8 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
Index: runtime/vm/intermediate_language.h
===================================================================
--- runtime/vm/intermediate_language.h (revision 14406)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -37,6 +37,7 @@
V(_GrowableObjectArray, get:capacity, GrowableArrayCapacity) \
V(_StringBase, get:length, StringBaseLength) \
V(_StringBase, get:isEmpty, StringBaseIsEmpty) \
+ V(_StringBase, charCodeAt, StringBaseCharCodeAt) \
V(_IntegerImplementation, toDouble, IntegerToDouble) \
V(_Double, toInt, DoubleToInteger) \
V(::, sqrt, MathSqrt) \
@@ -263,6 +264,7 @@
M(UnaryMintOp) \
M(CheckArrayBound) \
M(Constraint) \
+ M(StringCharCodeAt)
#define FORWARD_DECLARATION(type) class type##Instr;
@@ -525,6 +527,7 @@
friend class CheckSmiInstr;
friend class CheckArrayBoundInstr;
friend class CheckEitherNonSmiInstr;
+ friend class StringCharCodeAtInstr;
friend class LICM;
intptr_t deopt_id_;
@@ -2635,6 +2638,42 @@
};
+class StringCharCodeAtInstr : public TemplateDefinition<2> {
+ public:
+ StringCharCodeAtInstr(Value* receiver,
+ Value* index,
+ intptr_t class_id)
+ : class_id_(class_id) {
+ ASSERT(receiver != NULL);
+ ASSERT(index != NULL);
+ inputs_[0] = receiver;
+ inputs_[1] = index;
+ }
+
+ DECLARE_INSTRUCTION(StringCharCodeAt)
+ virtual RawAbstractType* CompileType() const;
+
+ Value* receiver() const { return inputs_[0]; }
+ Value* index() const { return inputs_[1]; }
+ intptr_t class_id() const { return class_id_; }
+
+ virtual bool CanDeoptimize() const { return false; }
+
+ virtual bool HasSideEffect() const { return false; }
+
+ virtual intptr_t ResultCid() const;
+
+ virtual bool AttributesEqual(Instruction* other) const;
+
+ virtual bool AffectedBySideEffect() const { return true; }
+
+ private:
+ const intptr_t class_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(StringCharCodeAtInstr);
+};
+
+
class LoadIndexedInstr : public TemplateDefinition<2> {
public:
LoadIndexedInstr(Value* array, Value* index, intptr_t class_id)
@@ -3980,6 +4019,9 @@
private:
intptr_t array_type_;
+ // Returns the length offset for array and string types.
+ static intptr_t LengthOffsetFor(intptr_t class_id);
+
DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr);
};

Powered by Google App Engine
This is Rietveld 408576698