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

Side by Side Diff: src/scopes.cc

Issue 7778013: NewGC: Merge bleeding edge up to 9009. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 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
« 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 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 already_resolved_(false) { 139 already_resolved_(false) {
140 SetDefaults(type, outer_scope, Handle<SerializedScopeInfo>::null()); 140 SetDefaults(type, outer_scope, Handle<SerializedScopeInfo>::null());
141 // At some point we might want to provide outer scopes to 141 // At some point we might want to provide outer scopes to
142 // eval scopes (by walking the stack and reading the scope info). 142 // eval scopes (by walking the stack and reading the scope info).
143 // In that case, the ASSERT below needs to be adjusted. 143 // In that case, the ASSERT below needs to be adjusted.
144 ASSERT((type == GLOBAL_SCOPE || type == EVAL_SCOPE) == (outer_scope == NULL)); 144 ASSERT((type == GLOBAL_SCOPE || type == EVAL_SCOPE) == (outer_scope == NULL));
145 ASSERT(!HasIllegalRedeclaration()); 145 ASSERT(!HasIllegalRedeclaration());
146 } 146 }
147 147
148 148
149 Scope::Scope(Scope* inner_scope, Handle<SerializedScopeInfo> scope_info) 149 Scope::Scope(Scope* inner_scope,
150 Type type,
151 Handle<SerializedScopeInfo> scope_info)
150 : isolate_(Isolate::Current()), 152 : isolate_(Isolate::Current()),
151 inner_scopes_(4), 153 inner_scopes_(4),
152 variables_(), 154 variables_(),
153 temps_(4), 155 temps_(4),
154 params_(4), 156 params_(4),
155 unresolved_(16), 157 unresolved_(16),
156 decls_(4), 158 decls_(4),
157 already_resolved_(true) { 159 already_resolved_(true) {
158 ASSERT(!scope_info.is_null()); 160 ASSERT(!scope_info.is_null());
159 SetDefaults(FUNCTION_SCOPE, NULL, scope_info); 161 SetDefaults(type, NULL, scope_info);
160 if (scope_info->HasHeapAllocatedLocals()) { 162 if (scope_info->HasHeapAllocatedLocals()) {
161 num_heap_slots_ = scope_info_->NumberOfContextSlots(); 163 num_heap_slots_ = scope_info_->NumberOfContextSlots();
162 } 164 }
163 AddInnerScope(inner_scope); 165 AddInnerScope(inner_scope);
164 } 166 }
165 167
166 168
167 Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name) 169 Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name)
168 : isolate_(Isolate::Current()), 170 : isolate_(Isolate::Current()),
169 inner_scopes_(1), 171 inner_scopes_(1),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (context->IsWithContext()) { 227 if (context->IsWithContext()) {
226 // All the inner scopes are inside a with. 228 // All the inner scopes are inside a with.
227 contains_with = true; 229 contains_with = true;
228 for (Scope* s = innermost_scope; s != NULL; s = s->outer_scope()) { 230 for (Scope* s = innermost_scope; s != NULL; s = s->outer_scope()) {
229 s->scope_inside_with_ = true; 231 s->scope_inside_with_ = true;
230 } 232 }
231 } else { 233 } else {
232 if (context->IsFunctionContext()) { 234 if (context->IsFunctionContext()) {
233 SerializedScopeInfo* scope_info = 235 SerializedScopeInfo* scope_info =
234 context->closure()->shared()->scope_info(); 236 context->closure()->shared()->scope_info();
235 current_scope = 237 current_scope = new Scope(current_scope, FUNCTION_SCOPE,
236 new Scope(current_scope, Handle<SerializedScopeInfo>(scope_info)); 238 Handle<SerializedScopeInfo>(scope_info));
239 } else if (context->IsBlockContext()) {
240 SerializedScopeInfo* scope_info =
241 SerializedScopeInfo::cast(context->extension());
242 current_scope = new Scope(current_scope, BLOCK_SCOPE,
243 Handle<SerializedScopeInfo>(scope_info));
237 } else { 244 } else {
238 ASSERT(context->IsCatchContext()); 245 ASSERT(context->IsCatchContext());
239 String* name = String::cast(context->extension()); 246 String* name = String::cast(context->extension());
240 current_scope = new Scope(current_scope, Handle<String>(name)); 247 current_scope = new Scope(current_scope, Handle<String>(name));
241 } 248 }
242 if (contains_with) current_scope->RecordWithStatement(); 249 if (contains_with) current_scope->RecordWithStatement();
243 if (innermost_scope == NULL) innermost_scope = current_scope; 250 if (innermost_scope == NULL) innermost_scope = current_scope;
244 } 251 }
245 252
246 // Forget about a with when we move to a context for a different function. 253 // Forget about a with when we move to a context for a different function.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 294 }
288 295
289 // Declare convenience variables. 296 // Declare convenience variables.
290 // Declare and allocate receiver (even for the global scope, and even 297 // Declare and allocate receiver (even for the global scope, and even
291 // if naccesses_ == 0). 298 // if naccesses_ == 0).
292 // NOTE: When loading parameters in the global scope, we must take 299 // NOTE: When loading parameters in the global scope, we must take
293 // care not to access them as properties of the global object, but 300 // care not to access them as properties of the global object, but
294 // instead load them directly from the stack. Currently, the only 301 // instead load them directly from the stack. Currently, the only
295 // such parameter is 'this' which is passed on the stack when 302 // such parameter is 'this' which is passed on the stack when
296 // invoking scripts 303 // invoking scripts
297 if (is_catch_scope()) { 304 if (is_catch_scope() || is_block_scope()) {
298 ASSERT(outer_scope() != NULL); 305 ASSERT(outer_scope() != NULL);
299 receiver_ = outer_scope()->receiver(); 306 receiver_ = outer_scope()->receiver();
300 } else { 307 } else {
308 ASSERT(is_function_scope() ||
309 is_global_scope() ||
310 is_eval_scope());
301 Variable* var = 311 Variable* var =
302 variables_.Declare(this, 312 variables_.Declare(this,
303 isolate_->factory()->this_symbol(), 313 isolate_->factory()->this_symbol(),
304 Variable::VAR, 314 Variable::VAR,
305 false, 315 false,
306 Variable::THIS); 316 Variable::THIS);
307 var->set_rewrite(NewSlot(var, Slot::PARAMETER, -1)); 317 var->set_rewrite(NewSlot(var, Slot::PARAMETER, -1));
308 receiver_ = var; 318 receiver_ = var;
309 } 319 }
310 320
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 variables_.Declare(this, name, Variable::VAR, true, Variable::NORMAL); 390 variables_.Declare(this, name, Variable::VAR, true, Variable::NORMAL);
381 params_.Add(var); 391 params_.Add(var);
382 } 392 }
383 393
384 394
385 Variable* Scope::DeclareLocal(Handle<String> name, Variable::Mode mode) { 395 Variable* Scope::DeclareLocal(Handle<String> name, Variable::Mode mode) {
386 ASSERT(!already_resolved()); 396 ASSERT(!already_resolved());
387 // This function handles VAR and CONST modes. DYNAMIC variables are 397 // This function handles VAR and CONST modes. DYNAMIC variables are
388 // introduces during variable allocation, INTERNAL variables are allocated 398 // introduces during variable allocation, INTERNAL variables are allocated
389 // explicitly, and TEMPORARY variables are allocated via NewTemporary(). 399 // explicitly, and TEMPORARY variables are allocated via NewTemporary().
390 ASSERT(mode == Variable::VAR || mode == Variable::CONST); 400 ASSERT(mode == Variable::VAR ||
401 mode == Variable::CONST ||
402 mode == Variable::LET);
391 ++num_var_or_const_; 403 ++num_var_or_const_;
392 return variables_.Declare(this, name, mode, true, Variable::NORMAL); 404 return variables_.Declare(this, name, mode, true, Variable::NORMAL);
393 } 405 }
394 406
395 407
396 Variable* Scope::DeclareGlobal(Handle<String> name) { 408 Variable* Scope::DeclareGlobal(Handle<String> name) {
397 ASSERT(is_global_scope()); 409 ASSERT(is_global_scope());
398 return variables_.Declare(this, name, Variable::DYNAMIC_GLOBAL, true, 410 return variables_.Declare(this, name, Variable::DYNAMIC_GLOBAL, true,
399 Variable::NORMAL); 411 Variable::NORMAL);
400 } 412 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 for (Scope* s = this; s != scope; s = s->outer_scope_) { 564 for (Scope* s = this; s != scope; s = s->outer_scope_) {
553 ASSERT(s != NULL); // scope must be in the scope chain 565 ASSERT(s != NULL); // scope must be in the scope chain
554 if (s->num_heap_slots() > 0) n++; 566 if (s->num_heap_slots() > 0) n++;
555 } 567 }
556 return n; 568 return n;
557 } 569 }
558 570
559 571
560 Scope* Scope::DeclarationScope() { 572 Scope* Scope::DeclarationScope() {
561 Scope* scope = this; 573 Scope* scope = this;
562 while (scope->is_catch_scope()) { 574 while (scope->is_catch_scope() ||
575 scope->is_block_scope()) {
563 scope = scope->outer_scope(); 576 scope = scope->outer_scope();
564 } 577 }
565 return scope; 578 return scope;
566 } 579 }
567 580
568 581
582 Handle<SerializedScopeInfo> Scope::GetSerializedScopeInfo() {
583 if (scope_info_.is_null()) {
584 scope_info_ = SerializedScopeInfo::Create(this);
585 }
586 return scope_info_;
587 }
588
589
569 #ifdef DEBUG 590 #ifdef DEBUG
570 static const char* Header(Scope::Type type) { 591 static const char* Header(Scope::Type type) {
571 switch (type) { 592 switch (type) {
572 case Scope::EVAL_SCOPE: return "eval"; 593 case Scope::EVAL_SCOPE: return "eval";
573 case Scope::FUNCTION_SCOPE: return "function"; 594 case Scope::FUNCTION_SCOPE: return "function";
574 case Scope::GLOBAL_SCOPE: return "global"; 595 case Scope::GLOBAL_SCOPE: return "global";
575 case Scope::CATCH_SCOPE: return "catch"; 596 case Scope::CATCH_SCOPE: return "catch";
597 case Scope::BLOCK_SCOPE: return "block";
576 } 598 }
577 UNREACHABLE(); 599 UNREACHABLE();
578 return NULL; 600 return NULL;
579 } 601 }
580 602
581 603
582 static void Indent(int n, const char* str) { 604 static void Indent(int n, const char* str) {
583 PrintF("%*s%s", n, "", str); 605 PrintF("%*s%s", n, "", str);
584 } 606 }
585 607
586 608
587 static void PrintName(Handle<String> name) { 609 static void PrintName(Handle<String> name) {
588 SmartPointer<char> s = name->ToCString(DISALLOW_NULLS); 610 SmartPointer<char> s = name->ToCString(DISALLOW_NULLS);
589 PrintF("%s", *s); 611 PrintF("%s", *s);
590 } 612 }
591 613
592 614
593 static void PrintVar(PrettyPrinter* printer, int indent, Variable* var) { 615 static void PrintVar(PrettyPrinter* printer, int indent, Variable* var) {
594 if (var->is_used() || var->rewrite() != NULL) { 616 if (var->is_used() || var->rewrite() != NULL) {
595 Indent(indent, Variable::Mode2String(var->mode())); 617 Indent(indent, Variable::Mode2String(var->mode()));
596 PrintF(" "); 618 PrintF(" ");
597 PrintName(var->name()); 619 PrintName(var->name());
598 PrintF("; // "); 620 PrintF("; // ");
599 if (var->rewrite() != NULL) { 621 if (var->rewrite() != NULL) {
600 PrintF("%s, ", printer->Print(var->rewrite())); 622 PrintF("%s, ", printer->Print(var->rewrite()));
601 if (var->is_accessed_from_inner_scope()) PrintF(", "); 623 if (var->is_accessed_from_inner_function_scope()) PrintF(", ");
602 } 624 }
603 if (var->is_accessed_from_inner_scope()) PrintF("inner scope access"); 625 if (var->is_accessed_from_inner_function_scope()) {
626 PrintF("inner scope access");
627 }
604 PrintF("\n"); 628 PrintF("\n");
605 } 629 }
606 } 630 }
607 631
608 632
609 static void PrintMap(PrettyPrinter* printer, int indent, VariableMap* map) { 633 static void PrintMap(PrettyPrinter* printer, int indent, VariableMap* map) {
610 for (VariableMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) { 634 for (VariableMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) {
611 Variable* var = reinterpret_cast<Variable*>(p->value); 635 Variable* var = reinterpret_cast<Variable*>(p->value);
612 PrintVar(printer, indent, var); 636 PrintVar(printer, indent, var);
613 } 637 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 } 738 }
715 739
716 740
717 // Lookup a variable starting with this scope. The result is either 741 // Lookup a variable starting with this scope. The result is either
718 // the statically resolved variable belonging to an outer scope, or 742 // the statically resolved variable belonging to an outer scope, or
719 // NULL. It may be NULL because a) we couldn't find a variable, or b) 743 // NULL. It may be NULL because a) we couldn't find a variable, or b)
720 // because the variable is just a guess (and may be shadowed by 744 // because the variable is just a guess (and may be shadowed by
721 // another variable that is introduced dynamically via an 'eval' call 745 // another variable that is introduced dynamically via an 'eval' call
722 // or a 'with' statement). 746 // or a 'with' statement).
723 Variable* Scope::LookupRecursive(Handle<String> name, 747 Variable* Scope::LookupRecursive(Handle<String> name,
724 bool inner_lookup, 748 bool from_inner_function,
725 Variable** invalidated_local) { 749 Variable** invalidated_local) {
726 // If we find a variable, but the current scope calls 'eval', the found 750 // If we find a variable, but the current scope calls 'eval', the found
727 // variable may not be the correct one (the 'eval' may introduce a 751 // variable may not be the correct one (the 'eval' may introduce a
728 // property with the same name). In that case, remember that the variable 752 // property with the same name). In that case, remember that the variable
729 // found is just a guess. 753 // found is just a guess.
730 bool guess = scope_calls_eval_; 754 bool guess = scope_calls_eval_;
731 755
732 // Try to find the variable in this scope. 756 // Try to find the variable in this scope.
733 Variable* var = LocalLookup(name); 757 Variable* var = LocalLookup(name);
734 758
735 if (var != NULL) { 759 if (var != NULL) {
736 // We found a variable. If this is not an inner lookup, we are done. 760 // We found a variable. If this is not an inner lookup, we are done.
737 // (Even if there is an 'eval' in this scope which introduces the 761 // (Even if there is an 'eval' in this scope which introduces the
738 // same variable again, the resulting variable remains the same. 762 // same variable again, the resulting variable remains the same.
739 // Note that enclosing 'with' statements are handled at the call site.) 763 // Note that enclosing 'with' statements are handled at the call site.)
740 if (!inner_lookup) 764 if (!from_inner_function)
741 return var; 765 return var;
742 766
743 } else { 767 } else {
744 // We did not find a variable locally. Check against the function variable, 768 // We did not find a variable locally. Check against the function variable,
745 // if any. We can do this for all scopes, since the function variable is 769 // if any. We can do this for all scopes, since the function variable is
746 // only present - if at all - for function scopes. 770 // only present - if at all - for function scopes.
747 // 771 //
748 // This lookup corresponds to a lookup in the "intermediate" scope sitting 772 // This lookup corresponds to a lookup in the "intermediate" scope sitting
749 // between this scope and the outer scope. (ECMA-262, 3rd., requires that 773 // between this scope and the outer scope. (ECMA-262, 3rd., requires that
750 // the name of named function literal is kept in an intermediate scope 774 // the name of named function literal is kept in an intermediate scope
751 // in between this scope and the next outer scope.) 775 // in between this scope and the next outer scope.)
752 if (function_ != NULL && function_->name().is_identical_to(name)) { 776 if (function_ != NULL && function_->name().is_identical_to(name)) {
753 var = function_; 777 var = function_;
754 778
755 } else if (outer_scope_ != NULL) { 779 } else if (outer_scope_ != NULL) {
756 var = outer_scope_->LookupRecursive(name, true, invalidated_local); 780 var = outer_scope_->LookupRecursive(
781 name,
782 is_function_scope() || from_inner_function,
783 invalidated_local);
757 // We may have found a variable in an outer scope. However, if 784 // We may have found a variable in an outer scope. However, if
758 // the current scope is inside a 'with', the actual variable may 785 // the current scope is inside a 'with', the actual variable may
759 // be a property introduced via the 'with' statement. Then, the 786 // be a property introduced via the 'with' statement. Then, the
760 // variable we may have found is just a guess. 787 // variable we may have found is just a guess.
761 if (scope_inside_with_) 788 if (scope_inside_with_)
762 guess = true; 789 guess = true;
763 } 790 }
764 791
765 // If we did not find a variable, we are done. 792 // If we did not find a variable, we are done.
766 if (var == NULL) 793 if (var == NULL)
767 return NULL; 794 return NULL;
768 } 795 }
769 796
770 ASSERT(var != NULL); 797 ASSERT(var != NULL);
771 798
772 // If this is a lookup from an inner scope, mark the variable. 799 // If this is a lookup from an inner scope, mark the variable.
773 if (inner_lookup) { 800 if (from_inner_function) {
774 var->MarkAsAccessedFromInnerScope(); 801 var->MarkAsAccessedFromInnerFunctionScope();
775 } 802 }
776 803
777 // If the variable we have found is just a guess, invalidate the 804 // If the variable we have found is just a guess, invalidate the
778 // result. If the found variable is local, record that fact so we 805 // result. If the found variable is local, record that fact so we
779 // can generate fast code to get it if it is not shadowed by eval. 806 // can generate fast code to get it if it is not shadowed by eval.
780 if (guess) { 807 if (guess) {
781 if (!var->is_global()) *invalidated_local = var; 808 if (!var->is_global()) *invalidated_local = var;
782 var = NULL; 809 var = NULL;
783 } 810 }
784 811
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 942
916 return scope_calls_eval_ || inner_scope_calls_eval_; 943 return scope_calls_eval_ || inner_scope_calls_eval_;
917 } 944 }
918 945
919 946
920 bool Scope::MustAllocate(Variable* var) { 947 bool Scope::MustAllocate(Variable* var) {
921 // Give var a read/write use if there is a chance it might be accessed 948 // Give var a read/write use if there is a chance it might be accessed
922 // via an eval() call. This is only possible if the variable has a 949 // via an eval() call. This is only possible if the variable has a
923 // visible name. 950 // visible name.
924 if ((var->is_this() || var->name()->length() > 0) && 951 if ((var->is_this() || var->name()->length() > 0) &&
925 (var->is_accessed_from_inner_scope() || 952 (var->is_accessed_from_inner_function_scope() ||
926 scope_calls_eval_ || 953 scope_calls_eval_ ||
927 inner_scope_calls_eval_ || 954 inner_scope_calls_eval_ ||
928 scope_contains_with_ || 955 scope_contains_with_ ||
929 is_catch_scope())) { 956 is_catch_scope() ||
957 is_block_scope())) {
930 var->set_is_used(true); 958 var->set_is_used(true);
931 } 959 }
932 // Global variables do not need to be allocated. 960 // Global variables do not need to be allocated.
933 return !var->is_global() && var->is_used(); 961 return !var->is_global() && var->is_used();
934 } 962 }
935 963
936 964
937 bool Scope::MustAllocateInContext(Variable* var) { 965 bool Scope::MustAllocateInContext(Variable* var) {
938 // If var is accessed from an inner scope, or if there is a possibility 966 // If var is accessed from an inner scope, or if there is a possibility
939 // that it might be accessed from the current or an inner scope (through 967 // that it might be accessed from the current or an inner scope (through
940 // an eval() call or a runtime with lookup), it must be allocated in the 968 // an eval() call or a runtime with lookup), it must be allocated in the
941 // context. 969 // context.
942 // 970 //
943 // Exceptions: temporary variables are never allocated in a context; 971 // Exceptions: temporary variables are never allocated in a context;
944 // catch-bound variables are always allocated in a context. 972 // catch-bound variables are always allocated in a context.
945 if (var->mode() == Variable::TEMPORARY) return false; 973 if (var->mode() == Variable::TEMPORARY) return false;
946 if (is_catch_scope()) return true; 974 if (is_catch_scope() || is_block_scope()) return true;
947 return var->is_accessed_from_inner_scope() || 975 return var->is_accessed_from_inner_function_scope() ||
948 scope_calls_eval_ || 976 scope_calls_eval_ ||
949 inner_scope_calls_eval_ || 977 inner_scope_calls_eval_ ||
950 scope_contains_with_ || 978 scope_contains_with_ ||
951 var->is_global(); 979 var->is_global();
952 } 980 }
953 981
954 982
955 bool Scope::HasArgumentsParameter() { 983 bool Scope::HasArgumentsParameter() {
956 for (int i = 0; i < params_.length(); i++) { 984 for (int i = 0; i < params_.length(); i++) {
957 if (params_[i]->name().is_identical_to( 985 if (params_[i]->name().is_identical_to(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 // The same parameter may occur multiple times in the parameters_ list. 1031 // The same parameter may occur multiple times in the parameters_ list.
1004 // If it does, and if it is not copied into the context object, it must 1032 // If it does, and if it is not copied into the context object, it must
1005 // receive the highest parameter index for that parameter; thus iteration 1033 // receive the highest parameter index for that parameter; thus iteration
1006 // order is relevant! 1034 // order is relevant!
1007 for (int i = params_.length() - 1; i >= 0; --i) { 1035 for (int i = params_.length() - 1; i >= 0; --i) {
1008 Variable* var = params_[i]; 1036 Variable* var = params_[i];
1009 ASSERT(var->scope() == this); 1037 ASSERT(var->scope() == this);
1010 if (uses_nonstrict_arguments) { 1038 if (uses_nonstrict_arguments) {
1011 // Give the parameter a use from an inner scope, to force allocation 1039 // Give the parameter a use from an inner scope, to force allocation
1012 // to the context. 1040 // to the context.
1013 var->MarkAsAccessedFromInnerScope(); 1041 var->MarkAsAccessedFromInnerFunctionScope();
1014 } 1042 }
1015 1043
1016 if (MustAllocate(var)) { 1044 if (MustAllocate(var)) {
1017 if (MustAllocateInContext(var)) { 1045 if (MustAllocateInContext(var)) {
1018 ASSERT(var->rewrite() == NULL || var->IsContextSlot()); 1046 ASSERT(var->rewrite() == NULL || var->IsContextSlot());
1019 if (var->rewrite() == NULL) { 1047 if (var->rewrite() == NULL) {
1020 AllocateHeapSlot(var); 1048 AllocateHeapSlot(var);
1021 } 1049 }
1022 } else { 1050 } else {
1023 ASSERT(var->rewrite() == NULL || var->IsParameter()); 1051 ASSERT(var->rewrite() == NULL || var->IsParameter());
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && 1131 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS &&
1104 !must_have_local_context) { 1132 !must_have_local_context) {
1105 num_heap_slots_ = 0; 1133 num_heap_slots_ = 0;
1106 } 1134 }
1107 1135
1108 // Allocation done. 1136 // Allocation done.
1109 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); 1137 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS);
1110 } 1138 }
1111 1139
1112 } } // namespace v8::internal 1140 } } // 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