[turbofan] Implement top-level lookup slot declaration.

This implements declaration of lookup slots for variables and functions
within optimized code. Such a declaration only appears with top-level
eval code, which we only recently started handling in TurboFan.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/1962723002
Cr-Commit-Position: refs/heads/master@{#36125}
This commit is contained in:
mstarzinger 2016-05-10 01:18:58 -07:00 committed by Commit bot
parent a37ab71e34
commit 7b37243358
13 changed files with 49 additions and 9 deletions

View File

@ -1114,10 +1114,22 @@ void AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) {
NewNode(op, current_context(), value);
}
break;
case VariableLocation::LOOKUP:
// TODO(mstarzinger): Implement this case.
SetStackOverflow();
case VariableLocation::LOOKUP: {
Node* name = jsgraph()->Constant(variable->name());
// For variables we must not push an initial value (such as 'undefined')
// because we may have a (legal) redeclaration and we must not destroy
// the current value.
Node* value =
hole_init ? jsgraph()->TheHoleConstant()
: jsgraph()->ZeroConstant(); // Indicates no initial value.
Node* attr =
jsgraph()->Constant(variable->DeclarationPropertyAttributes());
const Operator* op =
javascript()->CallRuntime(Runtime::kDeclareLookupSlot);
Node* store = NewNode(op, name, value, attr);
PrepareFrameState(store, decl->proxy()->id());
break;
}
}
}
@ -1149,10 +1161,18 @@ void AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) {
NewNode(op, current_context(), value);
break;
}
case VariableLocation::LOOKUP:
// TODO(mstarzinger): Implement this case.
SetStackOverflow();
case VariableLocation::LOOKUP: {
VisitForValue(decl->fun());
Node* value = environment()->Pop();
Node* name = jsgraph()->Constant(variable->name());
Node* attr =
jsgraph()->Constant(variable->DeclarationPropertyAttributes());
const Operator* op =
javascript()->CallRuntime(Runtime::kDeclareLookupSlot);
Node* store = NewNode(op, name, value, attr);
PrepareFrameState(store, decl->proxy()->id());
break;
}
}
}

View File

@ -812,6 +812,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
__ Push(r2, r0);
__ Push(Smi::FromInt(variable->DeclarationPropertyAttributes()));
__ CallRuntime(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}
@ -869,6 +870,7 @@ void FullCodeGenerator::VisitFunctionDeclaration(
VisitForStackValue(declaration->fun());
PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes()));
CallRuntimeWithOperands(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}

View File

@ -810,6 +810,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
}
__ Push(Smi::FromInt(variable->DeclarationPropertyAttributes()));
__ CallRuntime(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}
@ -867,6 +868,7 @@ void FullCodeGenerator::VisitFunctionDeclaration(
VisitForStackValue(declaration->fun());
PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes()));
CallRuntimeWithOperands(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}

View File

@ -758,6 +758,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
__ push(
Immediate(Smi::FromInt(variable->DeclarationPropertyAttributes())));
__ CallRuntime(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}
@ -811,6 +812,7 @@ void FullCodeGenerator::VisitFunctionDeclaration(
VisitForStackValue(declaration->fun());
PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes()));
CallRuntimeWithOperands(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}

View File

@ -810,6 +810,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
__ Push(a2, a0);
__ Push(Smi::FromInt(variable->DeclarationPropertyAttributes()));
__ CallRuntime(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}
@ -867,6 +868,7 @@ void FullCodeGenerator::VisitFunctionDeclaration(
VisitForStackValue(declaration->fun());
PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes()));
CallRuntimeWithOperands(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}

View File

@ -809,6 +809,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
__ Push(a2, a0);
__ Push(Smi::FromInt(variable->DeclarationPropertyAttributes()));
__ CallRuntime(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}
@ -866,6 +867,7 @@ void FullCodeGenerator::VisitFunctionDeclaration(
VisitForStackValue(declaration->fun());
PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes()));
CallRuntimeWithOperands(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}

View File

@ -774,6 +774,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
__ Push(r5, r3);
__ Push(Smi::FromInt(variable->DeclarationPropertyAttributes()));
__ CallRuntime(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}
@ -827,6 +828,7 @@ void FullCodeGenerator::VisitFunctionDeclaration(
VisitForStackValue(declaration->fun());
PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes()));
CallRuntimeWithOperands(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}

View File

@ -752,6 +752,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
__ Push(r4, r2);
__ Push(Smi::FromInt(variable->DeclarationPropertyAttributes()));
__ CallRuntime(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}
@ -803,6 +804,7 @@ void FullCodeGenerator::VisitFunctionDeclaration(
VisitForStackValue(declaration->fun());
PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes()));
CallRuntimeWithOperands(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}

View File

@ -770,6 +770,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
}
__ Push(Smi::FromInt(variable->DeclarationPropertyAttributes()));
__ CallRuntime(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}
@ -824,6 +825,7 @@ void FullCodeGenerator::VisitFunctionDeclaration(
VisitForStackValue(declaration->fun());
PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes()));
CallRuntimeWithOperands(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}

View File

@ -755,6 +755,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
__ push(
Immediate(Smi::FromInt(variable->DeclarationPropertyAttributes())));
__ CallRuntime(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}
@ -803,6 +804,7 @@ void FullCodeGenerator::VisitFunctionDeclaration(
VisitForStackValue(declaration->fun());
PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes()));
CallRuntimeWithOperands(Runtime::kDeclareLookupSlot);
PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
break;
}
}

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --verify-heap --expose-gc
// Flags: --ignition --verify-heap --expose-gc
// Tests that verify heap works for BytecodeArrays in the large object space.

View File

@ -76,6 +76,7 @@
'unicode-test': [PASS, NO_VARIANTS],
'whitespaces': [PASS, NO_VARIANTS],
'compiler/osr-assert': [PASS, NO_VARIANTS],
'ignition/regress-599001-verifyheap': [PASS, NO_VARIANTS],
'es6/string-fromcodepoint': [PASS, NO_VARIANTS],
'regress/regress-2185-2': [PASS, NO_VARIANTS],
'regress/regress-2612': [PASS, NO_VARIANTS],

View File

@ -59,6 +59,7 @@
# TODO(turbofan): Causes timeouts since top-level code is optimized.
'ecma_3/Statements/regress-324650': [PASS, NO_VARIANTS],
'ecma_3/Statements/regress-444979': [PASS, NO_VARIANTS],
'ecma_3/Statements/regress-74474-002': [PASS, NO_VARIANTS],
'ecma_3/Statements/regress-74474-003': [PASS, NO_VARIANTS],
'js1_5/Regress/regress-111557': [PASS, NO_VARIANTS],
@ -189,7 +190,7 @@
'ecma_3/RegExp/regress-209067': [PASS, ['mode == debug', FAIL]],
'js1_5/GC/regress-278725': [PASS, ['mode == debug', FAIL]],
# http://b/issue?id=1206983
'js1_5/Regress/regress-367561-03': [PASS, ['mode == debug', FAIL]],
'js1_5/Regress/regress-367561-03': [PASS, ['mode == debug', FAIL], NO_VARIANTS],
'ecma/Date/15.9.5.10-2': [PASS, FAIL, ['mode == debug', TIMEOUT, NO_VARIANTS]],
# These tests create two Date objects just after each other and
@ -241,7 +242,7 @@
'js1_5/Array/regress-99120-01': [PASS, FAIL, NO_VARIANTS],
'js1_5/Array/regress-99120-02': [PASS, FAIL],
'js1_5/Regress/regress-347306-01': [PASS, FAIL],
'js1_5/Regress/regress-416628': [PASS, FAIL, ['mode == debug', TIMEOUT, NO_VARIANTS]],
'js1_5/Regress/regress-416628': [PASS, FAIL, ['mode == debug', TIMEOUT], NO_VARIANTS],
# The following two tests assume that daylight savings time starts first