Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 1721983005: [Interpreter] Handles stack overflow in interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed comments. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/interpreter/interpreter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | src/interpreter/interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698