Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: test/webkit/fast/js/array-bad-time.js

Issue 20280003: Migrate more tests from blink repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/webkit/fast/js/arguments-expected.txt ('k') | test/webkit/fast/js/array-bad-time-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/webkit/fast/js/array-bad-time.js
diff --git a/test/webkit/dfg-peephole-compare-final-object-to-final-object-or-other-when-both-proven-final-object.js b/test/webkit/fast/js/array-bad-time.js
similarity index 67%
copy from test/webkit/dfg-peephole-compare-final-object-to-final-object-or-other-when-both-proven-final-object.js
copy to test/webkit/fast/js/array-bad-time.js
index f8a67946a2124262a6602a082d65a5e1e72925c0..1d3802eda32068b68da29bea17ff7678bdf3bcb2 100644
--- a/test/webkit/dfg-peephole-compare-final-object-to-final-object-or-other-when-both-proven-final-object.js
+++ b/test/webkit/fast/js/array-bad-time.js
@@ -22,25 +22,34 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
-"Tests that the peephole CompareEq optimization for the case where one side is predicted final object and the other side is predicted either final object or other (i.e. null or undefined) doesn't assert when both sides are also proven final object."
+"Tests that defining a setter on the Array prototype works even if it is done after arrays are allocated."
);
-function foo(a, b) {
+var ouches = 0;
+
+function foo(haveABadTime) {
var result = [];
- result.push(a.f);
- result.push(b.f);
- if (a == b)
- result.push(true);
- else
- result.push(false);
+ result.length = 5;
+ for (var i = 0; i < result.length; ++i) {
+ if (i == haveABadTime) {
+ debug("Henceforth I will have a bad time.");
+ Array.prototype.__defineSetter__("3", function() { debug("Ouch!"); ouches++; });
+ }
+ result[i] = i;
+ }
return result;
}
-for (var i = 0; i < 100; ++i) {
- if (i%2) {
- var o = {f:42};
- shouldBe("foo(o, o)", "[42, 42, true]");
+var expected = "\"0,1,2,3,4\"";
+
+for (var i = 0; i < 1000; ++i) {
+ var haveABadTime;
+ if (i == 950) {
+ haveABadTime = 2;
+ expected = "\"0,1,2,,4\"";
} else
- shouldThrow("foo({f:42}, null)");
+ haveABadTime = -1;
+ shouldBe("\"" + foo(haveABadTime).join(",") + "\"", expected);
}
+shouldBe("ouches", "50");
« no previous file with comments | « test/webkit/fast/js/arguments-expected.txt ('k') | test/webkit/fast/js/array-bad-time-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698