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

Side by Side Diff: src/factory.cc

Issue 838263006: [turbofan] Make Factory::NewNumber() always return the minus_zero_value. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/unittests/factory-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 isolate()->heap()->CopyConstantPoolArray(*array), 1011 isolate()->heap()->CopyConstantPoolArray(*array),
1012 ConstantPoolArray); 1012 ConstantPoolArray);
1013 } 1013 }
1014 1014
1015 1015
1016 Handle<Object> Factory::NewNumber(double value, 1016 Handle<Object> Factory::NewNumber(double value,
1017 PretenureFlag pretenure) { 1017 PretenureFlag pretenure) {
1018 // We need to distinguish the minus zero value and this cannot be 1018 // We need to distinguish the minus zero value and this cannot be
1019 // done after conversion to int. Doing this by comparing bit 1019 // done after conversion to int. Doing this by comparing bit
1020 // patterns is faster than using fpclassify() et al. 1020 // patterns is faster than using fpclassify() et al.
1021 if (IsMinusZero(value)) return NewHeapNumber(-0.0, IMMUTABLE, pretenure); 1021 if (IsMinusZero(value)) return minus_zero_value();
1022 1022
1023 int int_value = FastD2IChecked(value); 1023 int int_value = FastD2IChecked(value);
1024 if (value == int_value && Smi::IsValid(int_value)) { 1024 if (value == int_value && Smi::IsValid(int_value)) {
1025 return handle(Smi::FromInt(int_value), isolate()); 1025 return handle(Smi::FromInt(int_value), isolate());
1026 } 1026 }
1027 1027
1028 // Materialize the value in the heap. 1028 // Materialize the value in the heap.
1029 return NewHeapNumber(value, IMMUTABLE, pretenure); 1029 return NewHeapNumber(value, IMMUTABLE, pretenure);
1030 } 1030 }
1031 1031
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
2513 return Handle<Object>::null(); 2513 return Handle<Object>::null();
2514 } 2514 }
2515 2515
2516 2516
2517 Handle<Object> Factory::ToBoolean(bool value) { 2517 Handle<Object> Factory::ToBoolean(bool value) {
2518 return value ? true_value() : false_value(); 2518 return value ? true_value() : false_value();
2519 } 2519 }
2520 2520
2521 2521
2522 } } // namespace v8::internal 2522 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/unittests/factory-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698