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

Side by Side Diff: src/scopes.cc

Issue 6248014: Reapply change to with/arguments interaction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build/ia32
Patch Set: Change test to be more consistent. Created 9 years, 11 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/ia32/full-codegen-ia32.cc ('k') | src/x64/code-stubs-x64.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 Variable* invalidated_local = NULL; 719 Variable* invalidated_local = NULL;
720 Variable* var = LookupRecursive(proxy->name(), false, &invalidated_local); 720 Variable* var = LookupRecursive(proxy->name(), false, &invalidated_local);
721 721
722 if (proxy->inside_with()) { 722 if (proxy->inside_with()) {
723 // If we are inside a local 'with' statement, all bets are off 723 // If we are inside a local 'with' statement, all bets are off
724 // and we cannot resolve the proxy to a local variable even if 724 // and we cannot resolve the proxy to a local variable even if
725 // we found an outer matching variable. 725 // we found an outer matching variable.
726 // Note that we must do a lookup anyway, because if we find one, 726 // Note that we must do a lookup anyway, because if we find one,
727 // we must mark that variable as potentially accessed from this 727 // we must mark that variable as potentially accessed from this
728 // inner scope (the property may not be in the 'with' object). 728 // inner scope (the property may not be in the 'with' object).
729 if (var != NULL) var->set_is_used(true);
729 var = NonLocal(proxy->name(), Variable::DYNAMIC); 730 var = NonLocal(proxy->name(), Variable::DYNAMIC);
730 731
731 } else { 732 } else {
732 // We are not inside a local 'with' statement. 733 // We are not inside a local 'with' statement.
733 734
734 if (var == NULL) { 735 if (var == NULL) {
735 // We did not find the variable. We have a global variable 736 // We did not find the variable. We have a global variable
736 // if we are in the global scope (we know already that we 737 // if we are in the global scope (we know already that we
737 // are outside a 'with' statement) or if there is no way 738 // are outside a 'with' statement) or if there is no way
738 // that the variable might be introduced dynamically (through 739 // that the variable might be introduced dynamically (through
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 return scope_calls_eval_ || inner_scope_calls_eval_; 827 return scope_calls_eval_ || inner_scope_calls_eval_;
827 } 828 }
828 829
829 830
830 bool Scope::MustAllocate(Variable* var) { 831 bool Scope::MustAllocate(Variable* var) {
831 // Give var a read/write use if there is a chance it might be accessed 832 // Give var a read/write use if there is a chance it might be accessed
832 // via an eval() call. This is only possible if the variable has a 833 // via an eval() call. This is only possible if the variable has a
833 // visible name. 834 // visible name.
834 if ((var->is_this() || var->name()->length() > 0) && 835 if ((var->is_this() || var->name()->length() > 0) &&
835 (var->is_accessed_from_inner_scope() || 836 (var->is_accessed_from_inner_scope() ||
836 scope_calls_eval_ || inner_scope_calls_eval_ || 837 scope_calls_eval_ ||
837 scope_contains_with_)) { 838 inner_scope_calls_eval_)) {
838 var->set_is_used(true); 839 var->set_is_used(true);
839 } 840 }
840 // Global variables do not need to be allocated. 841 // Global variables do not need to be allocated.
841 return !var->is_global() && var->is_used(); 842 return !var->is_global() && var->is_used();
842 } 843 }
843 844
844 845
845 bool Scope::MustAllocateInContext(Variable* var) { 846 bool Scope::MustAllocateInContext(Variable* var) {
846 // If var is accessed from an inner scope, or if there is a 847 // If var is accessed from an inner scope, or if there is a
847 // possibility that it might be accessed from the current or an inner 848 // possibility that it might be accessed from the current or an inner
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && 1056 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS &&
1056 !must_have_local_context) { 1057 !must_have_local_context) {
1057 num_heap_slots_ = 0; 1058 num_heap_slots_ = 0;
1058 } 1059 }
1059 1060
1060 // Allocation done. 1061 // Allocation done.
1061 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); 1062 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS);
1062 } 1063 }
1063 1064
1064 } } // namespace v8::internal 1065 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698