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

Unified Diff: src/factory.h

Issue 2652553003: Access double fields in C++ as uint64_t fields to preserve signaling bit of a NaN. (Closed)
Patch Set: More fixes Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/crankshaft/hydrogen-instructions.cc ('k') | src/factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.h
diff --git a/src/factory.h b/src/factory.h
index 553b242cefcfd12d531b104bf45ea830c75d7ab9..1e9d2d12d518d6bb4f49fc54f613f37023084b60 100644
--- a/src/factory.h
+++ b/src/factory.h
@@ -437,16 +437,29 @@ class V8_EXPORT_PRIVATE Factory final {
}
return NewNumber(static_cast<double>(value), pretenure);
}
- Handle<HeapNumber> NewHeapNumber(double value,
- MutableMode mode = IMMUTABLE,
- PretenureFlag pretenure = NOT_TENURED);
-
+ Handle<HeapNumber> NewHeapNumber(double value, MutableMode mode = IMMUTABLE,
+ PretenureFlag pretenure = NOT_TENURED) {
+ Handle<HeapNumber> heap_number = NewHeapNumber(mode, pretenure);
+ heap_number->set_value(value);
+ return heap_number;
+ }
+ Handle<HeapNumber> NewHeapNumberFromBits(
+ uint64_t bits, MutableMode mode = IMMUTABLE,
+ PretenureFlag pretenure = NOT_TENURED) {
+ Handle<HeapNumber> heap_number = NewHeapNumber(mode, pretenure);
+ heap_number->set_value_as_bits(bits);
+ return heap_number;
+ }
+ // Creates mutable heap number object with value field set to hole NaN.
Handle<HeapNumber> NewMutableHeapNumber(
PretenureFlag pretenure = NOT_TENURED) {
- double hole_nan = bit_cast<double>(kHoleNanInt64);
- return NewHeapNumber(hole_nan, MUTABLE, pretenure);
+ return NewHeapNumberFromBits(kHoleNanInt64, MUTABLE, pretenure);
}
+ // Creates heap number object with not yet set value field.
+ Handle<HeapNumber> NewHeapNumber(MutableMode mode,
+ PretenureFlag pretenure = NOT_TENURED);
+
#define SIMD128_NEW_DECL(TYPE, Type, type, lane_count, lane_type) \
Handle<Type> New##Type(lane_type lanes[lane_count], \
PretenureFlag pretenure = NOT_TENURED);
« no previous file with comments | « src/crankshaft/hydrogen-instructions.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698