| 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 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2048 | 2048 |
| 2049 | 2049 |
| 2050 Object* Heap::AllocateSharedFunctionInfo(Object* name) { | 2050 Object* Heap::AllocateSharedFunctionInfo(Object* name) { |
| 2051 Object* result = Allocate(shared_function_info_map(), OLD_POINTER_SPACE); | 2051 Object* result = Allocate(shared_function_info_map(), OLD_POINTER_SPACE); |
| 2052 if (result->IsFailure()) return result; | 2052 if (result->IsFailure()) return result; |
| 2053 | 2053 |
| 2054 SharedFunctionInfo* share = SharedFunctionInfo::cast(result); | 2054 SharedFunctionInfo* share = SharedFunctionInfo::cast(result); |
| 2055 share->set_name(name); | 2055 share->set_name(name); |
| 2056 Code* illegal = Builtins::builtin(Builtins::Illegal); | 2056 Code* illegal = Builtins::builtin(Builtins::Illegal); |
| 2057 share->set_code(illegal); | 2057 share->set_code(illegal); |
| 2058 share->set_scope_info(ScopeInfo<>::EmptyHeapObject()); | 2058 share->set_scope_info(SerializedScopeInfo::Empty()); |
| 2059 Code* construct_stub = Builtins::builtin(Builtins::JSConstructStubGeneric); | 2059 Code* construct_stub = Builtins::builtin(Builtins::JSConstructStubGeneric); |
| 2060 share->set_construct_stub(construct_stub); | 2060 share->set_construct_stub(construct_stub); |
| 2061 share->set_expected_nof_properties(0); | 2061 share->set_expected_nof_properties(0); |
| 2062 share->set_length(0); | 2062 share->set_length(0); |
| 2063 share->set_formal_parameter_count(0); | 2063 share->set_formal_parameter_count(0); |
| 2064 share->set_instance_class_name(Object_symbol()); | 2064 share->set_instance_class_name(Object_symbol()); |
| 2065 share->set_function_data(undefined_value()); | 2065 share->set_function_data(undefined_value()); |
| 2066 share->set_script(undefined_value()); | 2066 share->set_script(undefined_value()); |
| 2067 share->set_start_position_and_type(0); | 2067 share->set_start_position_and_type(0); |
| 2068 share->set_debug_info(undefined_value()); | 2068 share->set_debug_info(undefined_value()); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // Check that there are heap allocated locals in the scopeinfo. If |
| 2484 // there is, we are potentially using eval and need the scopeinfo | 2484 // there is, we are potentially using eval and need the scopeinfo |
| 2485 // for variable resolution. | 2485 // for variable resolution. |
| 2486 if (ScopeInfo<>::HasHeapAllocatedLocals(function_info->scope_info())) | 2486 if (function_info->scope_info()->HasHeapAllocatedLocals()) |
| 2487 return; | 2487 return; |
| 2488 | 2488 |
| 2489 HandleScope scope; | 2489 HandleScope scope; |
| 2490 // Compute the lazy compilable version of the code, clear the scope info. | 2490 // Compute the lazy compilable version of the code, clear the scope info. |
| 2491 function_info->set_code(*ComputeLazyCompile(function_info->length())); | 2491 function_info->set_code(*ComputeLazyCompile(function_info->length())); |
| 2492 function_info->set_scope_info(ScopeInfo<>::EmptyHeapObject()); | 2492 function_info->set_scope_info(SerializedScopeInfo::Empty()); |
| 2493 } | 2493 } |
| 2494 | 2494 |
| 2495 | 2495 |
| 2496 void Heap::FlushCode() { | 2496 void Heap::FlushCode() { |
| 2497 #ifdef ENABLE_DEBUGGER_SUPPORT | 2497 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 2498 // Do not flush code if the debugger is loaded or there are breakpoints. | 2498 // Do not flush code if the debugger is loaded or there are breakpoints. |
| 2499 if (Debug::IsLoaded() || Debug::has_break_points()) return; | 2499 if (Debug::IsLoaded() || Debug::has_break_points()) return; |
| 2500 #endif | 2500 #endif |
| 2501 HeapObjectIterator it(old_pointer_space()); | 2501 HeapObjectIterator it(old_pointer_space()); |
| 2502 for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) { | 2502 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() { | 4989 void ExternalStringTable::TearDown() { |
| 4990 new_space_strings_.Free(); | 4990 new_space_strings_.Free(); |
| 4991 old_space_strings_.Free(); | 4991 old_space_strings_.Free(); |
| 4992 } | 4992 } |
| 4993 | 4993 |
| 4994 | 4994 |
| 4995 List<Object*> ExternalStringTable::new_space_strings_; | 4995 List<Object*> ExternalStringTable::new_space_strings_; |
| 4996 List<Object*> ExternalStringTable::old_space_strings_; | 4996 List<Object*> ExternalStringTable::old_space_strings_; |
| 4997 | 4997 |
| 4998 } } // namespace v8::internal | 4998 } } // namespace v8::internal |
| OLD | NEW |