| Index: src/interpreter/bytecode-generator.cc
|
| diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
|
| index 6f4dc275c1f636222258f228bf6d0dc423385a3f..aaf2dca2dffb21e772b856cabf5ab091f94e56c6 100644
|
| --- a/src/interpreter/bytecode-generator.cc
|
| +++ b/src/interpreter/bytecode-generator.cc
|
| @@ -450,7 +450,7 @@ class BytecodeGenerator::ExpressionResultScope {
|
|
|
| virtual ~ExpressionResultScope() {
|
| generator_->set_execution_result(outer_);
|
| - DCHECK(result_identified());
|
| + DCHECK(result_identified() || generator_->HasStackOverflow());
|
| }
|
|
|
| bool IsEffect() const { return kind_ == Expression::kEffect; }
|
| @@ -462,6 +462,7 @@ class BytecodeGenerator::ExpressionResultScope {
|
| protected:
|
| ExpressionResultScope* outer() const { return outer_; }
|
| BytecodeArrayBuilder* builder() const { return generator_->builder(); }
|
| + BytecodeGenerator* generator() const { return generator_; }
|
| const RegisterAllocationScope* allocator() const { return &allocator_; }
|
|
|
| void set_result_identified() {
|
| @@ -536,7 +537,12 @@ class BytecodeGenerator::RegisterResultScope final
|
| set_result_identified();
|
| }
|
|
|
| - Register ResultRegister() const { return result_register_; }
|
| + Register ResultRegister() {
|
| + if (generator()->HasStackOverflow() && !result_identified()) {
|
| + SetResultInAccumulator();
|
| + }
|
| + return result_register_;
|
| + }
|
|
|
| private:
|
| Register result_register_;
|
| @@ -1267,7 +1273,9 @@ void BytecodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) {
|
| // Find or build a shared function info.
|
| Handle<SharedFunctionInfo> shared_info =
|
| Compiler::GetSharedFunctionInfo(expr, info()->script(), info());
|
| - CHECK(!shared_info.is_null()); // TODO(rmcilroy): Set stack overflow?
|
| + if (shared_info.is_null()) {
|
| + return SetStackOverflow();
|
| + }
|
| builder()->CreateClosure(shared_info,
|
| expr->pretenure() ? TENURED : NOT_TENURED);
|
| execution_result()->SetResultInAccumulator();
|
|
|