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 g(a, b, c) { 8 return a + b + c; 9 } 10 11 var asm = (function Module(global, env, buffer) { 12 "use asm"; 13 14 var i32 = new global.Int32Array(buffer); 15 16 // This is not valid asm.js, but we should still generate correct code. 17 function store(x) { 18 return g(1, i32[0] = x, 2); 19 } 20 21 return { store: store }; 22 })({ 23 "Int32Array": Int32Array 24 }, {}, new ArrayBuffer(64 * 1024)); 25 26 var o = { toString : function() { %DeoptimizeFunction(asm.store); return "1"; } } 27 28 asm.store(o); 29