Revision: 20906
Author: da...@chromium.org
Date: Wed Apr 23 12:19:54 2014 UTC
Log: Version 3.25.28.14 (partial merge of r20839)
Fix Object.observe() notifications from Array.push()/Array.pop()
R=mstarzin...@chromium.org
LOG=N
Review URL: https://codereview.chromium.org/247073002
http://code.google.com/p/v8/source/detail?r=20906
Added:
/branches/3.25/test/mjsunit/array-push7.js
Modified:
/branches/3.25/src/hydrogen.cc
/branches/3.25/src/version.cc
=======================================
--- /dev/null
+++ /branches/3.25/test/mjsunit/array-push7.js Wed Apr 23 12:19:54 2014 UTC
@@ -0,0 +1,59 @@
+// 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.
+
+// Flags: --allow-natives-syntax
+
+var v = 0;
+
+function push_wrapper(array, value) {
+ array.push(value);
+}
+function pop_wrapper(array) {
+ return array.pop();
+}
+
+// Test that Object.observe() notification events are properly sent from
+// Array.push() and Array.pop() both from optimized and un-optimized code.
+var array = [];
+
+function somethingChanged(changes) {
+ v++;
+}
+
+Object.observe(array, somethingChanged);
+push_wrapper(array, 1);
+%RunMicrotasks();
+assertEquals(1, array.length);
+assertEquals(1, v);
+push_wrapper(array, 1);
+%RunMicrotasks();
+assertEquals(2, array.length);
+assertEquals(2, v);
+%OptimizeFunctionOnNextCall(push_wrapper);
+push_wrapper(array, 1);
+%RunMicrotasks();
+assertEquals(3, array.length);
+assertEquals(3, v);
+push_wrapper(array, 1);
+%RunMicrotasks();
+assertEquals(4, array.length);
+assertEquals(4, v);
+
+pop_wrapper(array);
+%RunMicrotasks();
+assertEquals(3, array.length);
+assertEquals(5, v);
+pop_wrapper(array);
+%RunMicrotasks();
+assertEquals(2, array.length);
+assertEquals(6, v);
+%OptimizeFunctionOnNextCall(pop_wrapper);
+pop_wrapper(array);
+%RunMicrotasks();
+assertEquals(1, array.length);
+assertEquals(7, v);
+pop_wrapper(array);
+%RunMicrotasks();
+assertEquals(0, array.length);
+assertEquals(8, v);
=======================================
--- /branches/3.25/src/hydrogen.cc Thu Mar 27 01:04:43 2014 UTC
+++ /branches/3.25/src/hydrogen.cc Wed Apr 23 12:19:54 2014 UTC
@@ -7596,6 +7596,8 @@
if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false;
ElementsKind elements_kind = receiver_map->elements_kind();
if (!IsFastElementsKind(elements_kind)) return false;
+ if (receiver_map->is_observed()) return false;
+ ASSERT(receiver_map->is_extensible());
Drop(expr->arguments()->length());
HValue* result;
@@ -7658,6 +7660,8 @@
if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false;
ElementsKind elements_kind = receiver_map->elements_kind();
if (!IsFastElementsKind(elements_kind)) return false;
+ if (receiver_map->is_observed()) return false;
+ ASSERT(receiver_map->is_extensible());
HValue* op_vals[] = {
context(),
=======================================
--- /branches/3.25/src/version.cc Tue Apr 22 12:02:07 2014 UTC
+++ /branches/3.25/src/version.cc Wed Apr 23 12:19:54 2014 UTC
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 25
#define BUILD_NUMBER 28
-#define PATCH_LEVEL 13
+#define PATCH_LEVEL 14
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0
--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.