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

Unified Diff: src/full-codegen.cc

Issue 7523027: Provisional implementation of stack allocated catch variables. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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 | « src/frames.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen.cc
diff --git a/src/full-codegen.cc b/src/full-codegen.cc
index 8c2f0d178fdfc1ee6c26a9bc462de02f7b4ffd67..bb9cffe54a1b8e3f94d34a8328438e7095398f82 100644
--- a/src/full-codegen.cc
+++ b/src/full-codegen.cc
@@ -101,6 +101,11 @@ void BreakableStatementChecker::VisitExitContextStatement(
}
+void BreakableStatementChecker::VisitExitScopedBlockStatement(
+ ExitScopedBlockStatement* stmt) {
+}
+
+
void BreakableStatementChecker::VisitSwitchStatement(SwitchStatement* stmt) {
// Switch statements breakable if the tag expression is.
Visit(stmt->tag());
@@ -975,6 +980,21 @@ void FullCodeGenerator::VisitExitContextStatement(ExitContextStatement* stmt) {
}
+void FullCodeGenerator::VisitExitScopedBlockStatement(
+ ExitScopedBlockStatement* stmt) {
+ Comment cmnt(masm_, "[ ExitScopedBlockStatement");
+ SetStatementPosition(stmt);
+
+ if (scope()->num_heap_slots() > 0) {
+ // Pop context.
+ LoadContextField(context_register(), Context::PREVIOUS_INDEX);
+ // Update local stack frame context field.
+ StoreToFrameField(StandardFrameConstants::kContextOffset,
+ context_register());
+ }
+}
+
+
void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) {
Comment cmnt(masm_, "[ DoWhileStatement");
SetStatementPosition(stmt);
@@ -1106,14 +1126,18 @@ void FullCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) {
__ Call(&try_handler_setup);
// Try handler code, exception in result register.
- // Extend the context before executing the catch block.
- { Comment cmnt(masm_, "[ Extend catch context");
+ if (stmt->scope()->num_heap_slots() > 0) {
+ // Extend the context before executing the catch block.
+ Comment cmnt(masm_, "[ Extend catch context");
__ Push(stmt->variable()->name());
__ push(result_register());
PushFunctionArgumentForContextAllocation();
__ CallRuntime(Runtime::kPushCatchContext, 3);
StoreToFrameField(StandardFrameConstants::kContextOffset,
context_register());
+ } else {
+ // Assign exception value to the stack allocated catch variable.
+ EmitVariableAssignment(stmt->variable(), Token::ASSIGN);
}
Scope* saved_scope = scope();
« no previous file with comments | « src/frames.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698