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

Unified Diff: src/code-stub-assembler.cc

Issue 2863643004: [regexp] Avoid runtime call on OOB lastIndex values (Closed)
Patch Set: Add IsNumberPositive assert 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 | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index f69cfe37f7e191e5f3857b4250283e7c4b4eb72d..dd4f33af38bcc6c4bee80eaf8fdfb6093bc0c32a 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -3341,6 +3341,18 @@ Node* CodeStubAssembler::IsNumberNormalized(Node* number) {
return var_result.value();
}
+Node* CodeStubAssembler::IsNumberPositive(Node* number) {
+ CSA_ASSERT(this, IsNumber(number));
+ Node* const float_zero = Float64Constant(0.);
+ return Select(TaggedIsSmi(number),
+ [=] { return TaggedIsPositiveSmi(number); },
+ [=] {
+ Node* v = LoadHeapNumberValue(number);
+ return Float64GreaterThanOrEqual(v, float_zero);
+ },
+ MachineRepresentation::kWord32);
+}
+
Node* CodeStubAssembler::StringCharCodeAt(Node* string, Node* index,
ParameterMode parameter_mode) {
if (parameter_mode == SMI_PARAMETERS) CSA_ASSERT(this, TaggedIsSmi(index));
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698