[modules] Disable Crankshaft for functions referencing module variables.
Also add a primitive mjsunit test that uses such a function optimized by Turbofan. R=mstarzinger@chromium.org CC=adamk@chromium.org BUG=v8:1569 Review-Url: https://codereview.chromium.org/2472143002 Cr-Commit-Position: refs/heads/master@{#40826}
This commit is contained in:
parent
dd155e47bd
commit
cc3195abda
@ -147,8 +147,15 @@ void AstNumberingVisitor::VisitRegExpLiteral(RegExpLiteral* node) {
|
||||
|
||||
void AstNumberingVisitor::VisitVariableProxyReference(VariableProxy* node) {
|
||||
IncrementNodeCount();
|
||||
if (node->var()->IsLookupSlot()) {
|
||||
DisableCrankshaft(kReferenceToAVariableWhichRequiresDynamicLookup);
|
||||
switch (node->var()->location()) {
|
||||
case VariableLocation::LOOKUP:
|
||||
DisableCrankshaft(kReferenceToAVariableWhichRequiresDynamicLookup);
|
||||
break;
|
||||
case VariableLocation::MODULE:
|
||||
DisableCrankshaft(kReferenceToModuleVariable);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
node->set_base_id(ReserveIdRange(VariableProxy::num_ids()));
|
||||
}
|
||||
|
@ -172,6 +172,7 @@ namespace internal {
|
||||
V(kReferenceToAVariableWhichRequiresDynamicLookup, \
|
||||
"Reference to a variable which requires dynamic lookup") \
|
||||
V(kReferenceToGlobalLexicalVariable, "Reference to global lexical variable") \
|
||||
V(kReferenceToModuleVariable, "Reference to module-allocated variable") \
|
||||
V(kReferenceToUninitializedVariable, "Reference to uninitialized variable") \
|
||||
V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root") \
|
||||
V(kRegisterWasClobbered, "Register was clobbered") \
|
||||
|
14
test/mjsunit/modules-turbo.js
Normal file
14
test/mjsunit/modules-turbo.js
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2016 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.
|
||||
|
||||
// MODULE
|
||||
// Flags: --allow-natives-syntax
|
||||
|
||||
export let x = 0;
|
||||
function foo() { x++ };
|
||||
foo();
|
||||
%OptimizeFunctionOnNextCall(foo);
|
||||
foo();
|
||||
assertOptimized(foo);
|
||||
assertEquals(2, x);
|
Loading…
Reference in New Issue
Block a user