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

Unified Diff: src/full-codegen.cc

Issue 7280012: Introduce scopes to keep track of catch blocks at compile time. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update to HEAD. Created 9 years, 6 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/full-codegen.cc
diff --git a/src/full-codegen.cc b/src/full-codegen.cc
index 03abfbd85d59b358f1bb758070de41c484a55ea3..70db6114a288bcbb799ccb2d8c3941b265afc015 100644
--- a/src/full-codegen.cc
+++ b/src/full-codegen.cc
@@ -401,7 +401,7 @@ int FullCodeGenerator::SlotOffset(Slot* slot) {
// Adjust by a (parameter or local) base offset.
switch (slot->type()) {
case Slot::PARAMETER:
- offset += (scope()->num_parameters() + 1) * kPointerSize;
+ offset += (info_->scope()->num_parameters() + 1) * kPointerSize;
Mads Ager (chromium) 2011/06/30 12:08:32 Do you need this change? Don't you have a scope he
Kevin Millikin (Chromium) 2011/06/30 12:30:06 This definitely needs to be the function's scope (
Mads Ager (chromium) 2011/06/30 12:47:44 Should we create an accessor for that then: functi
break;
case Slot::LOCAL:
offset += JavaScriptFrameConstants::kLocal0Offset;
@@ -1106,7 +1106,7 @@ void FullCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) {
// Extend the context before executing the catch block.
{ Comment cmnt(masm_, "[ Extend catch context");
- __ Push(stmt->name());
+ __ Push(stmt->variable()->name());
__ push(result_register());
PushFunctionArgumentForContextAllocation();
__ CallRuntime(Runtime::kPushCatchContext, 3);
@@ -1114,7 +1114,11 @@ void FullCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) {
context_register());
}
+ Scope* saved_scope = scope();
Mads Ager (chromium) 2011/06/30 12:08:32 Could use a comment? We could create a scope objec
Kevin Millikin (Chromium) 2011/06/30 12:30:06 It's only used here and I couldn't think of a comm
Mads Ager (chromium) 2011/06/30 12:47:44 Not sure anything is really needed. You are right
+ scope_ = stmt->scope();
+ ASSERT(scope_->declarations()->is_empty());
Visit(stmt->catch_block());
+ scope_ = saved_scope;
__ jmp(&done);
// Try block code. Sets up the exception handler chain.

Powered by Google App Engine
This is Rietveld 408576698