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

Unified Diff: src/compiler/js-native-context-specialization.cc

Issue 2503433002: [turbofan] Properly allocate constant-folded string. (Closed)
Patch Set: Created 4 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 | test/mjsunit/regress/regress-crbug-664942.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-native-context-specialization.cc
diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc
index de22145e1fb8b3e0aef25cf96bd28fa784f54ab1..db38c63048085d70648727e58449017080eb3dc8 100644
--- a/src/compiler/js-native-context-specialization.cc
+++ b/src/compiler/js-native-context-specialization.cc
@@ -695,8 +695,9 @@ Reduction JSNativeContextSpecialization::ReduceKeyedAccess(
NumberMatcher mindex(index);
if (mindex.IsInteger() && mindex.IsInRange(0.0, string->length() - 1)) {
// Constant-fold the {index} access to {string}.
- Node* value =
- jsgraph()->Constant(string->Get(static_cast<int>(mindex.Value())));
+ Node* value = jsgraph()->HeapConstant(
+ factory()->LookupSingleCharacterStringFromCode(
+ string->Get(static_cast<int>(mindex.Value()))));
ReplaceWithValue(node, value, effect, control);
return Replace(value);
} else if (flags() & kDeoptimizationEnabled) {
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-664942.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698