From: dslomov@chromium.org Date: Tue, 1 Apr 2014 16:41:35 +0000 (+0000) Subject: Support typed arrays in IsMoreGeneralElementsKindTransition. X-Git-Tag: upstream/4.7.83~9885 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19c354b7b0eb2115fb11f723acbc19f4b840d518;p=platform%2Fupstream%2Fv8.git Support typed arrays in IsMoreGeneralElementsKindTransition. R=verwaest@chromium.org BUG=357054 LOG=Y Review URL: https://codereview.chromium.org/220403004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20410 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/elements-kind.cc b/src/elements-kind.cc index ff458e0..7b1a65a 100644 --- a/src/elements-kind.cc +++ b/src/elements-kind.cc @@ -172,8 +172,27 @@ ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, } +static bool IsTypedArrayElementsKind(ElementsKind elements_kind) { + return IsFixedTypedArrayElementsKind(elements_kind) || + IsExternalArrayElementsKind(elements_kind); +} + + bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, ElementsKind to_kind) { + if (IsTypedArrayElementsKind(from_kind) || + IsTypedArrayElementsKind(to_kind)) { + switch (from_kind) { +#define FIXED_TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ + case TYPE##_ELEMENTS: \ + return to_kind == EXTERNAL_##TYPE##_ELEMENTS; + + TYPED_ARRAYS(FIXED_TYPED_ARRAY_CASE); +#undef FIXED_TYPED_ARRAY_CASE + default: + return false; + } + } switch (from_kind) { case FAST_SMI_ELEMENTS: return to_kind != FAST_SMI_ELEMENTS; diff --git a/test/mjsunit/regress/regress-357054.js b/test/mjsunit/regress/regress-357054.js new file mode 100644 index 0000000..92a066e --- /dev/null +++ b/test/mjsunit/regress/regress-357054.js @@ -0,0 +1,10 @@ +// Copyright 2014 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[].__defineSetter__(0, function() { }); +function f(a,i,v) { a[i] = v; } +a = [0,0,0]; +f(a,0,5); +a = new Float32Array(5); +f(a,2,5.5);