v8/test/mjsunit/deopt-with-outer-context.js
rmcilroy 677e54e244 [Interpreter] Always store current context in the frames context slot.
Change the interpreter to always store the current context in the frame's
context slot instead of the function context. This makes it possible to
restore the correct context during deopt.

BUG=v8:4678,v8:4280
LOG=N

Review URL: https://codereview.chromium.org/1604923002

Cr-Commit-Position: refs/heads/master@{#33477}
2016-01-23 00:07:49 +00:00

23 lines
577 B
JavaScript

// Copyright 2015 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 outer(y) {
function inner() {
var x = 10;
(function() {
// Access x from inner function to force it to be context allocated.
x = 20;
%DeoptimizeFunction(inner);
})();
// Variable y should be read from the outer context.
return y;
};
%OptimizeFunctionOnNextCall(inner);
return inner();
}
assertEquals(30, outer(30));