OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 return var; | 535 return var; |
536 | 536 |
537 } else { | 537 } else { |
538 // We did not find a variable locally. Check against the function variable, | 538 // We did not find a variable locally. Check against the function variable, |
539 // if any. We can do this for all scopes, since the function variable is | 539 // if any. We can do this for all scopes, since the function variable is |
540 // only present - if at all - for function scopes. | 540 // only present - if at all - for function scopes. |
541 // | 541 // |
542 // This lookup corresponds to a lookup in the "intermediate" scope sitting | 542 // This lookup corresponds to a lookup in the "intermediate" scope sitting |
543 // between this scope and the outer scope. (ECMA-262, 3rd., requires that | 543 // between this scope and the outer scope. (ECMA-262, 3rd., requires that |
544 // the name of named function literal is kept in an intermediate scope | 544 // the name of named function literal is kept in an intermediate scope |
545 // inbetween this scope and the next outer scope.) | 545 // in between this scope and the next outer scope.) |
546 if (function_ != NULL && function_->name().is_identical_to(name)) { | 546 if (function_ != NULL && function_->name().is_identical_to(name)) { |
547 var = function_; | 547 var = function_; |
548 | 548 |
549 } else if (outer_scope_ != NULL) { | 549 } else if (outer_scope_ != NULL) { |
550 var = outer_scope_->LookupRecursive(name, true /* inner lookup */); | 550 var = outer_scope_->LookupRecursive(name, true /* inner lookup */); |
551 // We may have found a variable in an outer scope. However, if | 551 // We may have found a variable in an outer scope. However, if |
552 // the current scope is inside a 'with', the actual variable may | 552 // the current scope is inside a 'with', the actual variable may |
553 // be a property introduced via the 'with' statement. Then, the | 553 // be a property introduced via the 'with' statement. Then, the |
554 // variable we may have found is just a guess. | 554 // variable we may have found is just a guess. |
555 if (scope_inside_with_) | 555 if (scope_inside_with_) |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && | 897 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && |
898 !must_have_local_context) { | 898 !must_have_local_context) { |
899 num_heap_slots_ = 0; | 899 num_heap_slots_ = 0; |
900 } | 900 } |
901 | 901 |
902 // Allocation done. | 902 // Allocation done. |
903 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); | 903 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); |
904 } | 904 } |
905 | 905 |
906 } } // namespace v8::internal | 906 } } // namespace v8::internal |
OLD | NEW |