Index: src/lookup.cc |
diff --git a/src/lookup.cc b/src/lookup.cc |
index b855abe97fdb47fba3821215e36310c1e2365553..bca0ab5d5f4379888605026c65528a1f7d5eb40c 100644 |
--- a/src/lookup.cc |
+++ b/src/lookup.cc |
@@ -309,6 +309,24 @@ void LookupIterator::WriteDataValue(Handle<Object> value) { |
} |
+bool LookupIterator::IsSpecialNumericIndex() const { |
+ if (GetStoreTarget()->IsJSTypedArray() && name()->IsString()) { |
+ Handle<String> name_string = Handle<String>::cast(name()); |
+ if (name_string->length() > 0) { |
+ double d = |
+ StringToDouble(isolate()->unicode_cache(), *name_string, NO_FLAGS); |
+ if (!std::isnan(d)) { |
+ Factory* factory = isolate()->factory(); |
+ Handle<Object> num = factory->NewNumber(d); |
+ Handle<String> roundtrip_string = factory->NumberToString(num); |
+ if (String::Equals(name_string, roundtrip_string)) return true; |
+ } |
+ } |
+ } |
+ return false; |
+} |
+ |
+ |
void LookupIterator::InternalizeName() { |
if (name_->IsUniqueName()) return; |
name_ = factory()->InternalizeString(Handle<String>::cast(name_)); |