| OLD | NEW | 
|---|
| 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 574 | 574 | 
| 575   Shrink(); | 575   Shrink(); | 
| 576   if (new_space_.CommitFromSpaceIfNeeded()) return; | 576   if (new_space_.CommitFromSpaceIfNeeded()) return; | 
| 577 | 577 | 
| 578   // Committing memory to from space failed again. | 578   // Committing memory to from space failed again. | 
| 579   // Memory is exhausted and we will die. | 579   // Memory is exhausted and we will die. | 
| 580   V8::FatalProcessOutOfMemory("Committing semi space failed."); | 580   V8::FatalProcessOutOfMemory("Committing semi space failed."); | 
| 581 } | 581 } | 
| 582 | 582 | 
| 583 | 583 | 
| 584 class ClearThreadJSFunctionResultCachesVisitor: public ThreadVisitor  { | 584 void Heap::ClearJSFunctionResultCaches() { | 
| 585   virtual void VisitThread(ThreadLocalTop* top) { | 585   if (Bootstrapper::IsActive()) return; | 
| 586     Context* context = top->context_; |  | 
| 587     if (context == NULL) return; |  | 
| 588 | 586 | 
|  | 587   Object* context = global_contexts_list_; | 
|  | 588   while (!context->IsUndefined()) { | 
|  | 589     // Get the caches for this context: | 
| 589     FixedArray* caches = | 590     FixedArray* caches = | 
| 590       context->global()->global_context()->jsfunction_result_caches(); | 591       Context::cast(context)->jsfunction_result_caches(); | 
|  | 592     // Clear the caches: | 
| 591     int length = caches->length(); | 593     int length = caches->length(); | 
| 592     for (int i = 0; i < length; i++) { | 594     for (int i = 0; i < length; i++) { | 
| 593       JSFunctionResultCache::cast(caches->get(i))->Clear(); | 595       JSFunctionResultCache::cast(caches->get(i))->Clear(); | 
| 594     } | 596     } | 
|  | 597     // Get the next context: | 
|  | 598     context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); | 
| 595   } | 599   } | 
| 596 }; |  | 
| 597 |  | 
| 598 |  | 
| 599 void Heap::ClearJSFunctionResultCaches() { |  | 
| 600   if (Bootstrapper::IsActive()) return; |  | 
| 601   ClearThreadJSFunctionResultCachesVisitor visitor; |  | 
| 602   ThreadManager::IterateArchivedThreads(&visitor); |  | 
| 603 } | 600 } | 
| 604 | 601 | 
| 605 | 602 | 
| 606 void Heap::ClearNormalizedMapCaches() { | 603 void Heap::ClearNormalizedMapCaches() { | 
| 607   if (Bootstrapper::IsActive()) return; | 604   if (Bootstrapper::IsActive()) return; | 
| 608 | 605 | 
| 609   Object* context = global_contexts_list_; | 606   Object* context = global_contexts_list_; | 
| 610   while (!context->IsUndefined()) { | 607   while (!context->IsUndefined()) { | 
| 611     Context::cast(context)->normalized_map_cache()->Clear(); | 608     Context::cast(context)->normalized_map_cache()->Clear(); | 
| 612     context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); | 609     context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); | 
| (...skipping 4622 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5235 void ExternalStringTable::TearDown() { | 5232 void ExternalStringTable::TearDown() { | 
| 5236   new_space_strings_.Free(); | 5233   new_space_strings_.Free(); | 
| 5237   old_space_strings_.Free(); | 5234   old_space_strings_.Free(); | 
| 5238 } | 5235 } | 
| 5239 | 5236 | 
| 5240 | 5237 | 
| 5241 List<Object*> ExternalStringTable::new_space_strings_; | 5238 List<Object*> ExternalStringTable::new_space_strings_; | 
| 5242 List<Object*> ExternalStringTable::old_space_strings_; | 5239 List<Object*> ExternalStringTable::old_space_strings_; | 
| 5243 | 5240 | 
| 5244 } }  // namespace v8::internal | 5241 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|