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

Unified Diff: src/scopes.cc

Issue 653603002: Try to fix cross-script global scope (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « src/scopes.h ('k') | src/v8natives.js » ('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 0dfc3a2c426f4a917823cbf13a677940509e1dd0..fe78811b4c35f1a2847353898352076bcbbcdb2b 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -270,6 +270,9 @@ bool Scope::Analyze(CompilationInfo* info) {
!top->outer_scope()->already_resolved()) {
top = top->outer_scope();
}
+ // TODO(rossberg): remove the above.
+ top = info->global_scope();
+ ASSERT(top->is_global_scope());
// Allocate the variables.
{
@@ -773,6 +776,7 @@ static const char* Header(ScopeType scope_type) {
case FUNCTION_SCOPE: return "function";
case MODULE_SCOPE: return "module";
case GLOBAL_SCOPE: return "global";
+ case SCRIPT_SCOPE: return "script";
case CATCH_SCOPE: return "catch";
case BLOCK_SCOPE: return "block";
case WITH_SCOPE: return "with";
@@ -1223,11 +1227,15 @@ bool Scope::HasArgumentsParameter() {
void Scope::AllocateStackSlot(Variable* var) {
+ ASSERT(var->scope() == this);
var->AllocateTo(Variable::LOCAL, num_stack_slots_++);
}
void Scope::AllocateHeapSlot(Variable* var) {
+printf("[AllocateHeapSlot] scope=%p %s var=%.*s\n", (void*)this, Variable::Mode2String(var->mode()), var->raw_name()->length(), var->raw_name()->raw_data());
+if (var->mode() == LET) base::OS::DebugBreak();
+ ASSERT(var->scope() == this);
var->AllocateTo(Variable::CONTEXT, num_heap_slots_++);
}
« no previous file with comments | « src/scopes.h ('k') | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698