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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial