Reviewers: Jakob,
Description:
Add regression test for optimized count operation.
This is a regression test for a bug with handling of count operations
that target a JavaScript accessor on the prototype chain in Crankshaft.
[email protected]
BUG=chromium:306851
TEST=mjsunit/regress/regress-crbug-306851
Please review this at https://codereview.chromium.org/27702002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+20, -10 lines):
A + test/mjsunit/regress/regress-crbug-306851.js
Index: test/mjsunit/regress/regress-crbug-306851.js
diff --git a/test/mjsunit/regress/regress-crbug-233737.js
b/test/mjsunit/regress/regress-crbug-306851.js
similarity index 77%
copy from test/mjsunit/regress/regress-crbug-233737.js
copy to test/mjsunit/regress/regress-crbug-306851.js
index
835726b22429ec3cca68df956255d47c53fcfd25..77b711a656c977d27d835d6746fdf5654993cd7b
100644
--- a/test/mjsunit/regress/regress-crbug-233737.js
+++ b/test/mjsunit/regress/regress-crbug-306851.js
@@ -27,16 +27,26 @@
// Flags: --allow-natives-syntax
-var a = new Array(2);
-a[0] = 1;
-assertTrue(%HasFastSmiElements(a));
-assertTrue(%HasFastHoleyElements(a));
+function Counter() {
+ this.value = 0;
+};
-function hole(i) {
- return a[i] << 0;
+Object.defineProperty(Counter.prototype, 'count', {
+ get: function() { return this.value; },
+ set: function(value) { this.value = value; }
+});
+
+var obj = new Counter();
+
+function bummer() {
+ obj.count++;
+ return obj.count;
}
-assertEquals(1, hole(0));
-assertEquals(1, hole(0));
-%OptimizeFunctionOnNextCall(hole);
-assertEquals(0, hole(1));
\ No newline at end of file
+assertEquals(1, bummer());
+assertEquals(2, bummer());
+assertEquals(3, bummer());
+%OptimizeFunctionOnNextCall(bummer);
+assertEquals(4, bummer());
+assertEquals(5, bummer());
+assertEquals(6, bummer());
--
--
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/groups/opt_out.