| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 22 matching lines...) Expand all Loading... |
| 33 #include "compiler.h" | 33 #include "compiler.h" |
| 34 #include "debug.h" | 34 #include "debug.h" |
| 35 #include "execution.h" | 35 #include "execution.h" |
| 36 #include "global-handles.h" | 36 #include "global-handles.h" |
| 37 #include "macro-assembler.h" | 37 #include "macro-assembler.h" |
| 38 #include "natives.h" | 38 #include "natives.h" |
| 39 #include "objects-visiting.h" | 39 #include "objects-visiting.h" |
| 40 #include "snapshot.h" | 40 #include "snapshot.h" |
| 41 #include "extensions/externalize-string-extension.h" | 41 #include "extensions/externalize-string-extension.h" |
| 42 #include "extensions/gc-extension.h" | 42 #include "extensions/gc-extension.h" |
| 43 #include "extensions/run-extension.h" |
| 43 | 44 |
| 44 namespace v8 { | 45 namespace v8 { |
| 45 namespace internal { | 46 namespace internal { |
| 46 | 47 |
| 47 | 48 |
| 48 NativesExternalStringResource::NativesExternalStringResource( | 49 NativesExternalStringResource::NativesExternalStringResource( |
| 49 Bootstrapper* bootstrapper, | 50 Bootstrapper* bootstrapper, |
| 50 const char* source) | 51 const char* source) |
| 51 : data_(source), length_(StrLength(source)) { | 52 : data_(source), length_(StrLength(source)) { |
| 52 if (bootstrapper->delete_these_non_arrays_on_tear_down_ == NULL) { | 53 if (bootstrapper->delete_these_non_arrays_on_tear_down_ == NULL) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 91 } |
| 91 Handle<Object> cached_source(heap->natives_source_cache()->get(index)); | 92 Handle<Object> cached_source(heap->natives_source_cache()->get(index)); |
| 92 return Handle<String>::cast(cached_source); | 93 return Handle<String>::cast(cached_source); |
| 93 } | 94 } |
| 94 | 95 |
| 95 | 96 |
| 96 void Bootstrapper::Initialize(bool create_heap_objects) { | 97 void Bootstrapper::Initialize(bool create_heap_objects) { |
| 97 extensions_cache_.Initialize(create_heap_objects); | 98 extensions_cache_.Initialize(create_heap_objects); |
| 98 GCExtension::Register(); | 99 GCExtension::Register(); |
| 99 ExternalizeStringExtension::Register(); | 100 ExternalizeStringExtension::Register(); |
| 101 RunExtension::Register(); |
| 100 } | 102 } |
| 101 | 103 |
| 102 | 104 |
| 103 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) { | 105 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) { |
| 104 char* memory = new char[bytes]; | 106 char* memory = new char[bytes]; |
| 105 if (memory != NULL) { | 107 if (memory != NULL) { |
| 106 if (delete_these_arrays_on_tear_down_ == NULL) { | 108 if (delete_these_arrays_on_tear_down_ == NULL) { |
| 107 delete_these_arrays_on_tear_down_ = new List<char*>(2); | 109 delete_these_arrays_on_tear_down_ = new List<char*>(2); |
| 108 } | 110 } |
| 109 delete_these_arrays_on_tear_down_->Add(memory); | 111 delete_these_arrays_on_tear_down_->Add(memory); |
| (...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1789 // Install auto extensions. | 1791 // Install auto extensions. |
| 1790 current = v8::RegisteredExtension::first_extension(); | 1792 current = v8::RegisteredExtension::first_extension(); |
| 1791 while (current != NULL) { | 1793 while (current != NULL) { |
| 1792 if (current->extension()->auto_enable()) | 1794 if (current->extension()->auto_enable()) |
| 1793 InstallExtension(current); | 1795 InstallExtension(current); |
| 1794 current = current->next(); | 1796 current = current->next(); |
| 1795 } | 1797 } |
| 1796 | 1798 |
| 1797 if (FLAG_expose_gc) InstallExtension("v8/gc"); | 1799 if (FLAG_expose_gc) InstallExtension("v8/gc"); |
| 1798 if (FLAG_expose_externalize_string) InstallExtension("v8/externalize"); | 1800 if (FLAG_expose_externalize_string) InstallExtension("v8/externalize"); |
| 1801 if (FLAG_expose_run) InstallExtension("v8/run"); |
| 1799 | 1802 |
| 1800 if (extensions == NULL) return true; | 1803 if (extensions == NULL) return true; |
| 1801 // Install required extensions | 1804 // Install required extensions |
| 1802 int count = v8::ImplementationUtilities::GetNameCount(extensions); | 1805 int count = v8::ImplementationUtilities::GetNameCount(extensions); |
| 1803 const char** names = v8::ImplementationUtilities::GetNames(extensions); | 1806 const char** names = v8::ImplementationUtilities::GetNames(extensions); |
| 1804 for (int i = 0; i < count; i++) { | 1807 for (int i = 0; i < count; i++) { |
| 1805 if (!InstallExtension(names[i])) | 1808 if (!InstallExtension(names[i])) |
| 1806 return false; | 1809 return false; |
| 1807 } | 1810 } |
| 1808 | 1811 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2129 return from + sizeof(NestingCounterType); | 2132 return from + sizeof(NestingCounterType); |
| 2130 } | 2133 } |
| 2131 | 2134 |
| 2132 | 2135 |
| 2133 // Called when the top-level V8 mutex is destroyed. | 2136 // Called when the top-level V8 mutex is destroyed. |
| 2134 void Bootstrapper::FreeThreadResources() { | 2137 void Bootstrapper::FreeThreadResources() { |
| 2135 ASSERT(!IsActive()); | 2138 ASSERT(!IsActive()); |
| 2136 } | 2139 } |
| 2137 | 2140 |
| 2138 } } // namespace v8::internal | 2141 } } // namespace v8::internal |
| OLD | NEW |