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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/crankshaft/hydrogen-instructions.cc ('k') | src/factory.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 #ifndef V8_FACTORY_H_ 5 #ifndef V8_FACTORY_H_
6 #define V8_FACTORY_H_ 6 #define V8_FACTORY_H_
7 7
8 #include "src/globals.h" 8 #include "src/globals.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 Handle<Object> NewNumberFromInt64(int64_t value, 430 Handle<Object> NewNumberFromInt64(int64_t value,
431 PretenureFlag pretenure = NOT_TENURED) { 431 PretenureFlag pretenure = NOT_TENURED) {
432 if (value <= std::numeric_limits<int32_t>::max() && 432 if (value <= std::numeric_limits<int32_t>::max() &&
433 value >= std::numeric_limits<int32_t>::min() && 433 value >= std::numeric_limits<int32_t>::min() &&
434 Smi::IsValid(static_cast<int32_t>(value))) { 434 Smi::IsValid(static_cast<int32_t>(value))) {
435 return Handle<Object>(Smi::FromInt(static_cast<int32_t>(value)), 435 return Handle<Object>(Smi::FromInt(static_cast<int32_t>(value)),
436 isolate()); 436 isolate());
437 } 437 }
438 return NewNumber(static_cast<double>(value), pretenure); 438 return NewNumber(static_cast<double>(value), pretenure);
439 } 439 }
440 Handle<HeapNumber> NewHeapNumber(double value, 440 Handle<HeapNumber> NewHeapNumber(double value, MutableMode mode = IMMUTABLE,
441 MutableMode mode = IMMUTABLE, 441 PretenureFlag pretenure = NOT_TENURED) {
442 PretenureFlag pretenure = NOT_TENURED); 442 Handle<HeapNumber> heap_number = NewHeapNumber(mode, pretenure);
443 443 heap_number->set_value(value);
444 return heap_number;
445 }
446 Handle<HeapNumber> NewHeapNumberFromBits(
447 uint64_t bits, MutableMode mode = IMMUTABLE,
448 PretenureFlag pretenure = NOT_TENURED) {
449 Handle<HeapNumber> heap_number = NewHeapNumber(mode, pretenure);
450 heap_number->set_value_as_bits(bits);
451 return heap_number;
452 }
453 // Creates mutable heap number object with value field set to hole NaN.
444 Handle<HeapNumber> NewMutableHeapNumber( 454 Handle<HeapNumber> NewMutableHeapNumber(
445 PretenureFlag pretenure = NOT_TENURED) { 455 PretenureFlag pretenure = NOT_TENURED) {
446 double hole_nan = bit_cast<double>(kHoleNanInt64); 456 return NewHeapNumberFromBits(kHoleNanInt64, MUTABLE, pretenure);
447 return NewHeapNumber(hole_nan, MUTABLE, pretenure);
448 } 457 }
449 458
459 // Creates heap number object with not yet set value field.
460 Handle<HeapNumber> NewHeapNumber(MutableMode mode,
461 PretenureFlag pretenure = NOT_TENURED);
462
450 #define SIMD128_NEW_DECL(TYPE, Type, type, lane_count, lane_type) \ 463 #define SIMD128_NEW_DECL(TYPE, Type, type, lane_count, lane_type) \
451 Handle<Type> New##Type(lane_type lanes[lane_count], \ 464 Handle<Type> New##Type(lane_type lanes[lane_count], \
452 PretenureFlag pretenure = NOT_TENURED); 465 PretenureFlag pretenure = NOT_TENURED);
453 SIMD128_TYPES(SIMD128_NEW_DECL) 466 SIMD128_TYPES(SIMD128_NEW_DECL)
454 #undef SIMD128_NEW_DECL 467 #undef SIMD128_NEW_DECL
455 468
456 Handle<JSWeakMap> NewJSWeakMap(); 469 Handle<JSWeakMap> NewJSWeakMap();
457 470
458 Handle<JSObject> NewArgumentsObject(Handle<JSFunction> callee, int length); 471 Handle<JSObject> NewArgumentsObject(Handle<JSFunction> callee, int length);
459 472
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, 835 void SetStrictFunctionInstanceDescriptor(Handle<Map> map,
823 FunctionMode function_mode); 836 FunctionMode function_mode);
824 837
825 void SetClassFunctionInstanceDescriptor(Handle<Map> map); 838 void SetClassFunctionInstanceDescriptor(Handle<Map> map);
826 }; 839 };
827 840
828 } // namespace internal 841 } // namespace internal
829 } // namespace v8 842 } // namespace v8
830 843
831 #endif // V8_FACTORY_H_ 844 #endif // V8_FACTORY_H_
OLDNEW
« 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