Add missing FrameState for Runtime_CreateArrayLiteral.

R=jarin@chromium.org
TEST=mjsunit/regress/regress-crbug-451013
BUG=chromium:451013
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#26268}
This commit is contained in:
mstarzinger 2015-01-26 04:45:25 -08:00 committed by Commit bot
parent c6ae373335
commit 00f3f99221
12 changed files with 28 additions and 4 deletions

View File

@ -1893,6 +1893,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
__ CallStub(&stub); __ CallStub(&stub);
} }
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
bool result_saved = false; // Is the result saved to the stack? bool result_saved = false; // Is the result saved to the stack?

View File

@ -1873,6 +1873,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
__ CallStub(&stub); __ CallStub(&stub);
} }
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
bool result_saved = false; // Is the result saved to the stack? bool result_saved = false; // Is the result saved to the stack?

View File

@ -1586,12 +1586,14 @@ class ArrayLiteral FINAL : public MaterializedLiteral {
Handle<FixedArray> constant_elements() const { return constant_elements_; } Handle<FixedArray> constant_elements() const { return constant_elements_; }
ZoneList<Expression*>* values() const { return values_; } ZoneList<Expression*>* values() const { return values_; }
// Unlike other AST nodes, this number of bailout IDs allocated for an BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); }
// ArrayLiteral can vary, so num_ids() is not a static method.
int num_ids() const { return parent_num_ids() + values()->length(); }
// Return an AST id for an element that is used in simulate instructions. // Return an AST id for an element that is used in simulate instructions.
BailoutId GetIdForElement(int i) { return BailoutId(local_id(i)); } BailoutId GetIdForElement(int i) { return BailoutId(local_id(i + 1)); }
// Unlike other AST nodes, this number of bailout IDs allocated for an
// ArrayLiteral can vary, so num_ids() is not a static method.
int num_ids() const { return parent_num_ids() + 1 + values()->length(); }
// Populate the constant elements fixed array. // Populate the constant elements fixed array.
void BuildConstantElements(Isolate* isolate); void BuildConstantElements(Isolate* isolate);

View File

@ -1199,6 +1199,8 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
const Operator* op = const Operator* op =
javascript()->CallRuntime(Runtime::kCreateArrayLiteral, 4); javascript()->CallRuntime(Runtime::kCreateArrayLiteral, 4);
Node* literal = NewNode(op, literals_array, literal_index, constants, flags); Node* literal = NewNode(op, literals_array, literal_index, constants, flags);
PrepareFrameState(literal, expr->CreateLiteralId(),
OutputFrameStateCombine::Push());
// The array and the literal index are both expected on the operand stack // The array and the literal index are both expected on the operand stack
// during computation of the element values. // during computation of the element values.

View File

@ -130,6 +130,7 @@ bool Linkage::NeedsFrameState(Runtime::FunctionId function) {
case Runtime::kCompileLazy: case Runtime::kCompileLazy:
case Runtime::kCompileOptimized: case Runtime::kCompileOptimized:
case Runtime::kCompileString: case Runtime::kCompileString:
case Runtime::kCreateArrayLiteral:
case Runtime::kCreateObjectLiteral: case Runtime::kCreateObjectLiteral:
case Runtime::kDebugBreak: case Runtime::kDebugBreak:
case Runtime::kDataViewSetInt8: case Runtime::kDataViewSetInt8:

View File

@ -1817,6 +1817,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
__ CallStub(&stub); __ CallStub(&stub);
} }
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
bool result_saved = false; // Is the result saved to the stack? bool result_saved = false; // Is the result saved to the stack?

View File

@ -1881,6 +1881,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
__ CallStub(&stub); __ CallStub(&stub);
} }
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
bool result_saved = false; // Is the result saved to the stack? bool result_saved = false; // Is the result saved to the stack?

View File

@ -1878,6 +1878,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
__ CallStub(&stub); __ CallStub(&stub);
} }
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
bool result_saved = false; // Is the result saved to the stack? bool result_saved = false; // Is the result saved to the stack?

View File

@ -1793,6 +1793,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
__ CallStub(&stub); __ CallStub(&stub);
} }
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
bool result_saved = false; // Is the result saved to the stack? bool result_saved = false; // Is the result saved to the stack?

View File

@ -1851,6 +1851,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
__ CallStub(&stub); __ CallStub(&stub);
} }
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
bool result_saved = false; // Is the result saved to the stack? bool result_saved = false; // Is the result saved to the stack?

View File

@ -1806,6 +1806,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
__ CallStub(&stub); __ CallStub(&stub);
} }
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
bool result_saved = false; // Is the result saved to the stack? bool result_saved = false; // Is the result saved to the stack?

View File

@ -0,0 +1,11 @@
// 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.
assertThrows(function testDeepArrayLiteral() {
testDeepArrayLiteral([], [], [[]]);
}, RangeError);
assertThrows(function testDeepObjectLiteral() {
testDeepObjectLiteral({}, {}, {x:[[]]});
}, RangeError);