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

Unified Diff: src/builtins/builtins-string-gen.cc

Issue 2905623003: [turbofan] Speculatively optimize string character access. (Closed)
Patch Set: Created 3 years, 7 months 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 | src/compiler/js-builtin-reducer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-string-gen.cc
diff --git a/src/builtins/builtins-string-gen.cc b/src/builtins/builtins-string-gen.cc
index d0f707bcec42ed5b3810e664c6887a8eb0a33a8e..f30111a802d8ca93a81cbb67b6fdb0b2001bc68e 100644
--- a/src/builtins/builtins-string-gen.cc
+++ b/src/builtins/builtins-string-gen.cc
@@ -656,7 +656,13 @@ TF_BUILTIN(StringPrototypeCharAt, CodeStubAssembler) {
&if_positioninbounds);
BIND(&return_emptystring);
- Return(EmptyStringConstant());
+ {
+ // Invalidate the "String Bounds Check" protector.
+ Node* invalid = SmiConstant(Isolate::kProtectorInvalid);
+ Node* cell = LoadRoot(Heap::kStringBoundsCheckProtectorRootIndex);
+ StoreObjectFieldNoWriteBarrier(cell, Cell::kValueOffset, invalid);
+ Return(EmptyStringConstant());
+ }
BIND(&if_positioninbounds);
}
@@ -695,7 +701,13 @@ TF_BUILTIN(StringPrototypeCharCodeAt, CodeStubAssembler) {
&if_positioninbounds);
BIND(&return_nan);
- Return(NaNConstant());
+ {
+ // Invalidate the "String Bounds Check" protector.
+ Node* invalid = SmiConstant(Isolate::kProtectorInvalid);
+ Node* cell = LoadRoot(Heap::kStringBoundsCheckProtectorRootIndex);
+ StoreObjectFieldNoWriteBarrier(cell, Cell::kValueOffset, invalid);
+ Return(NaNConstant());
+ }
BIND(&if_positioninbounds);
}
« no previous file with comments | « no previous file | src/compiler/js-builtin-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698