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

Side by Side Diff: src/scopes.cc

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/scanner-character-streams.cc ('k') | src/serialize.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 // Traverse the scope tree up to the first unresolved scope or the global 284 // Traverse the scope tree up to the first unresolved scope or the global
285 // scope and start scope resolution and variable allocation from that scope. 285 // scope and start scope resolution and variable allocation from that scope.
286 while (!top->is_global_scope() && 286 while (!top->is_global_scope() &&
287 !top->outer_scope()->already_resolved()) { 287 !top->outer_scope()->already_resolved()) {
288 top = top->outer_scope(); 288 top = top->outer_scope();
289 } 289 }
290 290
291 // Allocate the variables. 291 // Allocate the variables.
292 { 292 {
293 AstNodeFactory<AstNullVisitor> ast_node_factory(info->isolate(), 293 AstNodeFactory<AstNullVisitor> ast_node_factory(info->zone());
294 info->zone());
295 if (!top->AllocateVariables(info, &ast_node_factory)) return false; 294 if (!top->AllocateVariables(info, &ast_node_factory)) return false;
296 } 295 }
297 296
298 #ifdef DEBUG 297 #ifdef DEBUG
299 if (info->isolate()->bootstrapper()->IsActive() 298 if (info->isolate()->bootstrapper()->IsActive()
300 ? FLAG_print_builtin_scopes 299 ? FLAG_print_builtin_scopes
301 : FLAG_print_scopes) { 300 : FLAG_print_scopes) {
302 scope->Print(); 301 scope->Print();
303 } 302 }
304 303
305 if (FLAG_harmony_modules && FLAG_print_interfaces && top->is_global_scope()) { 304 if (FLAG_harmony_modules && FLAG_print_interfaces && top->is_global_scope()) {
306 PrintF("global : "); 305 PrintF("global : ");
307 top->interface()->Print(); 306 top->interface()->Print();
308 } 307 }
309 #endif 308 #endif
310 309
311 info->SetScope(scope); 310 info->PrepareForCompilation(scope);
312 return true; 311 return true;
313 } 312 }
314 313
315 314
316 void Scope::Initialize() { 315 void Scope::Initialize() {
317 ASSERT(!already_resolved()); 316 ASSERT(!already_resolved());
318 317
319 // Add this scope as a new inner scope of the outer scope. 318 // Add this scope as a new inner scope of the outer scope.
320 if (outer_scope_ != NULL) { 319 if (outer_scope_ != NULL) {
321 outer_scope_->inner_scopes_.Add(this, zone()); 320 outer_scope_->inner_scopes_.Add(this, zone());
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 } 1404 }
1406 1405
1407 1406
1408 int Scope::ContextLocalCount() const { 1407 int Scope::ContextLocalCount() const {
1409 if (num_heap_slots() == 0) return 0; 1408 if (num_heap_slots() == 0) return 0;
1410 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1409 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1411 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); 1410 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0);
1412 } 1411 }
1413 1412
1414 } } // namespace v8::internal 1413 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/scanner-character-streams.cc ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698