Commit 80ce96e1 authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

[torque] Fix math.tq performance regressions

- Makes conversion::NonNumberToNumber, NonNumberToNumeric, and
  ToNumeric transitioning builtins. Otherwise, these turn into
  macro invocations, which made several math.tq builtins much
  longer.

Bug: chromium:1094228
Change-Id: Iefb6821ee59f61c11029150c0de4a1bcbd18e721
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2243195
Commit-Queue: Bill Budge <bbudge@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68371}
parent 54238913
......@@ -633,10 +633,10 @@ extern macro StringFromSingleCharCode(int32): String;
extern macro NumberToString(Number): String;
extern macro StringToNumber(String): Number;
extern macro NonNumberToNumber(implicit context: Context)(JSAnyNotNumber):
Number;
extern macro NonNumberToNumeric(implicit context: Context)(JSAnyNotNumber):
Numeric;
extern transitioning macro NonNumberToNumber(implicit context: Context)(
JSAnyNotNumber): Number;
extern transitioning macro NonNumberToNumeric(implicit context: Context)(
JSAnyNotNumber): Numeric;
extern macro Equal(JSAny, JSAny, Context): Boolean;
macro Equal(implicit context: Context)(left: JSAny, right: JSAny): Boolean {
......
......@@ -17,17 +17,18 @@ builtin StringToNumber(implicit context: Context)(input: String): Number {
return ::StringToNumber(input);
}
builtin NonNumberToNumber(implicit context: Context)(input: JSAnyNotNumber):
Number {
transitioning builtin NonNumberToNumber(implicit context: Context)(
input: JSAnyNotNumber): Number {
return ::NonNumberToNumber(input);
}
builtin NonNumberToNumeric(implicit context: Context)(input: JSAnyNotNumber):
Numeric {
transitioning builtin NonNumberToNumeric(implicit context: Context)(
input: JSAnyNotNumber): Numeric {
return ::NonNumberToNumeric(input);
}
builtin ToNumeric(implicit context: Context)(input: JSAny): Numeric {
transitioning builtin ToNumeric(implicit context: Context)(input: JSAny):
Numeric {
typeswitch (input) {
case (n: Number): {
return n;
......@@ -49,7 +50,8 @@ builtin ToBoolean(implicit context: Context)(input: JSAny): Boolean {
return FalseConstant();
}
builtin ToLength(implicit context: Context)(input: JSAny): Number {
transitioning builtin ToLength(implicit context: Context)(input: JSAny):
Number {
// We might need to loop once for ToNumber conversion.
let x: JSAny = input;
while (true) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment