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

Side by Side Diff: src/factory.cc

Issue 809293003: Fixed -fsanitize=float-cast-overflow problems. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | src/hydrogen-instructions.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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 } 1028 }
1029 1029
1030 1030
1031 Handle<Object> Factory::NewNumber(double value, 1031 Handle<Object> Factory::NewNumber(double value,
1032 PretenureFlag pretenure) { 1032 PretenureFlag pretenure) {
1033 // We need to distinguish the minus zero value and this cannot be 1033 // We need to distinguish the minus zero value and this cannot be
1034 // done after conversion to int. Doing this by comparing bit 1034 // done after conversion to int. Doing this by comparing bit
1035 // patterns is faster than using fpclassify() et al. 1035 // patterns is faster than using fpclassify() et al.
1036 if (IsMinusZero(value)) return NewHeapNumber(-0.0, IMMUTABLE, pretenure); 1036 if (IsMinusZero(value)) return NewHeapNumber(-0.0, IMMUTABLE, pretenure);
1037 1037
1038 int int_value = FastD2I(value); 1038 int int_value = FastD2IChecked(value);
1039 if (value == int_value && Smi::IsValid(int_value)) { 1039 if (value == int_value && Smi::IsValid(int_value)) {
1040 return handle(Smi::FromInt(int_value), isolate()); 1040 return handle(Smi::FromInt(int_value), isolate());
1041 } 1041 }
1042 1042
1043 // Materialize the value in the heap. 1043 // Materialize the value in the heap.
1044 return NewHeapNumber(value, IMMUTABLE, pretenure); 1044 return NewHeapNumber(value, IMMUTABLE, pretenure);
1045 } 1045 }
1046 1046
1047 1047
1048 Handle<Object> Factory::NewNumberFromInt(int32_t value, 1048 Handle<Object> Factory::NewNumberFromInt(int32_t value,
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 return Handle<Object>::null(); 2521 return Handle<Object>::null();
2522 } 2522 }
2523 2523
2524 2524
2525 Handle<Object> Factory::ToBoolean(bool value) { 2525 Handle<Object> Factory::ToBoolean(bool value) {
2526 return value ? true_value() : false_value(); 2526 return value ? true_value() : false_value();
2527 } 2527 }
2528 2528
2529 2529
2530 } } // namespace v8::internal 2530 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698