| Index: src/scopes.cc
|
| ===================================================================
|
| --- src/scopes.cc (revision 7267)
|
| +++ src/scopes.cc (working copy)
|
| @@ -40,12 +40,14 @@
|
| // ----------------------------------------------------------------------------
|
| // A Zone allocator for use with LocalsMap.
|
|
|
| +// TODO(isolates): It is probably worth it to change the Allocator class to
|
| +// take a pointer to an isolate.
|
| class ZoneAllocator: public Allocator {
|
| public:
|
| /* nothing to do */
|
| virtual ~ZoneAllocator() {}
|
|
|
| - virtual void* New(size_t size) { return Zone::New(static_cast<int>(size)); }
|
| + virtual void* New(size_t size) { return ZONE->New(static_cast<int>(size)); }
|
|
|
| /* ignored - Zone is freed in one fell swoop */
|
| virtual void Delete(void* p) {}
|
| @@ -159,16 +161,19 @@
|
| // This scope's arguments shadow (if present) is context-allocated if an inner
|
| // scope accesses this one's parameters. Allocate the arguments_shadow_
|
| // variable if necessary.
|
| + Isolate* isolate = Isolate::Current();
|
| Variable::Mode mode;
|
| int arguments_shadow_index =
|
| - scope_info_->ContextSlotIndex(Heap::arguments_shadow_symbol(), &mode);
|
| + scope_info_->ContextSlotIndex(
|
| + isolate->heap()->arguments_shadow_symbol(), &mode);
|
| if (arguments_shadow_index >= 0) {
|
| ASSERT(mode == Variable::INTERNAL);
|
| - arguments_shadow_ = new Variable(this,
|
| - Factory::arguments_shadow_symbol(),
|
| - Variable::INTERNAL,
|
| - true,
|
| - Variable::ARGUMENTS);
|
| + arguments_shadow_ = new Variable(
|
| + this,
|
| + isolate->factory()->arguments_shadow_symbol(),
|
| + Variable::INTERNAL,
|
| + true,
|
| + Variable::ARGUMENTS);
|
| arguments_shadow_->set_rewrite(
|
| new Slot(arguments_shadow_, Slot::CONTEXT, arguments_shadow_index));
|
| arguments_shadow_->set_is_used(true);
|
| @@ -213,7 +218,7 @@
|
| top->AllocateVariables(info->calling_context());
|
|
|
| #ifdef DEBUG
|
| - if (Bootstrapper::IsActive()
|
| + if (info->isolate()->bootstrapper()->IsActive()
|
| ? FLAG_print_builtin_scopes
|
| : FLAG_print_scopes) {
|
| info->function()->scope()->Print();
|
| @@ -245,7 +250,7 @@
|
| // such parameter is 'this' which is passed on the stack when
|
| // invoking scripts
|
| Variable* var =
|
| - variables_.Declare(this, Factory::this_symbol(), Variable::VAR,
|
| + variables_.Declare(this, FACTORY->this_symbol(), Variable::VAR,
|
| false, Variable::THIS);
|
| var->set_rewrite(new Slot(var, Slot::PARAMETER, -1));
|
| receiver_ = var;
|
| @@ -254,7 +259,7 @@
|
| // Declare 'arguments' variable which exists in all functions.
|
| // Note that it might never be accessed, in which case it won't be
|
| // allocated during variable allocation.
|
| - variables_.Declare(this, Factory::arguments_symbol(), Variable::VAR,
|
| + variables_.Declare(this, FACTORY->arguments_symbol(), Variable::VAR,
|
| true, Variable::ARGUMENTS);
|
| }
|
| }
|
| @@ -269,7 +274,7 @@
|
|
|
| // We should never lookup 'arguments' in this scope
|
| // as it is implicitly present in any scope.
|
| - ASSERT(*name != *Factory::arguments_symbol());
|
| + ASSERT(*name != *FACTORY->arguments_symbol());
|
|
|
| // Assert that there is no local slot with the given name.
|
| ASSERT(scope_info_->StackSlotIndex(*name) < 0);
|
| @@ -868,7 +873,7 @@
|
|
|
| bool Scope::HasArgumentsParameter() {
|
| for (int i = 0; i < params_.length(); i++) {
|
| - if (params_[i]->name().is_identical_to(Factory::arguments_symbol()))
|
| + if (params_[i]->name().is_identical_to(FACTORY->arguments_symbol()))
|
| return true;
|
| }
|
| return false;
|
| @@ -887,7 +892,7 @@
|
|
|
| void Scope::AllocateParameterLocals() {
|
| ASSERT(is_function_scope());
|
| - Variable* arguments = LocalLookup(Factory::arguments_symbol());
|
| + Variable* arguments = LocalLookup(FACTORY->arguments_symbol());
|
| ASSERT(arguments != NULL); // functions have 'arguments' declared implicitly
|
|
|
| // Parameters are rewritten to arguments[i] if 'arguments' is used in
|
| @@ -942,7 +947,7 @@
|
| // variable may be allocated in the heap-allocated context (temporaries
|
| // are never allocated in the context).
|
| arguments_shadow_ = new Variable(this,
|
| - Factory::arguments_shadow_symbol(),
|
| + FACTORY->arguments_shadow_symbol(),
|
| Variable::INTERNAL,
|
| true,
|
| Variable::ARGUMENTS);
|
| @@ -1008,7 +1013,7 @@
|
| void Scope::AllocateNonParameterLocal(Variable* var) {
|
| ASSERT(var->scope() == this);
|
| ASSERT(var->rewrite() == NULL ||
|
| - (!var->IsVariable(Factory::result_symbol())) ||
|
| + (!var->IsVariable(FACTORY->result_symbol())) ||
|
| (var->AsSlot() == NULL || var->AsSlot()->type() != Slot::LOCAL));
|
| if (var->rewrite() == NULL && MustAllocate(var)) {
|
| if (MustAllocateInContext(var)) {
|
|
|