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

Unified Diff: test/webkit/fast/js/object-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
Index: test/webkit/fast/js/object-bad-time.js
diff --git a/test/webkit/dfg-array-pop-side-effects.js b/test/webkit/fast/js/object-bad-time.js
similarity index 64%
copy from test/webkit/dfg-array-pop-side-effects.js
copy to test/webkit/fast/js/object-bad-time.js
index 8d4d5f319a57a3015a3f454a9b06a865ab25dc94..2fdb2d17cedad3d7f914ed1b4f70c632888cd5f4 100644
--- a/test/webkit/dfg-array-pop-side-effects.js
+++ b/test/webkit/fast/js/object-bad-time.js
@@ -22,41 +22,37 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
-"Tests that ArrayPop is known to the DFG to be a side effect."
+"Tests that defining a setter on the prototype of an object used for indexed storage works even if it is done after objects with indexed storage are allocated."
);
-function foo(a, b) {
- var result = a.f;
- result += b.pop();
- result += a.g;
- return result;
+function Cons() {
}
var ouches = 0;
-for (var i = 0; i < 200; ++i) {
- var a = {f:1, g:2};
- var b = [];
- var expected;
- if (i < 150) {
- // Ensure that we always transition the array's structure to one that indicates
- // that we have array storage.
- b.__defineGetter__("0", function() {
- testFailed("Should never get here");
- });
- b.length = 0;
- b[0] = 42;
- expected = "45";
- } else {
- b.__defineGetter__("0", function() {
- debug("Ouch!");
- ouches++;
- delete a.g;
- a.h = 43;
- return 5;
- });
- expected = "0/0";
+
+function foo(haveABadTime) {
+ var result = new Cons();
+ result.length = 5;
+ for (var i = 0; i < result.length; ++i) {
+ if (i == haveABadTime) {
+ debug("Henceforth I will have a bad time.");
+ Cons.prototype.__defineSetter__("3", function() { debug("Ouch!"); ouches++; });
+ }
+ result[i] = i;
}
- shouldBe("foo(a, b)", expected);
+ return result;
+}
+
+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
+ haveABadTime = -1;
+ shouldBe("\"" + Array.prototype.join.apply(foo(haveABadTime), [","]) + "\"", expected);
}
shouldBe("ouches", "50");
« no previous file with comments | « test/webkit/fast/js/numeric-escapes-in-string-literals-expected.txt ('k') | test/webkit/fast/js/object-bad-time-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698