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

Unified Diff: src/scopes.cc

Issue 3432022: Clean up some messiness in Scopes. (Closed)
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/scopes.h ('k') | src/variables.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 b55e5d5d7bd38744ad07ffcc9d679d9f96b5e481..c4436fe0c1ceb353a9ecf941e1c911e01c937f2d 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -810,8 +810,7 @@ void Scope::AllocateParameterLocals() {
// We are using 'arguments'. Tell the code generator that is needs to
// allocate the arguments object by setting 'arguments_'.
- arguments_ = new VariableProxy(Factory::arguments_symbol(), false, false);
- arguments_->BindTo(arguments);
+ arguments_ = arguments;
// We also need the '.arguments' shadow variable. Declare it and create
// and bind the corresponding proxy. It's ok to declare it only now
@@ -822,13 +821,13 @@ void Scope::AllocateParameterLocals() {
// NewTemporary() because the mode needs to be INTERNAL since this
// variable may be allocated in the heap-allocated context (temporaries
// are never allocated in the context).
- Variable* arguments_shadow =
- new Variable(this, Factory::arguments_shadow_symbol(),
- Variable::INTERNAL, true, Variable::ARGUMENTS);
- arguments_shadow_ =
- new VariableProxy(Factory::arguments_shadow_symbol(), false, false);
- arguments_shadow_->BindTo(arguments_shadow);
- temps_.Add(arguments_shadow);
+ arguments_shadow_ = new Variable(this,
+ Factory::arguments_shadow_symbol(),
+ Variable::INTERNAL,
+ true,
+ Variable::ARGUMENTS);
+ arguments_shadow_->set_is_used(true);
+ temps_.Add(arguments_shadow_);
// Allocate the parameters by rewriting them into '.arguments[i]' accesses.
for (int i = 0; i < params_.length(); i++) {
@@ -839,14 +838,13 @@ void Scope::AllocateParameterLocals() {
// It is ok to set this only now, because arguments is a local
// variable that is allocated after the parameters have been
// allocated.
- arguments_shadow->is_accessed_from_inner_scope_ = true;
+ arguments_shadow_->is_accessed_from_inner_scope_ = true;
}
var->rewrite_ =
- new Property(arguments_shadow_,
- new Literal(Handle<Object>(Smi::FromInt(i))),
- RelocInfo::kNoPosition,
- Property::SYNTHETIC);
- if (var->is_used()) arguments_shadow->set_is_used(true);
+ new Property(new VariableProxy(arguments_shadow_),
+ new Literal(Handle<Object>(Smi::FromInt(i))),
+ RelocInfo::kNoPosition,
+ Property::SYNTHETIC);
}
}
@@ -862,7 +860,8 @@ void Scope::AllocateParameterLocals() {
if (MustAllocate(var)) {
if (MustAllocateInContext(var)) {
ASSERT(var->rewrite_ == NULL ||
- (var->slot() != NULL && var->slot()->type() == Slot::CONTEXT));
+ (var->AsSlot() != NULL &&
+ var->AsSlot()->type() == Slot::CONTEXT));
if (var->rewrite_ == NULL) {
// Only set the heap allocation if the parameter has not
// been allocated yet.
@@ -870,8 +869,8 @@ void Scope::AllocateParameterLocals() {
}
} else {
ASSERT(var->rewrite_ == NULL ||
- (var->slot() != NULL &&
- var->slot()->type() == Slot::PARAMETER));
+ (var->AsSlot() != NULL &&
+ var->AsSlot()->type() == Slot::PARAMETER));
// Set the parameter index always, even if the parameter
// was seen before! (We need to access the actual parameter
// supplied for the last occurrence of a multiply declared
@@ -888,7 +887,7 @@ void Scope::AllocateNonParameterLocal(Variable* var) {
ASSERT(var->scope() == this);
ASSERT(var->rewrite_ == NULL ||
(!var->IsVariable(Factory::result_symbol())) ||
- (var->slot() == NULL || var->slot()->type() != Slot::LOCAL));
+ (var->AsSlot() == NULL || var->AsSlot()->type() != Slot::LOCAL));
if (var->rewrite_ == NULL && MustAllocate(var)) {
if (MustAllocateInContext(var)) {
AllocateHeapSlot(var);
« no previous file with comments | « src/scopes.h ('k') | src/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698