| Index: src/conversions-inl.h
|
| diff --git a/src/conversions-inl.h b/src/conversions-inl.h
|
| index d7789f9180880868baac232fbc4eeab9e58cb4d9..08766202658eabf41791c7ba255d7440794e36aa 100644
|
| --- a/src/conversions-inl.h
|
| +++ b/src/conversions-inl.h
|
| @@ -122,6 +122,19 @@ bool IsUint32Double(double value) {
|
| value == FastUI2D(FastD2UI(value));
|
| }
|
|
|
| +bool DoubleToUint32(double value, uint32_t* uint32_value) {
|
| + if (IsMinusZero(value) || value < 0 || value > kMaxUInt32) {
|
| + return false;
|
| + }
|
| + // TODO(leszeks): We maybe could be faster than FastD2UI here, since we only
|
| + // care about the value being valid if the conversion is valid.
|
| + uint32_t converted_value = FastD2UI(value);
|
| + if (value == FastUI2D(converted_value)) {
|
| + *uint32_value = converted_value;
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
|
|
| int32_t NumberToInt32(Object* number) {
|
| if (number->IsSmi()) return Smi::cast(number)->value();
|
|
|