Changeset 185158 in webkit for trunk/Source/JavaScriptCore/tests


Ignore:
Timestamp:
Jun 3, 2015, 11:48:41 AM (10 years ago)
Author:
[email protected]
Message:

Improve test coverage for changes made in 145527
https://bugs.webkit.org/show_bug.cgi?id=145578

Reviewed by Geoffrey Garen.

Added more complexity to poly-setter-combo.js stress test to create more turmoil in the
polymorphic get-by-id / put-by-id with getters and setters to exercise the code change in
https://bugs.webkit.org/show_bug.cgi?id=145527. By changing the objects that the main test
function sees, we are able to test those paths. Verified with temporary logging code.

  • tests/stress/poly-setter-combo.js:

(Cons2):
(Cons3):
(Cons4):
(foo):
(test):
(runTestWithConstructors):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/tests/stress/poly-setter-combo.js

    r172129 r185158  
    44
    55function Cons2() {
     6    this._values = []
    67}
    78Cons2.prototype.__defineSetter__("f", function(value) {
    89    counter++;
    910    this._f = value;
     11    this._values[value] = 1;
    1012});
    1113Cons2.prototype.__defineGetter__("f", function() { return this._f; });
     14
     15function Cons3() {
     16}
     17Cons3.prototype.f = 42;
     18Cons3.prototype.g = 43;
     19
     20function Cons4() {
     21    this._values = []
     22}
     23Cons4.prototype.g = 16;
     24Cons4.prototype.__defineSetter__("f", function(value) {
     25    counter++;
     26    this._f = value;
     27    this._values[value] = 1;
     28});
     29Cons4.prototype.__defineGetter__("f", function() { return this._f; });
    1230
    1331function foo(o, value) {
     
    2846}
    2947
    30 for (var i = 0; i < 100000; ++i) {
    31     test(new Cons1(), i, counter);
    32     test(new Cons2(), i, counter + 1);
    33    
    34     var o = {};
    35     o.__defineSetter__("f", function(value) {
    36         this._f = value;
    37         counter++;
    38     });
    39     o.__defineGetter__("f", function() { return this._f; });
    40     test(o, i, counter + 1);
     48function runTestWithConstructors(constructor1, constructor2) {
     49    for (var i = 0; i < 5000; ++i) {
     50        test(new constructor1(), i, counter);
     51        test(new constructor2(), i, counter + 1);
    4152
    42     test({f: 42}, i, counter);
     53        var o = {};
     54        o.__defineGetter__("f", function() {
     55            counter++;
     56            return 84;
     57        });
     58        test(o, 84, counter + 1);
     59
     60        var o = {};
     61        o.__defineSetter__("f", function(value) {
     62            this._f = value;
     63            counter++;
     64        });
     65        o.__defineGetter__("f", function() { return this._f; });
     66        test(o, i, counter + 1);
     67
     68        test({f: 42}, i, counter);
     69    }
    4370}
     71
     72for (var i = 0; i < 2; ++i) {
     73    runTestWithConstructors(Cons1, Cons2);
     74    runTestWithConstructors(Cons3, Cons2);
     75    runTestWithConstructors(Cons1, Cons4);
     76    runTestWithConstructors(Cons3, Cons4);
     77}
Note: See TracChangeset for help on using the changeset viewer.