diff options
author | Michaƫl Zasso <mic.besace@gmail.com> | 2015-10-06 08:42:38 +0200 |
---|---|---|
committer | Ali Ijaz Sheikh <ofrobots@google.com> | 2015-10-14 11:20:34 -0700 |
commit | d8011d1683fe0d977de2bea1147f5213d4490c5a (patch) | |
tree | 54967df8dc1732e59eef39e5c5b39fe99ad88977 /deps/v8/src/conversions.h | |
parent | d1a2e5357ef0357cec9b516fa9ac78cc38a984aa (diff) | |
download | android-node-v8-d8011d1683fe0d977de2bea1147f5213d4490c5a.tar.gz android-node-v8-d8011d1683fe0d977de2bea1147f5213d4490c5a.tar.bz2 android-node-v8-d8011d1683fe0d977de2bea1147f5213d4490c5a.zip |
deps: upgrade V8 to 4.6.85.23
PR-URL: https://github.com/nodejs/node/pull/3351
Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/v8/src/conversions.h')
-rw-r--r-- | deps/v8/src/conversions.h | 74 |
1 files changed, 12 insertions, 62 deletions
diff --git a/deps/v8/src/conversions.h b/deps/v8/src/conversions.h index 1413bc2eaa..9b6d83b6bb 100644 --- a/deps/v8/src/conversions.h +++ b/deps/v8/src/conversions.h @@ -9,7 +9,6 @@ #include "src/base/logging.h" #include "src/handles.h" -#include "src/objects.h" #include "src/utils.h" namespace v8 { @@ -90,9 +89,7 @@ inline int32_t DoubleToInt32(double x); // This function should match the exact semantics of ECMA-262 9.6. -inline uint32_t DoubleToUint32(double x) { - return static_cast<uint32_t>(DoubleToInt32(x)); -} +inline uint32_t DoubleToUint32(double x); // Enumeration for allowing octals and ignoring junk when converting @@ -157,88 +154,41 @@ static inline bool IsMinusZero(double value) { } -static inline bool IsSmiDouble(double value) { - return !IsMinusZero(value) && value >= Smi::kMinValue && - value <= Smi::kMaxValue && value == FastI2D(FastD2I(value)); -} +inline bool IsSmiDouble(double value); // Integer32 is an integer that can be represented as a signed 32-bit // integer. It has to be in the range [-2^31, 2^31 - 1]. // We also have to check for negative 0 as it is not an Integer32. -static inline bool IsInt32Double(double value) { - return !IsMinusZero(value) && - value >= kMinInt && - value <= kMaxInt && - value == FastI2D(FastD2I(value)); -} +inline bool IsInt32Double(double value); // UInteger32 is an integer that can be represented as an unsigned 32-bit // integer. It has to be in the range [0, 2^32 - 1]. // We also have to check for negative 0 as it is not a UInteger32. -static inline bool IsUint32Double(double value) { - return !IsMinusZero(value) && - value >= 0 && - value <= kMaxUInt32 && - value == FastUI2D(FastD2UI(value)); -} +inline bool IsUint32Double(double value); // Convert from Number object to C integer. -inline int32_t NumberToInt32(Object* number) { - if (number->IsSmi()) return Smi::cast(number)->value(); - return DoubleToInt32(number->Number()); -} - - -inline uint32_t NumberToUint32(Object* number) { - if (number->IsSmi()) return Smi::cast(number)->value(); - return DoubleToUint32(number->Number()); -} +inline int32_t NumberToInt32(Object* number); +inline uint32_t NumberToUint32(Object* number); double StringToDouble(UnicodeCache* unicode_cache, Handle<String> string, int flags, double empty_string_val = 0.0); -inline bool TryNumberToSize(Isolate* isolate, - Object* number, size_t* result) { - SealHandleScope shs(isolate); - if (number->IsSmi()) { - int value = Smi::cast(number)->value(); - DCHECK(static_cast<unsigned>(Smi::kMaxValue) - <= std::numeric_limits<size_t>::max()); - if (value >= 0) { - *result = static_cast<size_t>(value); - return true; - } - return false; - } else { - DCHECK(number->IsHeapNumber()); - double value = HeapNumber::cast(number)->value(); - if (value >= 0 && - value <= std::numeric_limits<size_t>::max()) { - *result = static_cast<size_t>(value); - return true; - } else { - return false; - } - } -} +inline bool TryNumberToSize(Isolate* isolate, Object* number, size_t* result); + // Converts a number into size_t. -inline size_t NumberToSize(Isolate* isolate, - Object* number) { - size_t result = 0; - bool is_valid = TryNumberToSize(isolate, number, &result); - CHECK(is_valid); - return result; -} +inline size_t NumberToSize(Isolate* isolate, Object* number); // returns DoubleToString(StringToDouble(string)) == string bool IsSpecialIndex(UnicodeCache* unicode_cache, String* string); -} } // namespace v8::internal + +} // namespace internal +} // namespace v8 #endif // V8_CONVERSIONS_H_ |