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

Side by Side Diff: src/scopes.cc

Issue 196133017: Experimental parser: merge r19949 (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/scopes.h ('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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 scope_name_ = isolate_->factory()->empty_string(); 183 scope_name_ = isolate_->factory()->empty_string();
184 dynamics_ = NULL; 184 dynamics_ = NULL;
185 receiver_ = NULL; 185 receiver_ = NULL;
186 function_ = NULL; 186 function_ = NULL;
187 arguments_ = NULL; 187 arguments_ = NULL;
188 illegal_redecl_ = NULL; 188 illegal_redecl_ = NULL;
189 scope_inside_with_ = false; 189 scope_inside_with_ = false;
190 scope_contains_with_ = false; 190 scope_contains_with_ = false;
191 scope_calls_eval_ = false; 191 scope_calls_eval_ = false;
192 // Inherit the strict mode from the parent scope. 192 // Inherit the strict mode from the parent scope.
193 language_mode_ = (outer_scope != NULL) 193 strict_mode_ = outer_scope != NULL ? outer_scope->strict_mode_ : SLOPPY;
194 ? outer_scope->language_mode_ : CLASSIC_MODE; 194 outer_scope_calls_sloppy_eval_ = false;
195 outer_scope_calls_non_strict_eval_ = false;
196 inner_scope_calls_eval_ = false; 195 inner_scope_calls_eval_ = false;
197 force_eager_compilation_ = false; 196 force_eager_compilation_ = false;
198 force_context_allocation_ = (outer_scope != NULL && !is_function_scope()) 197 force_context_allocation_ = (outer_scope != NULL && !is_function_scope())
199 ? outer_scope->has_forced_context_allocation() : false; 198 ? outer_scope->has_forced_context_allocation() : false;
200 num_var_or_const_ = 0; 199 num_var_or_const_ = 0;
201 num_stack_slots_ = 0; 200 num_stack_slots_ = 0;
202 num_heap_slots_ = 0; 201 num_heap_slots_ = 0;
203 num_modules_ = 0; 202 num_modules_ = 0;
204 module_var_ = NULL, 203 module_var_ = NULL,
205 scope_info_ = scope_info; 204 scope_info_ = scope_info;
206 start_position_ = RelocInfo::kNoPosition; 205 start_position_ = RelocInfo::kNoPosition;
207 end_position_ = RelocInfo::kNoPosition; 206 end_position_ = RelocInfo::kNoPosition;
208 if (!scope_info.is_null()) { 207 if (!scope_info.is_null()) {
209 scope_calls_eval_ = scope_info->CallsEval(); 208 scope_calls_eval_ = scope_info->CallsEval();
210 language_mode_ = scope_info->language_mode(); 209 strict_mode_ = scope_info->strict_mode();
211 } 210 }
212 } 211 }
213 212
214 213
215 Scope* Scope::DeserializeScopeChain(Context* context, Scope* global_scope, 214 Scope* Scope::DeserializeScopeChain(Context* context, Scope* global_scope,
216 Zone* zone) { 215 Zone* zone) {
217 // Reconstruct the outer scope chain from a closure's context chain. 216 // Reconstruct the outer scope chain from a closure's context chain.
218 Scope* current_scope = NULL; 217 Scope* current_scope = NULL;
219 Scope* innermost_scope = NULL; 218 Scope* innermost_scope = NULL;
220 bool contains_with = false; 219 bool contains_with = false;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 kCreatedInitialized); 462 kCreatedInitialized);
464 params_.Add(var, zone()); 463 params_.Add(var, zone());
465 } 464 }
466 465
467 466
468 Variable* Scope::DeclareLocal(Handle<String> name, 467 Variable* Scope::DeclareLocal(Handle<String> name,
469 VariableMode mode, 468 VariableMode mode,
470 InitializationFlag init_flag, 469 InitializationFlag init_flag,
471 Interface* interface) { 470 Interface* interface) {
472 ASSERT(!already_resolved()); 471 ASSERT(!already_resolved());
473 // This function handles VAR and CONST modes. DYNAMIC variables are 472 // This function handles VAR, LET, and CONST modes. DYNAMIC variables are
474 // introduces during variable allocation, INTERNAL variables are allocated 473 // introduces during variable allocation, INTERNAL variables are allocated
475 // explicitly, and TEMPORARY variables are allocated via NewTemporary(). 474 // explicitly, and TEMPORARY variables are allocated via NewTemporary().
476 ASSERT(IsDeclaredVariableMode(mode)); 475 ASSERT(IsDeclaredVariableMode(mode));
477 ++num_var_or_const_; 476 ++num_var_or_const_;
478 return variables_.Declare( 477 return variables_.Declare(
479 this, name, mode, true, Variable::NORMAL, init_flag, interface); 478 this, name, mode, true, Variable::NORMAL, init_flag, interface);
480 } 479 }
481 480
482 481
483 Variable* Scope::DeclareDynamicGlobal(Handle<String> name) { 482 Variable* Scope::DeclareDynamicGlobal(Handle<String> name) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 } else if (var->IsContextSlot()) { 635 } else if (var->IsContextSlot()) {
637 context_locals->Add(var, zone()); 636 context_locals->Add(var, zone());
638 } 637 }
639 } 638 }
640 } 639 }
641 640
642 641
643 bool Scope::AllocateVariables(CompilationInfo* info, 642 bool Scope::AllocateVariables(CompilationInfo* info,
644 AstNodeFactory<AstNullVisitor>* factory) { 643 AstNodeFactory<AstNullVisitor>* factory) {
645 // 1) Propagate scope information. 644 // 1) Propagate scope information.
646 bool outer_scope_calls_non_strict_eval = false; 645 bool outer_scope_calls_sloppy_eval = false;
647 if (outer_scope_ != NULL) { 646 if (outer_scope_ != NULL) {
648 outer_scope_calls_non_strict_eval = 647 outer_scope_calls_sloppy_eval =
649 outer_scope_->outer_scope_calls_non_strict_eval() | 648 outer_scope_->outer_scope_calls_sloppy_eval() |
650 outer_scope_->calls_non_strict_eval(); 649 outer_scope_->calls_sloppy_eval();
651 } 650 }
652 PropagateScopeInfo(outer_scope_calls_non_strict_eval); 651 PropagateScopeInfo(outer_scope_calls_sloppy_eval);
653 652
654 // 2) Allocate module instances. 653 // 2) Allocate module instances.
655 if (FLAG_harmony_modules && (is_global_scope() || is_module_scope())) { 654 if (FLAG_harmony_modules && (is_global_scope() || is_module_scope())) {
656 ASSERT(num_modules_ == 0); 655 ASSERT(num_modules_ == 0);
657 AllocateModulesRecursively(this); 656 AllocateModulesRecursively(this);
658 } 657 }
659 658
660 // 3) Resolve variables. 659 // 3) Resolve variables.
661 if (!ResolveVariablesRecursively(info, factory)) return false; 660 if (!ResolveVariablesRecursively(info, factory)) return false;
662 661
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 if (function_ != NULL) { 873 if (function_ != NULL) {
875 Indent(n1, "// (local) function name: "); 874 Indent(n1, "// (local) function name: ");
876 PrintName(function_->proxy()->name()); 875 PrintName(function_->proxy()->name());
877 PrintF("\n"); 876 PrintF("\n");
878 } 877 }
879 878
880 // Scope info. 879 // Scope info.
881 if (HasTrivialOuterContext()) { 880 if (HasTrivialOuterContext()) {
882 Indent(n1, "// scope has trivial outer context\n"); 881 Indent(n1, "// scope has trivial outer context\n");
883 } 882 }
884 switch (language_mode()) { 883 if (strict_mode() == STRICT) {
885 case CLASSIC_MODE: 884 Indent(n1, "// strict mode scope\n");
886 break;
887 case STRICT_MODE:
888 Indent(n1, "// strict mode scope\n");
889 break;
890 case EXTENDED_MODE:
891 Indent(n1, "// extended mode scope\n");
892 break;
893 } 885 }
894 if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n"); 886 if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n");
895 if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n"); 887 if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n");
896 if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n"); 888 if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n");
897 if (outer_scope_calls_non_strict_eval_) { 889 if (outer_scope_calls_sloppy_eval_) {
898 Indent(n1, "// outer scope calls 'eval' in non-strict context\n"); 890 Indent(n1, "// outer scope calls 'eval' in sloppy context\n");
899 } 891 }
900 if (inner_scope_calls_eval_) Indent(n1, "// inner scope calls 'eval'\n"); 892 if (inner_scope_calls_eval_) Indent(n1, "// inner scope calls 'eval'\n");
901 if (num_stack_slots_ > 0) { Indent(n1, "// "); 893 if (num_stack_slots_ > 0) { Indent(n1, "// ");
902 PrintF("%d stack slots\n", num_stack_slots_); } 894 PrintF("%d stack slots\n", num_stack_slots_); }
903 if (num_heap_slots_ > 0) { Indent(n1, "// "); 895 if (num_heap_slots_ > 0) { Indent(n1, "// ");
904 PrintF("%d heap slots\n", num_heap_slots_); } 896 PrintF("%d heap slots\n", num_heap_slots_); }
905 897
906 // Print locals. 898 // Print locals.
907 if (function_ != NULL) { 899 if (function_ != NULL) {
908 Indent(n1, "// function var:\n"); 900 Indent(n1, "// function var:\n");
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 if (is_with_scope()) { 1002 if (is_with_scope()) {
1011 ASSERT(!already_resolved()); 1003 ASSERT(!already_resolved());
1012 // The current scope is a with scope, so the variable binding can not be 1004 // The current scope is a with scope, so the variable binding can not be
1013 // statically resolved. However, note that it was necessary to do a lookup 1005 // statically resolved. However, note that it was necessary to do a lookup
1014 // in the outer scope anyway, because if a binding exists in an outer scope, 1006 // in the outer scope anyway, because if a binding exists in an outer scope,
1015 // the associated variable has to be marked as potentially being accessed 1007 // the associated variable has to be marked as potentially being accessed
1016 // from inside of an inner with scope (the property may not be in the 'with' 1008 // from inside of an inner with scope (the property may not be in the 'with'
1017 // object). 1009 // object).
1018 *binding_kind = DYNAMIC_LOOKUP; 1010 *binding_kind = DYNAMIC_LOOKUP;
1019 return NULL; 1011 return NULL;
1020 } else if (calls_non_strict_eval()) { 1012 } else if (calls_sloppy_eval()) {
1021 // A variable binding may have been found in an outer scope, but the current 1013 // A variable binding may have been found in an outer scope, but the current
1022 // scope makes a non-strict 'eval' call, so the found variable may not be 1014 // scope makes a sloppy 'eval' call, so the found variable may not be
1023 // the correct one (the 'eval' may introduce a binding with the same name). 1015 // the correct one (the 'eval' may introduce a binding with the same name).
1024 // In that case, change the lookup result to reflect this situation. 1016 // In that case, change the lookup result to reflect this situation.
1025 if (*binding_kind == BOUND) { 1017 if (*binding_kind == BOUND) {
1026 *binding_kind = BOUND_EVAL_SHADOWED; 1018 *binding_kind = BOUND_EVAL_SHADOWED;
1027 } else if (*binding_kind == UNBOUND) { 1019 } else if (*binding_kind == UNBOUND) {
1028 *binding_kind = UNBOUND_EVAL_SHADOWED; 1020 *binding_kind = UNBOUND_EVAL_SHADOWED;
1029 } 1021 }
1030 } 1022 }
1031 return var; 1023 return var;
1032 } 1024 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 var->set_local_if_not_shadowed(invalidated); 1056 var->set_local_if_not_shadowed(invalidated);
1065 } 1057 }
1066 break; 1058 break;
1067 1059
1068 case UNBOUND: 1060 case UNBOUND:
1069 // No binding has been found. Declare a variable on the global object. 1061 // No binding has been found. Declare a variable on the global object.
1070 var = info->global_scope()->DeclareDynamicGlobal(proxy->name()); 1062 var = info->global_scope()->DeclareDynamicGlobal(proxy->name());
1071 break; 1063 break;
1072 1064
1073 case UNBOUND_EVAL_SHADOWED: 1065 case UNBOUND_EVAL_SHADOWED:
1074 // No binding has been found. But some scope makes a 1066 // No binding has been found. But some scope makes a sloppy 'eval' call.
1075 // non-strict 'eval' call.
1076 var = NonLocal(proxy->name(), DYNAMIC_GLOBAL); 1067 var = NonLocal(proxy->name(), DYNAMIC_GLOBAL);
1077 break; 1068 break;
1078 1069
1079 case DYNAMIC_LOOKUP: 1070 case DYNAMIC_LOOKUP:
1080 // The variable could not be resolved statically. 1071 // The variable could not be resolved statically.
1081 var = NonLocal(proxy->name(), DYNAMIC); 1072 var = NonLocal(proxy->name(), DYNAMIC);
1082 break; 1073 break;
1083 } 1074 }
1084 1075
1085 ASSERT(var != NULL); 1076 ASSERT(var != NULL);
1086 1077
1087 if (FLAG_harmony_scoping && is_extended_mode() && 1078 if (FLAG_harmony_scoping && strict_mode() == STRICT &&
1088 var->is_const_mode() && proxy->IsLValue()) { 1079 var->is_const_mode() && proxy->IsLValue()) {
1089 // Assignment to const. Throw a syntax error. 1080 // Assignment to const. Throw a syntax error.
1090 MessageLocation location( 1081 MessageLocation location(
1091 info->script(), proxy->position(), proxy->position()); 1082 info->script(), proxy->position(), proxy->position());
1092 Isolate* isolate = info->isolate(); 1083 Isolate* isolate = info->isolate();
1093 Factory* factory = isolate->factory(); 1084 Factory* factory = isolate->factory();
1094 Handle<JSArray> array = factory->NewJSArray(0); 1085 Handle<JSArray> array = factory->NewJSArray(0);
1095 Handle<Object> result = 1086 Handle<Object> result =
1096 factory->NewSyntaxError("harmony_const_assign", array); 1087 factory->NewSyntaxError("harmony_const_assign", array);
1097 isolate->Throw(*result, &location); 1088 isolate->Throw(*result, &location);
(...skipping 18 matching lines...) Expand all
1116 } 1107 }
1117 #endif 1108 #endif
1118 1109
1119 // Inconsistent use of module. Throw a syntax error. 1110 // Inconsistent use of module. Throw a syntax error.
1120 // TODO(rossberg): generate more helpful error message. 1111 // TODO(rossberg): generate more helpful error message.
1121 MessageLocation location( 1112 MessageLocation location(
1122 info->script(), proxy->position(), proxy->position()); 1113 info->script(), proxy->position(), proxy->position());
1123 Isolate* isolate = info->isolate(); 1114 Isolate* isolate = info->isolate();
1124 Factory* factory = isolate->factory(); 1115 Factory* factory = isolate->factory();
1125 Handle<JSArray> array = factory->NewJSArray(1); 1116 Handle<JSArray> array = factory->NewJSArray(1);
1126 USE(JSObject::SetElement(array, 0, var->name(), NONE, kStrictMode)); 1117 USE(JSObject::SetElement(array, 0, var->name(), NONE, STRICT));
1127 Handle<Object> result = 1118 Handle<Object> result =
1128 factory->NewSyntaxError("module_type_error", array); 1119 factory->NewSyntaxError("module_type_error", array);
1129 isolate->Throw(*result, &location); 1120 isolate->Throw(*result, &location);
1130 return false; 1121 return false;
1131 } 1122 }
1132 } 1123 }
1133 1124
1134 proxy->BindTo(var); 1125 proxy->BindTo(var);
1135 1126
1136 return true; 1127 return true;
(...skipping 13 matching lines...) Expand all
1150 // Resolve unresolved variables for inner scopes. 1141 // Resolve unresolved variables for inner scopes.
1151 for (int i = 0; i < inner_scopes_.length(); i++) { 1142 for (int i = 0; i < inner_scopes_.length(); i++) {
1152 if (!inner_scopes_[i]->ResolveVariablesRecursively(info, factory)) 1143 if (!inner_scopes_[i]->ResolveVariablesRecursively(info, factory))
1153 return false; 1144 return false;
1154 } 1145 }
1155 1146
1156 return true; 1147 return true;
1157 } 1148 }
1158 1149
1159 1150
1160 bool Scope::PropagateScopeInfo(bool outer_scope_calls_non_strict_eval ) { 1151 bool Scope::PropagateScopeInfo(bool outer_scope_calls_sloppy_eval ) {
1161 if (outer_scope_calls_non_strict_eval) { 1152 if (outer_scope_calls_sloppy_eval) {
1162 outer_scope_calls_non_strict_eval_ = true; 1153 outer_scope_calls_sloppy_eval_ = true;
1163 } 1154 }
1164 1155
1165 bool calls_non_strict_eval = 1156 bool calls_sloppy_eval =
1166 this->calls_non_strict_eval() || outer_scope_calls_non_strict_eval_; 1157 this->calls_sloppy_eval() || outer_scope_calls_sloppy_eval_;
1167 for (int i = 0; i < inner_scopes_.length(); i++) { 1158 for (int i = 0; i < inner_scopes_.length(); i++) {
1168 Scope* inner_scope = inner_scopes_[i]; 1159 Scope* inner_scope = inner_scopes_[i];
1169 if (inner_scope->PropagateScopeInfo(calls_non_strict_eval)) { 1160 if (inner_scope->PropagateScopeInfo(calls_sloppy_eval)) {
1170 inner_scope_calls_eval_ = true; 1161 inner_scope_calls_eval_ = true;
1171 } 1162 }
1172 if (inner_scope->force_eager_compilation_) { 1163 if (inner_scope->force_eager_compilation_) {
1173 force_eager_compilation_ = true; 1164 force_eager_compilation_ = true;
1174 } 1165 }
1175 } 1166 }
1176 1167
1177 return scope_calls_eval_ || inner_scope_calls_eval_; 1168 return scope_calls_eval_ || inner_scope_calls_eval_;
1178 } 1169 }
1179 1170
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 void Scope::AllocateHeapSlot(Variable* var) { 1230 void Scope::AllocateHeapSlot(Variable* var) {
1240 var->AllocateTo(Variable::CONTEXT, num_heap_slots_++); 1231 var->AllocateTo(Variable::CONTEXT, num_heap_slots_++);
1241 } 1232 }
1242 1233
1243 1234
1244 void Scope::AllocateParameterLocals() { 1235 void Scope::AllocateParameterLocals() {
1245 ASSERT(is_function_scope()); 1236 ASSERT(is_function_scope());
1246 Variable* arguments = LocalLookup(isolate_->factory()->arguments_string()); 1237 Variable* arguments = LocalLookup(isolate_->factory()->arguments_string());
1247 ASSERT(arguments != NULL); // functions have 'arguments' declared implicitly 1238 ASSERT(arguments != NULL); // functions have 'arguments' declared implicitly
1248 1239
1249 bool uses_nonstrict_arguments = false; 1240 bool uses_sloppy_arguments = false;
1250 1241
1251 if (MustAllocate(arguments) && !HasArgumentsParameter()) { 1242 if (MustAllocate(arguments) && !HasArgumentsParameter()) {
1252 // 'arguments' is used. Unless there is also a parameter called 1243 // 'arguments' is used. Unless there is also a parameter called
1253 // 'arguments', we must be conservative and allocate all parameters to 1244 // 'arguments', we must be conservative and allocate all parameters to
1254 // the context assuming they will be captured by the arguments object. 1245 // the context assuming they will be captured by the arguments object.
1255 // If we have a parameter named 'arguments', a (new) value is always 1246 // If we have a parameter named 'arguments', a (new) value is always
1256 // assigned to it via the function invocation. Then 'arguments' denotes 1247 // assigned to it via the function invocation. Then 'arguments' denotes
1257 // that specific parameter value and cannot be used to access the 1248 // that specific parameter value and cannot be used to access the
1258 // parameters, which is why we don't need to allocate an arguments 1249 // parameters, which is why we don't need to allocate an arguments
1259 // object in that case. 1250 // object in that case.
1260 1251
1261 // We are using 'arguments'. Tell the code generator that is needs to 1252 // We are using 'arguments'. Tell the code generator that is needs to
1262 // allocate the arguments object by setting 'arguments_'. 1253 // allocate the arguments object by setting 'arguments_'.
1263 arguments_ = arguments; 1254 arguments_ = arguments;
1264 1255
1265 // In strict mode 'arguments' does not alias formal parameters. 1256 // In strict mode 'arguments' does not alias formal parameters.
1266 // Therefore in strict mode we allocate parameters as if 'arguments' 1257 // Therefore in strict mode we allocate parameters as if 'arguments'
1267 // were not used. 1258 // were not used.
1268 uses_nonstrict_arguments = is_classic_mode(); 1259 uses_sloppy_arguments = strict_mode() == SLOPPY;
1269 } 1260 }
1270 1261
1271 // The same parameter may occur multiple times in the parameters_ list. 1262 // The same parameter may occur multiple times in the parameters_ list.
1272 // If it does, and if it is not copied into the context object, it must 1263 // If it does, and if it is not copied into the context object, it must
1273 // receive the highest parameter index for that parameter; thus iteration 1264 // receive the highest parameter index for that parameter; thus iteration
1274 // order is relevant! 1265 // order is relevant!
1275 for (int i = params_.length() - 1; i >= 0; --i) { 1266 for (int i = params_.length() - 1; i >= 0; --i) {
1276 Variable* var = params_[i]; 1267 Variable* var = params_[i];
1277 ASSERT(var->scope() == this); 1268 ASSERT(var->scope() == this);
1278 if (uses_nonstrict_arguments) { 1269 if (uses_sloppy_arguments) {
1279 // Force context allocation of the parameter. 1270 // Force context allocation of the parameter.
1280 var->ForceContextAllocation(); 1271 var->ForceContextAllocation();
1281 } 1272 }
1282 1273
1283 if (MustAllocate(var)) { 1274 if (MustAllocate(var)) {
1284 if (MustAllocateInContext(var)) { 1275 if (MustAllocateInContext(var)) {
1285 ASSERT(var->IsUnallocated() || var->IsContextSlot()); 1276 ASSERT(var->IsUnallocated() || var->IsContextSlot());
1286 if (var->IsUnallocated()) { 1277 if (var->IsUnallocated()) {
1287 AllocateHeapSlot(var); 1278 AllocateHeapSlot(var);
1288 } 1279 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 } 1395 }
1405 1396
1406 1397
1407 int Scope::ContextLocalCount() const { 1398 int Scope::ContextLocalCount() const {
1408 if (num_heap_slots() == 0) return 0; 1399 if (num_heap_slots() == 0) return 0;
1409 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1400 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1410 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); 1401 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0);
1411 } 1402 }
1412 1403
1413 } } // namespace v8::internal 1404 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/scopes.h ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698