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

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

Issue 1605633003: [interpreter] First implementation of stack unwinding. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_int-5
Patch Set: Created 4 years, 11 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
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 0b74a8dd3b8a100a40ea16598c06858f1b8aad42..db6acc2505a3f2c32718cbea7ca90812372b6318 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -917,17 +917,8 @@ void BytecodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) {
// TODO(mstarzinger): Implement this!
// Create a catch scope that binds the exception.
- register_allocator()->PrepareForConsecutiveAllocations(3);
- Register name = register_allocator()->NextConsecutiveRegister();
- Register exception = register_allocator()->NextConsecutiveRegister();
- Register closure = register_allocator()->NextConsecutiveRegister();
- builder()
- ->StoreAccumulatorInRegister(exception)
- .LoadLiteral(stmt->variable()->name())
- .StoreAccumulatorInRegister(name);
- VisitFunctionClosureForContext();
- builder()->StoreAccumulatorInRegister(closure).CallRuntime(
- Runtime::kPushCatchContext, name, 3);
+ VisitNewLocalCatchContext(stmt->variable());
+ ContextScope scope(this, stmt->scope());
// Evaluate the catch-block.
Visit(stmt->catch_block());
@@ -2123,6 +2114,27 @@ void BytecodeGenerator::VisitNewLocalBlockContext(Scope* scope) {
}
+void BytecodeGenerator::VisitNewLocalCatchContext(Variable* variable) {
+ AccumulatorResultScope accumulator_execution_result(this);
+ DCHECK(variable->IsContextSlot());
+
+ // Allocate a new local block context.
+ register_allocator()->PrepareForConsecutiveAllocations(3);
+ Register name = register_allocator()->NextConsecutiveRegister();
+ Register exception = register_allocator()->NextConsecutiveRegister();
+ Register closure = register_allocator()->NextConsecutiveRegister();
+
+ builder()
+ ->StoreAccumulatorInRegister(exception)
+ .LoadLiteral(variable->name())
+ .StoreAccumulatorInRegister(name);
+ VisitFunctionClosureForContext();
+ builder()->StoreAccumulatorInRegister(closure).CallRuntime(
+ Runtime::kPushCatchContext, name, 3);
+ execution_result()->SetResultInAccumulator();
+}
+
+
void BytecodeGenerator::VisitObjectLiteralAccessor(
Register home_object, ObjectLiteralProperty* property, Register value_out) {
// TODO(rmcilroy): Replace value_out with VisitForRegister();

Powered by Google App Engine
This is Rietveld 408576698