| // Copyright 2017 the V8 project authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| // Flags: --allow-natives-syntax |
| function listener(event, exec_state, event_data, data) { |
| if (event != Debug.DebugEvent.Break) return; |
| var foo_arguments = exec_state.frame(1).evaluate("arguments").value(); |
| var bar_arguments = exec_state.frame(0).evaluate("arguments").value(); |
| assertArrayEquals(foo_expected, foo_arguments); |
| assertArrayEquals(bar_expected, bar_arguments); |
| Debug.setListener(listener); |
| %PrepareFunctionForOptimization(foo); |
| %OptimizeFunctionOnNextCall(foo); |
| %PrepareFunctionForOptimization(foo); |
| %OptimizeFunctionOnNextCall(foo); |
| assertEquals(6, foo(3,4,5)); |