1function foo(o, v1) { 2 o.f = v1; 3 o.k = v1 * 33; 4} 5 6noInline(foo); 7 8for (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. 22var o = {g_: 5}; 23o.f = 1; 24o.g = 2; 25o.h = 3; 26o.i = 4; 27o.j = 5; 28o.k = 6; 29foo(o, 29); 30if (o.g_ != 5) 31 throw "Error: bad value of g_: " + o.g_; 32if (o.f != 29) 33 throw "Error: bad value of f: " + o.f; 34if (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. 38var o = {g_: 5}; 39o.__defineSetter__("f", function(value) { this.g_ += 52 * value; }); 40o.__defineSetter__("g", function(value) { this.g_ += 53 * value; }); 41o.__defineSetter__("h", function(value) { this.g_ += 54 * value; }); 42o.__defineSetter__("i", function(value) { this.g_ += 55 * value; }); 43o.__defineSetter__("j", function(value) { this.g_ += 56 * value; }); 44o.__defineSetter__("k", function(value) { this.g_ += 57 * value; }); 45foo(o, 29); 46if (o.g_ != 5 + 52 * 29 + 29 * 57 * 33) 47 throw "Error: bad result at end: " + o.g_; 48