| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "scopes.h" | 30 #include "scopes.h" |
| 31 | 31 |
| 32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
| 33 #include "compiler.h" | 33 #include "compiler.h" |
| 34 #include "prettyprinter.h" | 34 #include "prettyprinter.h" |
| 35 #include "scopeinfo.h" | 35 #include "scopeinfo.h" |
| 36 | 36 |
| 37 #include "allocation-inl.h" |
| 38 |
| 37 namespace v8 { | 39 namespace v8 { |
| 38 namespace internal { | 40 namespace internal { |
| 39 | 41 |
| 40 // ---------------------------------------------------------------------------- | 42 // ---------------------------------------------------------------------------- |
| 41 // A Zone allocator for use with LocalsMap. | 43 // A Zone allocator for use with LocalsMap. |
| 42 | 44 |
| 43 // TODO(isolates): It is probably worth it to change the Allocator class to | 45 // TODO(isolates): It is probably worth it to change the Allocator class to |
| 44 // take a pointer to an isolate. | 46 // take a pointer to an isolate. |
| 45 class ZoneAllocator: public Allocator { | 47 class ZoneAllocator: public Allocator { |
| 46 public: | 48 public: |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 return NULL; | 109 return NULL; |
| 108 } | 110 } |
| 109 | 111 |
| 110 | 112 |
| 111 // ---------------------------------------------------------------------------- | 113 // ---------------------------------------------------------------------------- |
| 112 // Implementation of Scope | 114 // Implementation of Scope |
| 113 | 115 |
| 114 | 116 |
| 115 // Dummy constructor | 117 // Dummy constructor |
| 116 Scope::Scope(Type type) | 118 Scope::Scope(Type type) |
| 117 : inner_scopes_(0), | 119 : isolate_(Isolate::Current()), |
| 118 variables_(false), | 120 inner_scopes_(0), |
| 119 temps_(0), | 121 variables_(false), |
| 120 params_(0), | 122 temps_(0), |
| 121 unresolved_(0), | 123 params_(0), |
| 122 decls_(0), | 124 unresolved_(0), |
| 123 already_resolved_(false) { | 125 decls_(0), |
| 126 already_resolved_(false) { |
| 124 SetDefaults(type, NULL, Handle<SerializedScopeInfo>::null()); | 127 SetDefaults(type, NULL, Handle<SerializedScopeInfo>::null()); |
| 125 } | 128 } |
| 126 | 129 |
| 127 | 130 |
| 128 Scope::Scope(Scope* outer_scope, Type type) | 131 Scope::Scope(Scope* outer_scope, Type type) |
| 129 : inner_scopes_(4), | 132 : isolate_(Isolate::Current()), |
| 130 variables_(), | 133 inner_scopes_(4), |
| 131 temps_(4), | 134 variables_(), |
| 132 params_(4), | 135 temps_(4), |
| 133 unresolved_(16), | 136 params_(4), |
| 134 decls_(4), | 137 unresolved_(16), |
| 135 already_resolved_(false) { | 138 decls_(4), |
| 139 already_resolved_(false) { |
| 136 SetDefaults(type, outer_scope, Handle<SerializedScopeInfo>::null()); | 140 SetDefaults(type, outer_scope, Handle<SerializedScopeInfo>::null()); |
| 137 // At some point we might want to provide outer scopes to | 141 // At some point we might want to provide outer scopes to |
| 138 // eval scopes (by walking the stack and reading the scope info). | 142 // eval scopes (by walking the stack and reading the scope info). |
| 139 // In that case, the ASSERT below needs to be adjusted. | 143 // In that case, the ASSERT below needs to be adjusted. |
| 140 ASSERT((type == GLOBAL_SCOPE || type == EVAL_SCOPE) == (outer_scope == NULL)); | 144 ASSERT((type == GLOBAL_SCOPE || type == EVAL_SCOPE) == (outer_scope == NULL)); |
| 141 ASSERT(!HasIllegalRedeclaration()); | 145 ASSERT(!HasIllegalRedeclaration()); |
| 142 } | 146 } |
| 143 | 147 |
| 144 | 148 |
| 145 Scope::Scope(Scope* inner_scope, Handle<SerializedScopeInfo> scope_info) | 149 Scope::Scope(Scope* inner_scope, Handle<SerializedScopeInfo> scope_info) |
| 146 : inner_scopes_(4), | 150 : isolate_(Isolate::Current()), |
| 147 variables_(), | 151 inner_scopes_(4), |
| 148 temps_(4), | 152 variables_(), |
| 149 params_(4), | 153 temps_(4), |
| 150 unresolved_(16), | 154 params_(4), |
| 151 decls_(4), | 155 unresolved_(16), |
| 152 already_resolved_(true) { | 156 decls_(4), |
| 157 already_resolved_(true) { |
| 153 ASSERT(!scope_info.is_null()); | 158 ASSERT(!scope_info.is_null()); |
| 154 SetDefaults(FUNCTION_SCOPE, NULL, scope_info); | 159 SetDefaults(FUNCTION_SCOPE, NULL, scope_info); |
| 155 if (scope_info->HasHeapAllocatedLocals()) { | 160 if (scope_info->HasHeapAllocatedLocals()) { |
| 156 num_heap_slots_ = scope_info_->NumberOfContextSlots(); | 161 num_heap_slots_ = scope_info_->NumberOfContextSlots(); |
| 157 } | 162 } |
| 158 AddInnerScope(inner_scope); | 163 AddInnerScope(inner_scope); |
| 159 } | 164 } |
| 160 | 165 |
| 161 | 166 |
| 162 Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name) | 167 Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name) |
| 163 : inner_scopes_(1), | 168 : isolate_(Isolate::Current()), |
| 169 inner_scopes_(1), |
| 164 variables_(), | 170 variables_(), |
| 165 temps_(0), | 171 temps_(0), |
| 166 params_(0), | 172 params_(0), |
| 167 unresolved_(0), | 173 unresolved_(0), |
| 168 decls_(0), | 174 decls_(0), |
| 169 already_resolved_(true) { | 175 already_resolved_(true) { |
| 170 SetDefaults(CATCH_SCOPE, NULL, Handle<SerializedScopeInfo>::null()); | 176 SetDefaults(CATCH_SCOPE, NULL, Handle<SerializedScopeInfo>::null()); |
| 171 AddInnerScope(inner_scope); | 177 AddInnerScope(inner_scope); |
| 172 ++num_var_or_const_; | 178 ++num_var_or_const_; |
| 173 Variable* variable = variables_.Declare(this, | 179 Variable* variable = variables_.Declare(this, |
| 174 catch_variable_name, | 180 catch_variable_name, |
| 175 Variable::VAR, | 181 Variable::VAR, |
| 176 true, // Valid left-hand side. | 182 true, // Valid left-hand side. |
| 177 Variable::NORMAL); | 183 Variable::NORMAL); |
| 178 AllocateHeapSlot(variable); | 184 AllocateHeapSlot(variable); |
| 179 } | 185 } |
| 180 | 186 |
| 181 | 187 |
| 182 void Scope::SetDefaults(Type type, | 188 void Scope::SetDefaults(Type type, |
| 183 Scope* outer_scope, | 189 Scope* outer_scope, |
| 184 Handle<SerializedScopeInfo> scope_info) { | 190 Handle<SerializedScopeInfo> scope_info) { |
| 185 outer_scope_ = outer_scope; | 191 outer_scope_ = outer_scope; |
| 186 type_ = type; | 192 type_ = type; |
| 187 scope_name_ = FACTORY->empty_symbol(); | 193 scope_name_ = isolate_->factory()->empty_symbol(); |
| 188 dynamics_ = NULL; | 194 dynamics_ = NULL; |
| 189 receiver_ = NULL; | 195 receiver_ = NULL; |
| 190 function_ = NULL; | 196 function_ = NULL; |
| 191 arguments_ = NULL; | 197 arguments_ = NULL; |
| 192 illegal_redecl_ = NULL; | 198 illegal_redecl_ = NULL; |
| 193 scope_inside_with_ = false; | 199 scope_inside_with_ = false; |
| 194 scope_contains_with_ = false; | 200 scope_contains_with_ = false; |
| 195 scope_calls_eval_ = false; | 201 scope_calls_eval_ = false; |
| 196 // Inherit the strict mode from the parent scope. | 202 // Inherit the strict mode from the parent scope. |
| 197 strict_mode_ = (outer_scope != NULL) && outer_scope->strict_mode_; | 203 strict_mode_ = (outer_scope != NULL) && outer_scope->strict_mode_; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // NOTE: When loading parameters in the global scope, we must take | 292 // NOTE: When loading parameters in the global scope, we must take |
| 287 // care not to access them as properties of the global object, but | 293 // care not to access them as properties of the global object, but |
| 288 // instead load them directly from the stack. Currently, the only | 294 // instead load them directly from the stack. Currently, the only |
| 289 // such parameter is 'this' which is passed on the stack when | 295 // such parameter is 'this' which is passed on the stack when |
| 290 // invoking scripts | 296 // invoking scripts |
| 291 if (is_catch_scope()) { | 297 if (is_catch_scope()) { |
| 292 ASSERT(outer_scope() != NULL); | 298 ASSERT(outer_scope() != NULL); |
| 293 receiver_ = outer_scope()->receiver(); | 299 receiver_ = outer_scope()->receiver(); |
| 294 } else { | 300 } else { |
| 295 Variable* var = | 301 Variable* var = |
| 296 variables_.Declare(this, FACTORY->this_symbol(), Variable::VAR, | 302 variables_.Declare(this, |
| 297 false, Variable::THIS); | 303 isolate_->factory()->this_symbol(), |
| 298 var->set_rewrite(new Slot(var, Slot::PARAMETER, -1)); | 304 Variable::VAR, |
| 305 false, |
| 306 Variable::THIS); |
| 307 var->set_rewrite(NewSlot(var, Slot::PARAMETER, -1)); |
| 299 receiver_ = var; | 308 receiver_ = var; |
| 300 } | 309 } |
| 301 | 310 |
| 302 if (is_function_scope()) { | 311 if (is_function_scope()) { |
| 303 // Declare 'arguments' variable which exists in all functions. | 312 // Declare 'arguments' variable which exists in all functions. |
| 304 // Note that it might never be accessed, in which case it won't be | 313 // Note that it might never be accessed, in which case it won't be |
| 305 // allocated during variable allocation. | 314 // allocated during variable allocation. |
| 306 variables_.Declare(this, FACTORY->arguments_symbol(), Variable::VAR, | 315 variables_.Declare(this, |
| 307 true, Variable::ARGUMENTS); | 316 isolate_->factory()->arguments_symbol(), |
| 317 Variable::VAR, |
| 318 true, |
| 319 Variable::ARGUMENTS); |
| 308 } | 320 } |
| 309 } | 321 } |
| 310 | 322 |
| 311 | 323 |
| 312 Variable* Scope::LocalLookup(Handle<String> name) { | 324 Variable* Scope::LocalLookup(Handle<String> name) { |
| 313 Variable* result = variables_.Lookup(name); | 325 Variable* result = variables_.Lookup(name); |
| 314 if (result != NULL || scope_info_.is_null()) { | 326 if (result != NULL || scope_info_.is_null()) { |
| 315 return result; | 327 return result; |
| 316 } | 328 } |
| 317 // If we have a serialized scope info, we might find the variable there. | 329 // If we have a serialized scope info, we might find the variable there. |
| 318 // | 330 // |
| 319 // We should never lookup 'arguments' in this scope as it is implicitly | 331 // We should never lookup 'arguments' in this scope as it is implicitly |
| 320 // present in every scope. | 332 // present in every scope. |
| 321 ASSERT(*name != *FACTORY->arguments_symbol()); | 333 ASSERT(*name != *isolate_->factory()->arguments_symbol()); |
| 322 // There should be no local slot with the given name. | 334 // There should be no local slot with the given name. |
| 323 ASSERT(scope_info_->StackSlotIndex(*name) < 0); | 335 ASSERT(scope_info_->StackSlotIndex(*name) < 0); |
| 324 | 336 |
| 325 // Check context slot lookup. | 337 // Check context slot lookup. |
| 326 Variable::Mode mode; | 338 Variable::Mode mode; |
| 327 int index = scope_info_->ContextSlotIndex(*name, &mode); | 339 int index = scope_info_->ContextSlotIndex(*name, &mode); |
| 328 if (index < 0) { | 340 if (index < 0) { |
| 329 // Check parameters. | 341 // Check parameters. |
| 330 mode = Variable::VAR; | 342 mode = Variable::VAR; |
| 331 index = scope_info_->ParameterIndex(*name); | 343 index = scope_info_->ParameterIndex(*name); |
| 332 if (index < 0) { | 344 if (index < 0) { |
| 333 // Check the function name. | 345 // Check the function name. |
| 334 index = scope_info_->FunctionContextSlotIndex(*name); | 346 index = scope_info_->FunctionContextSlotIndex(*name); |
| 335 if (index < 0) return NULL; | 347 if (index < 0) return NULL; |
| 336 } | 348 } |
| 337 } | 349 } |
| 338 | 350 |
| 339 Variable* var = | 351 Variable* var = |
| 340 variables_.Declare(this, name, mode, true, Variable::NORMAL); | 352 variables_.Declare(this, name, mode, true, Variable::NORMAL); |
| 341 var->set_rewrite(new Slot(var, Slot::CONTEXT, index)); | 353 var->set_rewrite(NewSlot(var, Slot::CONTEXT, index)); |
| 342 return var; | 354 return var; |
| 343 } | 355 } |
| 344 | 356 |
| 345 | 357 |
| 346 Variable* Scope::Lookup(Handle<String> name) { | 358 Variable* Scope::Lookup(Handle<String> name) { |
| 347 for (Scope* scope = this; | 359 for (Scope* scope = this; |
| 348 scope != NULL; | 360 scope != NULL; |
| 349 scope = scope->outer_scope()) { | 361 scope = scope->outer_scope()) { |
| 350 Variable* var = scope->LocalLookup(name); | 362 Variable* var = scope->LocalLookup(name); |
| 351 if (var != NULL) return var; | 363 if (var != NULL) return var; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 400 } |
| 389 | 401 |
| 390 | 402 |
| 391 VariableProxy* Scope::NewUnresolved(Handle<String> name, | 403 VariableProxy* Scope::NewUnresolved(Handle<String> name, |
| 392 bool inside_with, | 404 bool inside_with, |
| 393 int position) { | 405 int position) { |
| 394 // Note that we must not share the unresolved variables with | 406 // Note that we must not share the unresolved variables with |
| 395 // the same name because they may be removed selectively via | 407 // the same name because they may be removed selectively via |
| 396 // RemoveUnresolved(). | 408 // RemoveUnresolved(). |
| 397 ASSERT(!already_resolved()); | 409 ASSERT(!already_resolved()); |
| 398 VariableProxy* proxy = new VariableProxy(name, false, inside_with, position); | 410 VariableProxy* proxy = new(isolate_->zone()) VariableProxy( |
| 411 isolate_, name, false, inside_with, position); |
| 399 unresolved_.Add(proxy); | 412 unresolved_.Add(proxy); |
| 400 return proxy; | 413 return proxy; |
| 401 } | 414 } |
| 402 | 415 |
| 403 | 416 |
| 404 void Scope::RemoveUnresolved(VariableProxy* var) { | 417 void Scope::RemoveUnresolved(VariableProxy* var) { |
| 405 // Most likely (always?) any variable we want to remove | 418 // Most likely (always?) any variable we want to remove |
| 406 // was just added before, so we search backwards. | 419 // was just added before, so we search backwards. |
| 407 for (int i = unresolved_.length(); i-- > 0;) { | 420 for (int i = unresolved_.length(); i-- > 0;) { |
| 408 if (unresolved_[i] == var) { | 421 if (unresolved_[i] == var) { |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 | 701 |
| 689 | 702 |
| 690 Variable* Scope::NonLocal(Handle<String> name, Variable::Mode mode) { | 703 Variable* Scope::NonLocal(Handle<String> name, Variable::Mode mode) { |
| 691 if (dynamics_ == NULL) dynamics_ = new DynamicScopePart(); | 704 if (dynamics_ == NULL) dynamics_ = new DynamicScopePart(); |
| 692 VariableMap* map = dynamics_->GetMap(mode); | 705 VariableMap* map = dynamics_->GetMap(mode); |
| 693 Variable* var = map->Lookup(name); | 706 Variable* var = map->Lookup(name); |
| 694 if (var == NULL) { | 707 if (var == NULL) { |
| 695 // Declare a new non-local. | 708 // Declare a new non-local. |
| 696 var = map->Declare(NULL, name, mode, true, Variable::NORMAL); | 709 var = map->Declare(NULL, name, mode, true, Variable::NORMAL); |
| 697 // Allocate it by giving it a dynamic lookup. | 710 // Allocate it by giving it a dynamic lookup. |
| 698 var->set_rewrite(new Slot(var, Slot::LOOKUP, -1)); | 711 var->set_rewrite(NewSlot(var, Slot::LOOKUP, -1)); |
| 699 } | 712 } |
| 700 return var; | 713 return var; |
| 701 } | 714 } |
| 702 | 715 |
| 703 | 716 |
| 704 // Lookup a variable starting with this scope. The result is either | 717 // Lookup a variable starting with this scope. The result is either |
| 705 // the statically resolved variable belonging to an outer scope, or | 718 // the statically resolved variable belonging to an outer scope, or |
| 706 // NULL. It may be NULL because a) we couldn't find a variable, or b) | 719 // NULL. It may be NULL because a) we couldn't find a variable, or b) |
| 707 // because the variable is just a guess (and may be shadowed by | 720 // because the variable is just a guess (and may be shadowed by |
| 708 // another variable that is introduced dynamically via an 'eval' call | 721 // another variable that is introduced dynamically via an 'eval' call |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 return var->is_accessed_from_inner_scope() || | 947 return var->is_accessed_from_inner_scope() || |
| 935 scope_calls_eval_ || | 948 scope_calls_eval_ || |
| 936 inner_scope_calls_eval_ || | 949 inner_scope_calls_eval_ || |
| 937 scope_contains_with_ || | 950 scope_contains_with_ || |
| 938 var->is_global(); | 951 var->is_global(); |
| 939 } | 952 } |
| 940 | 953 |
| 941 | 954 |
| 942 bool Scope::HasArgumentsParameter() { | 955 bool Scope::HasArgumentsParameter() { |
| 943 for (int i = 0; i < params_.length(); i++) { | 956 for (int i = 0; i < params_.length(); i++) { |
| 944 if (params_[i]->name().is_identical_to(FACTORY->arguments_symbol())) | 957 if (params_[i]->name().is_identical_to( |
| 958 isolate_->factory()->arguments_symbol())) { |
| 945 return true; | 959 return true; |
| 960 } |
| 946 } | 961 } |
| 947 return false; | 962 return false; |
| 948 } | 963 } |
| 949 | 964 |
| 950 | 965 |
| 951 void Scope::AllocateStackSlot(Variable* var) { | 966 void Scope::AllocateStackSlot(Variable* var) { |
| 952 var->set_rewrite(new Slot(var, Slot::LOCAL, num_stack_slots_++)); | 967 var->set_rewrite(NewSlot(var, Slot::LOCAL, num_stack_slots_++)); |
| 953 } | 968 } |
| 954 | 969 |
| 955 | 970 |
| 956 void Scope::AllocateHeapSlot(Variable* var) { | 971 void Scope::AllocateHeapSlot(Variable* var) { |
| 957 var->set_rewrite(new Slot(var, Slot::CONTEXT, num_heap_slots_++)); | 972 var->set_rewrite(NewSlot(var, Slot::CONTEXT, num_heap_slots_++)); |
| 958 } | 973 } |
| 959 | 974 |
| 960 | 975 |
| 961 void Scope::AllocateParameterLocals() { | 976 void Scope::AllocateParameterLocals() { |
| 962 ASSERT(is_function_scope()); | 977 ASSERT(is_function_scope()); |
| 963 Variable* arguments = LocalLookup(FACTORY->arguments_symbol()); | 978 Variable* arguments = LocalLookup(isolate_->factory()->arguments_symbol()); |
| 964 ASSERT(arguments != NULL); // functions have 'arguments' declared implicitly | 979 ASSERT(arguments != NULL); // functions have 'arguments' declared implicitly |
| 965 | 980 |
| 966 bool uses_nonstrict_arguments = false; | 981 bool uses_nonstrict_arguments = false; |
| 967 | 982 |
| 968 if (MustAllocate(arguments) && !HasArgumentsParameter()) { | 983 if (MustAllocate(arguments) && !HasArgumentsParameter()) { |
| 969 // 'arguments' is used. Unless there is also a parameter called | 984 // 'arguments' is used. Unless there is also a parameter called |
| 970 // 'arguments', we must be conservative and allocate all parameters to | 985 // 'arguments', we must be conservative and allocate all parameters to |
| 971 // the context assuming they will be captured by the arguments object. | 986 // the context assuming they will be captured by the arguments object. |
| 972 // If we have a parameter named 'arguments', a (new) value is always | 987 // If we have a parameter named 'arguments', a (new) value is always |
| 973 // assigned to it via the function invocation. Then 'arguments' denotes | 988 // assigned to it via the function invocation. Then 'arguments' denotes |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1000 | 1015 |
| 1001 if (MustAllocate(var)) { | 1016 if (MustAllocate(var)) { |
| 1002 if (MustAllocateInContext(var)) { | 1017 if (MustAllocateInContext(var)) { |
| 1003 ASSERT(var->rewrite() == NULL || var->IsContextSlot()); | 1018 ASSERT(var->rewrite() == NULL || var->IsContextSlot()); |
| 1004 if (var->rewrite() == NULL) { | 1019 if (var->rewrite() == NULL) { |
| 1005 AllocateHeapSlot(var); | 1020 AllocateHeapSlot(var); |
| 1006 } | 1021 } |
| 1007 } else { | 1022 } else { |
| 1008 ASSERT(var->rewrite() == NULL || var->IsParameter()); | 1023 ASSERT(var->rewrite() == NULL || var->IsParameter()); |
| 1009 if (var->rewrite() == NULL) { | 1024 if (var->rewrite() == NULL) { |
| 1010 var->set_rewrite(new Slot(var, Slot::PARAMETER, i)); | 1025 var->set_rewrite(NewSlot(var, Slot::PARAMETER, i)); |
| 1011 } | 1026 } |
| 1012 } | 1027 } |
| 1013 } | 1028 } |
| 1014 } | 1029 } |
| 1015 } | 1030 } |
| 1016 | 1031 |
| 1017 | 1032 |
| 1018 void Scope::AllocateNonParameterLocal(Variable* var) { | 1033 void Scope::AllocateNonParameterLocal(Variable* var) { |
| 1019 ASSERT(var->scope() == this); | 1034 ASSERT(var->scope() == this); |
| 1020 ASSERT(var->rewrite() == NULL || | 1035 ASSERT(var->rewrite() == NULL || |
| 1021 !var->IsVariable(FACTORY->result_symbol()) || | 1036 !var->IsVariable(isolate_->factory()->result_symbol()) || |
| 1022 var->AsSlot() == NULL || | 1037 var->AsSlot() == NULL || |
| 1023 var->AsSlot()->type() != Slot::LOCAL); | 1038 var->AsSlot()->type() != Slot::LOCAL); |
| 1024 if (var->rewrite() == NULL && MustAllocate(var)) { | 1039 if (var->rewrite() == NULL && MustAllocate(var)) { |
| 1025 if (MustAllocateInContext(var)) { | 1040 if (MustAllocateInContext(var)) { |
| 1026 AllocateHeapSlot(var); | 1041 AllocateHeapSlot(var); |
| 1027 } else { | 1042 } else { |
| 1028 AllocateStackSlot(var); | 1043 AllocateStackSlot(var); |
| 1029 } | 1044 } |
| 1030 } | 1045 } |
| 1031 } | 1046 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && | 1103 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && |
| 1089 !must_have_local_context) { | 1104 !must_have_local_context) { |
| 1090 num_heap_slots_ = 0; | 1105 num_heap_slots_ = 0; |
| 1091 } | 1106 } |
| 1092 | 1107 |
| 1093 // Allocation done. | 1108 // Allocation done. |
| 1094 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); | 1109 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); |
| 1095 } | 1110 } |
| 1096 | 1111 |
| 1097 } } // namespace v8::internal | 1112 } } // namespace v8::internal |
| OLD | NEW |