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

Side by Side Diff: src/scopes.cc

Issue 24076007: Unify handling of position info in AST, part 1 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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
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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 return function_->proxy()->var(); 430 return function_->proxy()->var();
431 } else if (!scope_info_.is_null()) { 431 } else if (!scope_info_.is_null()) {
432 // If we are backed by a scope info, try to lookup the variable there. 432 // If we are backed by a scope info, try to lookup the variable there.
433 VariableMode mode; 433 VariableMode mode;
434 int index = scope_info_->FunctionContextSlotIndex(*name, &mode); 434 int index = scope_info_->FunctionContextSlotIndex(*name, &mode);
435 if (index < 0) return NULL; 435 if (index < 0) return NULL;
436 Variable* var = new(zone()) Variable( 436 Variable* var = new(zone()) Variable(
437 this, name, mode, true /* is valid LHS */, 437 this, name, mode, true /* is valid LHS */,
438 Variable::NORMAL, kCreatedInitialized); 438 Variable::NORMAL, kCreatedInitialized);
439 VariableProxy* proxy = factory->NewVariableProxy(var); 439 VariableProxy* proxy = factory->NewVariableProxy(var);
440 VariableDeclaration* declaration = 440 VariableDeclaration* declaration = factory->NewVariableDeclaration(
441 factory->NewVariableDeclaration(proxy, mode, this); 441 proxy, mode, this, RelocInfo::kNoPosition);
442 DeclareFunctionVar(declaration); 442 DeclareFunctionVar(declaration);
443 var->AllocateTo(Variable::CONTEXT, index); 443 var->AllocateTo(Variable::CONTEXT, index);
444 return var; 444 return var;
445 } else { 445 } else {
446 return NULL; 446 return NULL;
447 } 447 }
448 } 448 }
449 449
450 450
451 Variable* Scope::Lookup(Handle<String> name) { 451 Variable* Scope::Lookup(Handle<String> name) {
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 } 1407 }
1408 1408
1409 1409
1410 int Scope::ContextLocalCount() const { 1410 int Scope::ContextLocalCount() const {
1411 if (num_heap_slots() == 0) return 0; 1411 if (num_heap_slots() == 0) return 0;
1412 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1412 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1413 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); 1413 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0);
1414 } 1414 }
1415 1415
1416 } } // namespace v8::internal 1416 } } // namespace v8::internal
OLDNEW
« src/parser.cc ('K') | « src/rewriter.cc ('k') | test/cctest/test-ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698