Commit 669a084a authored by bmeurer's avatar bmeurer Committed by Commit bot

[builtins] Fix typo in Number.parseInt TurboFan builtin.

http://crrev.com/2424403002 contained a typo comparing the input map
against the undefined constant rather than the HeapNumber map, which
tanks the case where Number.parseInt is used instead of Math.floor.

TBR=epertoso@chromium.org
BUG=v8:5049

Review-Url: https://codereview.chromium.org/2425703007
Cr-Commit-Position: refs/heads/master@{#40409}
parent 07ac9783
...@@ -287,7 +287,7 @@ void Builtins::Generate_NumberParseInt(CodeStubAssembler* assembler) { ...@@ -287,7 +287,7 @@ void Builtins::Generate_NumberParseInt(CodeStubAssembler* assembler) {
assembler->GotoIf(assembler->TaggedIsSmi(input), &if_inputissmi); assembler->GotoIf(assembler->TaggedIsSmi(input), &if_inputissmi);
Node* input_map = assembler->LoadMap(input); Node* input_map = assembler->LoadMap(input);
assembler->GotoIf( assembler->GotoIf(
assembler->WordEqual(input_map, assembler->UndefinedConstant()), assembler->WordEqual(input_map, assembler->HeapNumberMapConstant()),
&if_inputisheapnumber); &if_inputisheapnumber);
Node* input_instance_type = assembler->LoadMapInstanceType(input_map); Node* input_instance_type = assembler->LoadMapInstanceType(input_map);
assembler->Branch(assembler->IsStringInstanceType(input_instance_type), assembler->Branch(assembler->IsStringInstanceType(input_instance_type),
...@@ -305,12 +305,14 @@ void Builtins::Generate_NumberParseInt(CodeStubAssembler* assembler) { ...@@ -305,12 +305,14 @@ void Builtins::Generate_NumberParseInt(CodeStubAssembler* assembler) {
Node* input_value = assembler->LoadHeapNumberValue(input); Node* input_value = assembler->LoadHeapNumberValue(input);
Node* input_value_abs = assembler->Float64Abs(input_value); Node* input_value_abs = assembler->Float64Abs(input_value);
assembler->GotoIf(assembler->Float64LessThan( assembler->GotoUnless(
input_value_abs, assembler->Float64Constant(0.01)), assembler->Float64LessThan(input_value_abs,
&if_generic); assembler->Float64Constant(1e9)),
assembler->GotoIf(assembler->Float64LessThan( &if_generic);
assembler->Float64Constant(1e9), input_value_abs), assembler->GotoUnless(
&if_generic); assembler->Float64LessThan(assembler->Float64Constant(0.01),
input_value_abs),
&if_generic);
// Return the truncated int32 value, and return the tagged result. // Return the truncated int32 value, and return the tagged result.
Node* input_value32 = assembler->TruncateFloat64ToWord32(input_value); Node* input_value32 = assembler->TruncateFloat64ToWord32(input_value);
......
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