Skip to content

Commit 6624c23

Browse files
o-V8 LUCI CQ
authored andcommitted
Fix integer multiplication in parser ablation
base::TimeDelta implements only integer operators. Bug: 430201172 Change-Id: I1bf3b86f250a846ed27457f2827bfe729a3d8f10 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7080233 Auto-Submit: Olivier Flückiger <[email protected]> Commit-Queue: Leszek Swirski <[email protected]> Commit-Queue: Olivier Flückiger <[email protected]> Reviewed-by: Leszek Swirski <[email protected]> Cr-Commit-Position: refs/heads/main@{#103356}
1 parent 27d43a6 commit 6624c23

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/interpreter/interpreter.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::ExecuteJobImpl() {
212212
if (timer && timer->Elapsed().InNanoseconds() > 0) {
213213
auto end = timer->Elapsed();
214214
end += std::min(base::TimeDelta::FromSeconds(1),
215-
end * v8_flags.bytecode_compiler_ablation_amount);
215+
base::TimeDelta::FromMicroseconds(
216+
static_cast<double>(end.InMicroseconds()) *
217+
v8_flags.bytecode_compiler_ablation_amount));
216218
while (timer->Elapsed() < end) {
217219
}
218220
}

src/parsing/parser.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,9 @@ FunctionLiteral* Parser::DoParseProgram(Isolate* isolate, ParseInfo* info) {
863863
if (timer && timer->Elapsed().InNanoseconds() > 0) {
864864
auto end = timer->Elapsed();
865865
end += std::min(base::TimeDelta::FromSeconds(1),
866-
end * v8_flags.parser_ablation_amount);
866+
base::TimeDelta::FromMicroseconds(
867+
static_cast<double>(end.InMicroseconds()) *
868+
v8_flags.parser_ablation_amount));
867869
while (timer->Elapsed() < end) {
868870
}
869871
}
@@ -1230,7 +1232,9 @@ FunctionLiteral* Parser::DoParseFunction(Isolate* isolate, ParseInfo* info,
12301232
if (timer && timer->Elapsed().InNanoseconds() > 0) {
12311233
auto end = timer->Elapsed();
12321234
end += std::min(base::TimeDelta::FromSeconds(1),
1233-
end * v8_flags.parser_ablation_amount);
1235+
base::TimeDelta::FromMicroseconds(
1236+
static_cast<double>(end.InMicroseconds()) *
1237+
v8_flags.parser_ablation_amount));
12341238
while (timer->Elapsed() < end) {
12351239
}
12361240
}
@@ -3025,7 +3029,9 @@ bool Parser::SkipFunction(const AstRawString* function_name, FunctionKind kind,
30253029
if (timer && timer->Elapsed().InNanoseconds() > 0) {
30263030
auto end = timer->Elapsed();
30273031
end += std::min(base::TimeDelta::FromSeconds(1),
3028-
end * v8_flags.preparser_ablation_amount);
3032+
base::TimeDelta::FromMicroseconds(
3033+
static_cast<double>(end.InMicroseconds()) *
3034+
v8_flags.preparser_ablation_amount));
30293035
while (timer->Elapsed() < end) {
30303036
}
30313037
}

0 commit comments

Comments
 (0)