| Index: test/mjsunit/keyed-array-call.js
|
| diff --git a/test/mjsunit/compiler/multiply-sub.js b/test/mjsunit/keyed-array-call.js
|
| similarity index 67%
|
| copy from test/mjsunit/compiler/multiply-sub.js
|
| copy to test/mjsunit/keyed-array-call.js
|
| index 4793181d47a2b4a2b2390f5049758e651ef1ec1c..b97da3cf1b08511d05d41eb0f3e4a4b467702a3b 100644
|
| --- a/test/mjsunit/compiler/multiply-sub.js
|
| +++ b/test/mjsunit/keyed-array-call.js
|
| @@ -25,32 +25,32 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Flags: --allow-natives-syntax
|
| -// Test expressions that can be computed with a multiply-add instruction.
|
| -
|
| -function f(a, b, c) {
|
| - return a - b * c;
|
| +var a = [function(a) { return a+10; },
|
| + function(a) { return a+20; }];
|
| +a.__proto__.test = function(a) { return a+30; }
|
| +function f(i) {
|
| + return "r" + (1, a[i](i+1), a[i](i+2));
|
| }
|
|
|
| -function g(a, b, c) {
|
| - return a * b - c;
|
| -}
|
| +assertEquals("r12", f(0));
|
| +assertEquals("r12", f(0));
|
| +assertEquals("r23", f(1));
|
| +assertEquals("r23", f(1));
|
|
|
| -function h(a, b, c, d) {
|
| - return a * b - c * d;
|
| -}
|
| +// Deopt the stub.
|
| +assertEquals("rtest230", f("test"));
|
|
|
| -assertEquals(-5.41, f(1.1, 2.1, 3.1));
|
| -assertEquals(-5.41, f(1.1, 2.1, 3.1));
|
| -%OptimizeFunctionOnNextCall(f);
|
| -assertEquals(-5.41, f(1.1, 2.1, 3.1));
|
| +var a2 = [function(a) { return a+10; },,
|
| + function(a) { return a+20; }];
|
| +a2.__proto__.test = function(a) { return a+30; }
|
| +function f2(i) {
|
| + return "r" + (1, a2[i](i+1), a2[i](i+2));
|
| +}
|
|
|
| -assertEquals(8.36, g(2.2, 3.3, -1.1));
|
| -assertEquals(8.36, g(2.2, 3.3, -1.1));
|
| -%OptimizeFunctionOnNextCall(g);
|
| -assertEquals(8.36, g(2.2, 3.3, -1.1));
|
| +assertEquals("r12", f2(0));
|
| +assertEquals("r12", f2(0));
|
| +assertEquals("r24", f2(2));
|
| +assertEquals("r24", f2(2));
|
|
|
| -assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
|
| -assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
|
| -%OptimizeFunctionOnNextCall(h);
|
| -assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
|
| +// Deopt the stub. This will throw given that undefined is not a function.
|
| +assertThrows(function() { f2(1) });
|
|
|