Index: src/conversions.cc |
diff --git a/src/conversions.cc b/src/conversions.cc |
index 8b776235e7b255a8638b954856bfcab159665a2f..663f4e8dec254c4126142dc2b5e628e5a8aad97c 100644 |
--- a/src/conversions.cc |
+++ b/src/conversions.cc |
@@ -483,19 +483,21 @@ char* DoubleToRadixCString(double value, int radix) { |
} |
-double StringToDouble(UnicodeCache* unicode_cache, |
- String* string, |
- int flags, |
- double empty_string_val) { |
- DisallowHeapAllocation no_gc; |
- String::FlatContent flat = string->GetFlatContent(); |
- // ECMA-262 section 15.1.2.3, empty string is NaN |
- if (flat.IsOneByte()) { |
- return StringToDouble( |
- unicode_cache, flat.ToOneByteVector(), flags, empty_string_val); |
- } else { |
- return StringToDouble( |
- unicode_cache, flat.ToUC16Vector(), flags, empty_string_val); |
+double StringToDouble(UnicodeCache* unicode_cache, Handle<String> string, |
+ int flags, double empty_string_val) { |
+ Handle<String> flattened = String::Flatten(string); |
+ { |
+ DisallowHeapAllocation no_gc; |
+ String::FlatContent flat = flattened->GetFlatContent(); |
+ DCHECK(flat.IsFlat()); |
+ // ECMA-262 section 15.1.2.3, empty string is NaN |
+ if (flat.IsOneByte()) { |
+ return StringToDouble(unicode_cache, flat.ToOneByteVector(), flags, |
+ empty_string_val); |
+ } else { |
+ return StringToDouble(unicode_cache, flat.ToUC16Vector(), flags, |
+ empty_string_val); |
+ } |
} |
} |