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

Unified Diff: runtime/vm/intrinsifier_ia32.cc

Issue 8526005: Intrinsify StringBase.isEmpty and inline StringBase.get:length. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 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 | « no previous file | runtime/vm/opt_code_generator_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_ia32.cc
===================================================================
--- runtime/vm/intrinsifier_ia32.cc (revision 1406)
+++ runtime/vm/intrinsifier_ia32.cc (working copy)
@@ -78,6 +78,7 @@
V(StringBase, get:length, String_getLength) \
V(StringBase, charCodeAt, String_charCodeAt) \
V(StringBase, hashCode, String_hashCode) \
+ V(StringBase, isEmpty, String_isEmpty) \
#define __ assembler->
@@ -945,6 +946,24 @@
return false;
}
+
+static bool String_isEmpty(Assembler* assembler) {
+ Label is_true;
+ const Bool& bool_true = Bool::ZoneHandle(Bool::True());
+ const Bool& bool_false = Bool::ZoneHandle(Bool::False());
+ // Get length.
+ __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object.
+ __ movl(EAX, FieldAddress(EAX, String::length_offset()));
+ __ cmpl(EAX, Immediate(Smi::RawValue(0)));
+ __ j(EQUAL, &is_true, Assembler::kNearJump);
+ __ LoadObject(EAX, bool_false);
+ __ ret();
+ __ Bind(&is_true);
+ __ LoadObject(EAX, bool_true);
+ __ ret();
+ return true;
+}
+
#undef __
« no previous file with comments | « no previous file | runtime/vm/opt_code_generator_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698