~ubuntu-branches/ubuntu/saucy/mozjs17/saucy

« back to all changes in this revision

Viewing changes to js/src/jit-test/tests/jaeger/loops/property-1.js

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
function foo(x, y) {
 
3
  var res = 0;
 
4
  for (var i = 0; i < 10; i++) {
 
5
    res += x.f + y[i];
 
6
  }
 
7
  return res;
 
8
}
 
9
 
 
10
var x = {f:0};
 
11
var y = Array(10);
 
12
for (var i = 0; i < 10; i++) {
 
13
  if (i == 5)
 
14
    Object.defineProperty(Object.prototype, 5, {get: function() { x.f = 10; return 5}});
 
15
  else
 
16
    y[i] = i;
 
17
}
 
18
 
 
19
assertEq(foo(x, y), 85);