PageRenderTime 22ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/js/src/jit-test/tests/jaeger/recompile/bug651119.js

http://github.com/zpao/v8monkey
JavaScript | 51 lines | 51 code | 0 blank | 0 comment | 4 complexity | a9bd8c91170cf39d01d6332adf70b955 MD5 | raw file
 1Object.extend = function(destination, source) {
 2    for (var property in source)
 3        destination[property] = source[property];
 4};
 5var Enumerable = {
 6    _each: function(iterator) {
 7        for (var i = 0, length = this.length; i < length; i++)
 8            iterator(this[i]);
 9    },
10    each: function(iterator, context) {
11        var index = 0;
12        this._each(function(value) {
13            iterator.call(context, value, index++);
14        });
15    },
16    map: function(iterator, context) {
17        var results = [];
18        this.each(function(value, index) {
19            var res = iterator.call(context, value);
20            results.push(res);
21        });
22        return results;
23    },
24    invoke: function(method) {
25        var args = $A(arguments).slice(1);
26        return this.map(function(value) {
27            return value[method].apply(value, args);
28        });
29    },
30};
31Object.extend(Array.prototype, Enumerable);
32function $A(iterable) {
33    var length = iterable.length || 0, results = new Array(length);
34    while (length--) results[length] = iterable[length];
35    return results;
36}
37function g() {
38    return [1, 2, 3, 4, 5].each(function(part) {
39        return 0;
40    });
41}
42function f() {
43    g();
44    g();
45    g();
46    g();
47    var result = [[2, 1, 3], [6, 5, 4]];    
48    result = result.invoke('invoke', 'toString', 2);
49    result[0].join(', ');
50};
51f();