Commit 1c5f9d6c authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

Revert "[turbofan] Remove optimization for NumberToString"

This reverts commit 2f2ce7b7.

Reason for revert:
https://bugs.chromium.org/p/chromium/issues/detail?id=865494

Original change's description:
> [turbofan] Remove optimization for NumberToString
>
> We used to have an optimized version for ToString on number nodes
> which was allocating an object on the heap, therefore
> preventing this code from being executed on the compiler thread.
> Octane benchmark results show insignificant increase in performance
> (< 0.5%) without this optimization - see
> https://docs.google.com/spreadsheets/d/1MC5NrMoMSsqxZqw0ojoZvomBb7q2EOt1S0sFoJ8ld2c/edit#gid=1732639373
> which leads to the conclusion we can safely remove the optimization for now.
>
> Bug: v8:7790
> Change-Id: Ia1d53608f8d10ba20e0ff57cccb34583655382c6
> Reviewed-on: https://chromium-review.googlesource.com/1139063
> Commit-Queue: Maya Lekova <mslekova@chromium.org>
> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
> Reviewed-by: Georg Neis <neis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#54495}

TBR=jarin@chromium.org,neis@chromium.org,mslekova@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: v8:7790, chromium:865494
Change-Id: I4b6c620e88c84ae889ce403fa46672db0d3b17c3
Reviewed-on: https://chromium-review.googlesource.com/1166783
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54959}
parent 91ef86f9
......@@ -1063,6 +1063,20 @@ Reduction JSTypedLowering::ReduceJSToStringInput(Node* input) {
if (input_type.Is(Type::NaN())) {
return Replace(jsgraph()->HeapConstant(factory()->NaN_string()));
}
if (input_type.Is(Type::OrderedNumber()) &&
input_type.Min() == input_type.Max()) {
// TODO(mslekova): get rid of these allows by doing either one of:
// 1. remove the optimization and check if it ruins the performance
// 2. allocate all the ToString's from numbers before the compilation
// 3. leave a placeholder and do the actual allocations once back on the MT
AllowHandleDereference allow_handle_dereference;
AllowHandleAllocation allow_handle_allocation;
AllowHeapAllocation allow_heap_allocation;
// Note that we can use Type::OrderedNumber(), since
// both 0 and -0 map to the String "0" in JavaScript.
return Replace(jsgraph()->HeapConstant(
factory()->NumberToString(factory()->NewNumber(input_type.Min()))));
}
if (input_type.Is(Type::Number())) {
return Replace(graph()->NewNode(simplified()->NumberToString(), input));
}
......
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