| OLD | NEW |
| 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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 // Note that the outer context may be trivial in general, but the current | 695 // Note that the outer context may be trivial in general, but the current |
| 696 // scope may be inside a 'with' statement in which case the outer context | 696 // scope may be inside a 'with' statement in which case the outer context |
| 697 // for this scope is not trivial. | 697 // for this scope is not trivial. |
| 698 return !scope_inside_with_ && outer->HasTrivialContext(); | 698 return !scope_inside_with_ && outer->HasTrivialContext(); |
| 699 } | 699 } |
| 700 | 700 |
| 701 | 701 |
| 702 bool Scope::HasLazyCompilableOuterContext() const { | 702 bool Scope::HasLazyCompilableOuterContext() const { |
| 703 Scope* outer = outer_scope_; | 703 Scope* outer = outer_scope_; |
| 704 if (outer == NULL) return true; | 704 if (outer == NULL) return true; |
| 705 // There are several reasons that prevent lazy compilation: | 705 // We have to prevent lazy compilation if this scope is inside a with scope |
| 706 // - This scope is inside a with scope and all declaration scopes between | 706 // and all declaration scopes between them have empty contexts. Such |
| 707 // them have empty contexts. Such declaration scopes become invisible | 707 // declaration scopes may become invisible during scope info deserialization. |
| 708 // during scope info deserialization. | |
| 709 // - This scope is inside a strict eval scope with variables that are | |
| 710 // potentially context allocated in an artificial function scope that | |
| 711 // is not deserialized correctly. | |
| 712 outer = outer->DeclarationScope(); | 708 outer = outer->DeclarationScope(); |
| 713 bool found_non_trivial_declarations = false; | 709 bool found_non_trivial_declarations = false; |
| 714 for (const Scope* scope = outer; scope != NULL; scope = scope->outer_scope_) { | 710 for (const Scope* scope = outer; scope != NULL; scope = scope->outer_scope_) { |
| 715 if (scope->is_eval_scope()) return false; | |
| 716 if (scope->is_with_scope() && !found_non_trivial_declarations) return false; | 711 if (scope->is_with_scope() && !found_non_trivial_declarations) return false; |
| 717 if (scope->is_declaration_scope() && scope->num_heap_slots() > 0) { | 712 if (scope->is_declaration_scope() && scope->num_heap_slots() > 0) { |
| 718 found_non_trivial_declarations = true; | 713 found_non_trivial_declarations = true; |
| 719 } | 714 } |
| 720 } | 715 } |
| 721 return true; | 716 return true; |
| 722 } | 717 } |
| 723 | 718 |
| 724 | 719 |
| 725 bool Scope::AllowsLazyCompilation() const { | 720 bool Scope::AllowsLazyCompilation() const { |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 for (int i = 0; i < inner_scopes_.length(); i++) { | 1416 for (int i = 0; i < inner_scopes_.length(); i++) { |
| 1422 Scope* inner_scope = inner_scopes_.at(i); | 1417 Scope* inner_scope = inner_scopes_.at(i); |
| 1423 if (inner_scope->is_module_scope()) { | 1418 if (inner_scope->is_module_scope()) { |
| 1424 inner_scope->LinkModules(info); | 1419 inner_scope->LinkModules(info); |
| 1425 } | 1420 } |
| 1426 } | 1421 } |
| 1427 } | 1422 } |
| 1428 | 1423 |
| 1429 | 1424 |
| 1430 } } // namespace v8::internal | 1425 } } // namespace v8::internal |
| OLD | NEW |