Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index 6f4dc275c1f636222258f228bf6d0dc423385a3f..cb7f8a3f90a420c09feef974d8c1dfe4d0815dcd 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -450,11 +450,12 @@ 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; } |
bool IsValue() const { return kind_ == Expression::kValue; } |
+ bool HasStackOverflow() const { return generator_->HasStackOverflow(); } |
rmcilroy
2016/02/25 10:35:13
Could you just expose generator() as a protected m
mythria
2016/02/25 11:02:03
Done.
|
virtual void SetResultInAccumulator() = 0; |
virtual void SetResultInRegister(Register reg) = 0; |
@@ -536,7 +537,10 @@ class BytecodeGenerator::RegisterResultScope final |
set_result_identified(); |
} |
- Register ResultRegister() const { return result_register_; } |
+ Register ResultRegister() { |
+ if (HasStackOverflow() && !result_identified()) SetResultInAccumulator(); |
+ return result_register_; |
+ } |
private: |
Register result_register_; |
@@ -1267,7 +1271,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(); |