From: dslomov@chromium.org Date: Fri, 17 Oct 2014 13:01:54 +0000 (+0000) Subject: Revert "Correct semantics for numerically indexed stores to typed arrays." X-Git-Tag: upstream/4.7.83~6287 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8854589c79229b51c056ac60cd62850013018676;p=platform%2Fupstream%2Fv8.git Revert "Correct semantics for numerically indexed stores to typed arrays." This reverts commit r24691 because win64 release build breaks. TBR=verwaest@chromium.org Review URL: https://codereview.chromium.org/659313002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24695 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/lookup.cc b/src/lookup.cc index bca0ab5..b855abe 100644 --- a/src/lookup.cc +++ b/src/lookup.cc @@ -309,24 +309,6 @@ void LookupIterator::WriteDataValue(Handle value) { } -bool LookupIterator::IsSpecialNumericIndex() const { - if (GetStoreTarget()->IsJSTypedArray() && name()->IsString()) { - Handle name_string = Handle::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 num = factory->NewNumber(d); - Handle 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::cast(name_)); diff --git a/src/lookup.h b/src/lookup.h index 52231e5..14ca010 100644 --- a/src/lookup.h +++ b/src/lookup.h @@ -138,10 +138,6 @@ class LookupIterator FINAL BASE_EMBEDDED { Handle GetDataValue() const; void WriteDataValue(Handle value); - // Checks whether the receiver is an indexed exotic object - // and name is a special numeric index. - bool IsSpecialNumericIndex() const; - void InternalizeName(); private: diff --git a/src/objects.cc b/src/objects.cc index a697a77..5e9e154 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -2986,10 +2986,6 @@ MaybeHandle Object::AddDataProperty(LookupIterator* it, // instead. If the prototype is Null, the proxy is detached. if (receiver->IsJSGlobalProxy()) return value; - // If the receiver is Indexed Exotic object (currently only typed arrays), - // disallow adding properties with numeric names. - if (it->IsSpecialNumericIndex()) return value; - // Possibly migrate to the most up-to-date map that will be able to store // |value| under it->name() with |attributes|. it->PrepareTransitionToDataProperty(value, attributes, store_mode); diff --git a/test/mjsunit/harmony/typedarrays.js b/test/mjsunit/harmony/typedarrays.js index 59d09bb..5b75874 100644 --- a/test/mjsunit/harmony/typedarrays.js +++ b/test/mjsunit/harmony/typedarrays.js @@ -481,85 +481,6 @@ function TestTypedArraySet() { TestTypedArraySet(); -function TestTypedArraysWithIllegalIndices() { - var a = new Int32Array(100); - - a[-10] = 10; - assertEquals(undefined, a[-10]); - a["-10"] = 10; - assertEquals(undefined, a["-10"]); - - var s = " -10"; - a[s] = 10; - assertEquals(10, a[s]); - var s1 = " -10 "; - a[s] = 10; - assertEquals(10, a[s]); - - a["-1e2"] = 10; - assertEquals(10, a["-1e2"]); - assertEquals(undefined, a[-1e2]); - - a[-Infinity] = 50; - assertEquals(undefined, a[-Infinity]); - a[1.5] = 10; - assertEquals(undefined, a[1.5]); - var nan = Math.sqrt(-1); - a[nan] = 5; - assertEquals(5, a[nan]); - - var x = 0; - var y = -0; - assertEquals(Infinity, 1/x); - assertEquals(-Infinity, 1/y); - a[x] = 5; - a[y] = 27; - assertEquals(27, a[x]); - assertEquals(27, a[y]); -} - -TestTypedArraysWithIllegalIndices(); - -function TestTypedArraysWithIllegalIndicesStrict() { - 'use strict'; - var a = new Int32Array(100); - - a[-10] = 10; - assertEquals(undefined, a[-10]); - a["-10"] = 10; - assertEquals(undefined, a["-10"]); - - var s = " -10"; - a[s] = 10; - assertEquals(10, a[s]); - var s1 = " -10 "; - a[s] = 10; - assertEquals(10, a[s]); - - a["-1e2"] = 10; - assertEquals(10, a["-1e2"]); - assertEquals(undefined, a[-1e2]); - - a[-Infinity] = 50; - assertEquals(undefined, a[-Infinity]); - a[1.5] = 10; - assertEquals(undefined, a[1.5]); - var nan = Math.sqrt(-1); - a[nan] = 5; - assertEquals(5, a[nan]); - - var x = 0; - var y = -0; - assertEquals(Infinity, 1/x); - assertEquals(-Infinity, 1/y); - a[x] = 5; - a[y] = 27; - assertEquals(27, a[x]); - assertEquals(27, a[y]); -} - -TestTypedArraysWithIllegalIndicesStrict(); - // DataView function TestDataViewConstructor() { var ab = new ArrayBuffer(256);