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

Unified Diff: src/scopes.cc

Issue 3561012: More refactoring of class Compiler's interface. (Closed)
Patch Set: Reindent some code, change some copyright dates. Created 10 years, 2 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
« src/compiler.h ('K') | « src/scopes.h ('k') | src/v8-counters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index 7f1987e847223290a578acd902b0590662345c42..5ff250ff2e959c7386c8089caed4539c8bb2abe1 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -27,9 +27,12 @@
#include "v8.h"
+#include "scopes.h"
+
+#include "bootstrapper.h"
+#include "compiler.h"
#include "prettyprinter.h"
#include "scopeinfo.h"
-#include "scopes.h"
namespace v8 {
namespace internal {
@@ -168,6 +171,25 @@ Scope::Scope(Scope* outer_scope, Type type)
}
+bool Scope::Analyze(CompilationInfo* info) {
+ ASSERT(info->function() != NULL);
+ Scope* top = info->function()->scope();
+ while (top->outer_scope() != NULL) top = top->outer_scope();
+ top->AllocateVariables(info->calling_context());
+
+#ifdef DEBUG
+ if (Bootstrapper::IsActive()
+ ? FLAG_print_builtin_scopes
+ : FLAG_print_scopes) {
+ info->function()->scope()->Print();
+ }
+#endif
+
+ info->SetScope(info->function()->scope());
+ return true; // Can not fail.
+}
+
+
void Scope::Initialize(bool inside_with) {
// Add this scope as a new inner scope of the outer scope.
if (outer_scope_ != NULL) {
« src/compiler.h ('K') | « src/scopes.h ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698