Revision: 20410
Author:   [email protected]
Date:     Tue Apr  1 16:41:35 2014 UTC
Log:      Support typed arrays in IsMoreGeneralElementsKindTransition.

[email protected]
BUG=357054
LOG=Y

Review URL: https://codereview.chromium.org/220403004
http://code.google.com/p/v8/source/detail?r=20410

Added:
 /branches/bleeding_edge/test/mjsunit/regress/regress-357054.js
Modified:
 /branches/bleeding_edge/src/elements-kind.cc

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-357054.js Tue Apr 1 16:41:35 2014 UTC
@@ -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);
=======================================
--- /branches/bleeding_edge/src/elements-kind.cc Wed Mar 26 12:50:13 2014 UTC +++ /branches/bleeding_edge/src/elements-kind.cc Tue Apr 1 16:41:35 2014 UTC
@@ -170,10 +170,29 @@
   UNREACHABLE();
   return TERMINAL_FAST_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;

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to