| 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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 722   // Note that the outer context may be trivial in general, but the current | 722   // Note that the outer context may be trivial in general, but the current | 
| 723   // scope may be inside a 'with' statement in which case the outer context | 723   // scope may be inside a 'with' statement in which case the outer context | 
| 724   // for this scope is not trivial. | 724   // for this scope is not trivial. | 
| 725   return !scope_inside_with_ && outer->HasTrivialContext(); | 725   return !scope_inside_with_ && outer->HasTrivialContext(); | 
| 726 } | 726 } | 
| 727 | 727 | 
| 728 | 728 | 
| 729 bool Scope::HasLazyCompilableOuterContext() const { | 729 bool Scope::HasLazyCompilableOuterContext() const { | 
| 730   Scope* outer = outer_scope_; | 730   Scope* outer = outer_scope_; | 
| 731   if (outer == NULL) return true; | 731   if (outer == NULL) return true; | 
| 732   // There are several reasons that prevent lazy compilation: | 732   // We have to prevent lazy compilation if this scope is inside a with scope | 
| 733   // - This scope is inside a with scope and all declaration scopes between | 733   // and all declaration scopes between them have empty contexts. Such | 
| 734   //   them have empty contexts. Such declaration scopes become invisible | 734   // declaration scopes may become invisible during scope info deserialization. | 
| 735   //   during scope info deserialization. |  | 
| 736   // - This scope is inside a strict eval scope with variables that are |  | 
| 737   //   potentially context allocated in an artificial function scope that |  | 
| 738   //   is not deserialized correctly. |  | 
| 739   outer = outer->DeclarationScope(); | 735   outer = outer->DeclarationScope(); | 
| 740   bool found_non_trivial_declarations = false; | 736   bool found_non_trivial_declarations = false; | 
| 741   for (const Scope* scope = outer; scope != NULL; scope = scope->outer_scope_) { | 737   for (const Scope* scope = outer; scope != NULL; scope = scope->outer_scope_) { | 
| 742     if (scope->is_eval_scope()) return false; |  | 
| 743     if (scope->is_with_scope() && !found_non_trivial_declarations) return false; | 738     if (scope->is_with_scope() && !found_non_trivial_declarations) return false; | 
| 744     if (scope->is_declaration_scope() && scope->num_heap_slots() > 0) { | 739     if (scope->is_declaration_scope() && scope->num_heap_slots() > 0) { | 
| 745       found_non_trivial_declarations = true; | 740       found_non_trivial_declarations = true; | 
| 746     } | 741     } | 
| 747   } | 742   } | 
| 748   return true; | 743   return true; | 
| 749 } | 744 } | 
| 750 | 745 | 
| 751 | 746 | 
| 752 bool Scope::AllowsLazyCompilation() const { | 747 bool Scope::AllowsLazyCompilation() const { | 
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1412 } | 1407 } | 
| 1413 | 1408 | 
| 1414 | 1409 | 
| 1415 int Scope::ContextLocalCount() const { | 1410 int Scope::ContextLocalCount() const { | 
| 1416   if (num_heap_slots() == 0) return 0; | 1411   if (num_heap_slots() == 0) return 0; | 
| 1417   return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1412   return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 
| 1418       (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1413       (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 
| 1419 } | 1414 } | 
| 1420 | 1415 | 
| 1421 } }  // namespace v8::internal | 1416 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|