Home | History | Annotate | Download | only in mjsunit
      1 // Copyright 2015 the V8 project authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Flags: --allow-natives-syntax
      6 
      7 function Foo(x) {
      8   this.x = x;
      9 }
     10 
     11 var f = new Foo(1.25);
     12 var g = new Foo(2.25);
     13 
     14 function add(a, b) {
     15   var name = "x";
     16   return a[name] + b[name];
     17 }
     18 
     19 assertEquals(3.5, add(f, g));
     20 assertEquals(3.5, add(g, f));
     21 %OptimizeFunctionOnNextCall(add);
     22 assertEquals(3.5, add(f, g));
     23 assertEquals(3.5, add(g, f));
     24