]>
Commit | Line | Data |
---|---|---|
81345200 A |
1 | function foo(o, v1) { |
2 | o.f = v1; | |
3 | o.k = v1 * 33; | |
4 | } | |
5 | ||
6 | noInline(foo); | |
7 | ||
8 | for (var i = 0; i < 100; ++i) { | |
9 | var o = {g_: 5}; | |
10 | o.__defineSetter__("f", function(value) { this.g_ += 42 * value; }); | |
11 | o.__defineSetter__("g", function(value) { this.g_ += 43 * value; }); | |
12 | o.__defineSetter__("h", function(value) { this.g_ += 44 * value; }); | |
13 | o.__defineSetter__("i", function(value) { this.g_ += 45 * value; }); | |
14 | o.__defineSetter__("j", function(value) { this.g_ += 46 * value; }); | |
15 | o.__defineSetter__("k", function(value) { this.g_ += 47 * value; }); | |
16 | foo(o, 29); | |
17 | if (o.g_ != 5 + 42 * 29 + 29 * 47 * 33) | |
18 | throw "Error: bad result: " + o.g_; | |
19 | } | |
20 | ||
21 | // Test the case where those fields aren't setters anymore. | |
22 | var o = {g_: 5}; | |
23 | o.f = 1; | |
24 | o.g = 2; | |
25 | o.h = 3; | |
26 | o.i = 4; | |
27 | o.j = 5; | |
28 | o.k = 6; | |
29 | foo(o, 29); | |
30 | if (o.g_ != 5) | |
31 | throw "Error: bad value of g_: " + o.g_; | |
32 | if (o.f != 29) | |
33 | throw "Error: bad value of f: " + o.f; | |
34 | if (o.k != 29 * 33) | |
35 | throw "Error: bad value of k: " + o.k; | |
36 | ||
37 | // Test the case where they are setters but they're not the same setters. | |
38 | var o = {g_: 5}; | |
39 | o.__defineSetter__("f", function(value) { this.g_ += 52 * value; }); | |
40 | o.__defineSetter__("g", function(value) { this.g_ += 53 * value; }); | |
41 | o.__defineSetter__("h", function(value) { this.g_ += 54 * value; }); | |
42 | o.__defineSetter__("i", function(value) { this.g_ += 55 * value; }); | |
43 | o.__defineSetter__("j", function(value) { this.g_ += 56 * value; }); | |
44 | o.__defineSetter__("k", function(value) { this.g_ += 57 * value; }); | |
45 | foo(o, 29); | |
46 | if (o.g_ != 5 + 52 * 29 + 29 * 57 * 33) | |
47 | throw "Error: bad result at end: " + o.g_; |