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

Unified Diff: src/hydrogen-instructions.cc

Issue 63863005: Add new HSeqStringGetChar instruction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix invalid use of movw(). 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 | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 206ab7e2accf5e496b6cd814eb1071c511cb21e7..02abf0bbd0c7fd231629f8a103536a8be1900095 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -3991,6 +3991,26 @@ HInstruction* HShr::New(
}
+HInstruction* HSeqStringGetChar::New(Zone* zone,
+ HValue* context,
+ String::Encoding encoding,
+ HValue* string,
+ HValue* index) {
+ if (FLAG_fold_constants && string->IsConstant() && index->IsConstant()) {
+ HConstant* c_string = HConstant::cast(string);
+ HConstant* c_index = HConstant::cast(index);
+ if (c_string->HasStringValue() && c_index->HasInteger32Value()) {
+ Handle<String> s = c_string->StringValue();
+ int32_t i = c_index->Integer32Value();
+ ASSERT_LE(0, i);
+ ASSERT_LT(i, s->length());
+ return H_CONSTANT_INT(s->Get(i));
+ }
+ }
+ return new(zone) HSeqStringGetChar(encoding, string, index);
+}
+
+
#undef H_CONSTANT_INT
#undef H_CONSTANT_DOUBLE
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698