OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 2462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2473 // Make sure we are not referencing the code from the stack. | 2473 // Make sure we are not referencing the code from the stack. |
2474 for (StackFrameIterator it; !it.done(); it.Advance()) { | 2474 for (StackFrameIterator it; !it.done(); it.Advance()) { |
2475 if (function_info->code()->contains(it.frame()->pc())) return; | 2475 if (function_info->code()->contains(it.frame()->pc())) return; |
2476 } | 2476 } |
2477 // Iterate the archived stacks in all threads to check if | 2477 // Iterate the archived stacks in all threads to check if |
2478 // the code is referenced. | 2478 // the code is referenced. |
2479 FlushingStackVisitor threadvisitor(function_info->code()); | 2479 FlushingStackVisitor threadvisitor(function_info->code()); |
2480 ThreadManager::IterateArchivedThreads(&threadvisitor); | 2480 ThreadManager::IterateArchivedThreads(&threadvisitor); |
2481 if (threadvisitor.FoundCode()) return; | 2481 if (threadvisitor.FoundCode()) return; |
2482 | 2482 |
2483 // Check that there are heap allocated locals in the scopeinfo. If | 2483 // Compute the lazy compilable version of the code. |
2484 // there is, we are potentially using eval and need the scopeinfo | |
2485 // for variable resolution. | |
2486 if (ScopeInfo<>::HasHeapAllocatedLocals(function_info->scope_info())) | |
2487 return; | |
2488 | |
2489 HandleScope scope; | 2484 HandleScope scope; |
2490 // Compute the lazy compilable version of the code, clear the scope info. | |
2491 function_info->set_code(*ComputeLazyCompile(function_info->length())); | 2485 function_info->set_code(*ComputeLazyCompile(function_info->length())); |
2492 function_info->set_scope_info(ScopeInfo<>::EmptyHeapObject()); | |
2493 } | 2486 } |
2494 | 2487 |
2495 | 2488 |
2496 void Heap::FlushCode() { | 2489 void Heap::FlushCode() { |
2497 #ifdef ENABLE_DEBUGGER_SUPPORT | 2490 #ifdef ENABLE_DEBUGGER_SUPPORT |
2498 // Do not flush code if the debugger is loaded or there are breakpoints. | 2491 // Do not flush code if the debugger is loaded or there are breakpoints. |
2499 if (Debug::IsLoaded() || Debug::has_break_points()) return; | 2492 if (Debug::IsLoaded() || Debug::has_break_points()) return; |
2500 #endif | 2493 #endif |
2501 HeapObjectIterator it(old_pointer_space()); | 2494 HeapObjectIterator it(old_pointer_space()); |
2502 for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) { | 2495 for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) { |
(...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4989 void ExternalStringTable::TearDown() { | 4982 void ExternalStringTable::TearDown() { |
4990 new_space_strings_.Free(); | 4983 new_space_strings_.Free(); |
4991 old_space_strings_.Free(); | 4984 old_space_strings_.Free(); |
4992 } | 4985 } |
4993 | 4986 |
4994 | 4987 |
4995 List<Object*> ExternalStringTable::new_space_strings_; | 4988 List<Object*> ExternalStringTable::new_space_strings_; |
4996 List<Object*> ExternalStringTable::old_space_strings_; | 4989 List<Object*> ExternalStringTable::old_space_strings_; |
4997 | 4990 |
4998 } } // namespace v8::internal | 4991 } } // namespace v8::internal |
OLD | NEW |