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

Side by Side Diff: test/webkit/dictionary-no-cache.js

Issue 18068003: Migrated several tests from blink to V8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions
6 // are met:
7 // 1. Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // 2. Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 //
13 // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y
14 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 // DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y
17 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N
20 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
24 description("Test to ensure that we handle caching of prototype chains containin g dictionaries.");
25
26 var Test = function(){};
27
28 var methodCount = 65;
29
30 for (var i = 0; i < methodCount; i++){
31 Test.prototype['myMethod' + i] = function(){};
32 }
33
34 var test1 = new Test();
35
36 for (var k in test1);
37
38 Test.prototype.myAdditionalMethod = function(){};
39 var test2 = new Test();
40 var j = k;
41 var foundNewPrototypeProperty = false;
42 for (var k in test2){
43 if ("myAdditionalMethod" == k) foundNewPrototypeProperty = true;
44 }
45 shouldBeTrue('foundNewPrototypeProperty');
46
47 var Test = function(){};
48 for (var i = 0; i < methodCount; i++){
49 Test.prototype['myMethod' + i] = function(){};
50 }
51 var test1 = new Test();
52
53 for (var k in test1);
54
55 delete (Test.prototype)[k]
56 var test2 = new Test();
57 var j = k;
58 var foundRemovedPrototypeProperty = false;
59 for (var k in test2){
60 if (j == k) foundRemovedPrototypeProperty = true;
61 }
62 shouldBeFalse("foundRemovedPrototypeProperty");
63
64 var Test = function(){};
65 for (var i = 0; i < methodCount; i++){
66 Test.prototype['myMethod' + i] = function(){};
67 }
68
69 function update(test) {
70 test.newProperty = true;
71 }
72 var test1 = new Test();
73 update(test1);
74
75 var test2 = new Test();
76 update(test2);
77
78 var test3 = new Test();
79 update(test3);
80 var calledNewPrototypeSetter = false;
81 Test.prototype.__defineSetter__("newProperty", function(){ calledNewPrototypeSet ter = true; });
82 var test4 = new Test();
83 update(test4);
84 shouldBeTrue('calledNewPrototypeSetter');
85
86 var test4 = {__proto__:{prop:"on prototype"}};
87 for (var i = 0; i < 200; i++)
88 test4[i]=[i];
89
90 var test5 = {__proto__:{__proto__:{prop:"on prototype's prototype"}}};
91 for (var i = 0; i < 200; i++)
92 test5[i]=[i];
93
94 getTestProperty = function(o) {
95 return o.prop;
96 }
97
98 getTestProperty(test4);
99 getTestProperty(test4);
100 shouldBe("getTestProperty(test4)", '"on prototype"');
101 test4.prop = "on self";
102 shouldBe("getTestProperty(test4)", '"on self"');
103
104 getTestProperty = function(o) {
105 return o.prop;
106 }
107
108 getTestProperty(test5);
109 getTestProperty(test5);
110 shouldBe("getTestProperty(test5)", '"on prototype\'s prototype"');
111 test5.prop = "on self";
112 shouldBe("getTestProperty(test5)", '"on self"');
OLDNEW
« no previous file with comments | « test/webkit/dfg-weak-js-constant-silent-fill-expected.txt ('k') | test/webkit/dictionary-no-cache-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698