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 27 matching lines...) Expand all Loading... |
38 #include "macro-assembler.h" | 38 #include "macro-assembler.h" |
39 #include "natives.h" | 39 #include "natives.h" |
40 #include "objects-visiting.h" | 40 #include "objects-visiting.h" |
41 #include "platform.h" | 41 #include "platform.h" |
42 #include "snapshot.h" | 42 #include "snapshot.h" |
43 #include "extensions/externalize-string-extension.h" | 43 #include "extensions/externalize-string-extension.h" |
44 #include "extensions/gc-extension.h" | 44 #include "extensions/gc-extension.h" |
45 #include "extensions/statistics-extension.h" | 45 #include "extensions/statistics-extension.h" |
46 #include "code-stubs.h" | 46 #include "code-stubs.h" |
47 | 47 |
48 #if defined(V8_I18N_SUPPORT) | |
49 #include "extensions/i18n/i18n-extension.h" | |
50 #endif | |
51 | |
52 namespace v8 { | 48 namespace v8 { |
53 namespace internal { | 49 namespace internal { |
54 | 50 |
55 | 51 |
56 NativesExternalStringResource::NativesExternalStringResource( | 52 NativesExternalStringResource::NativesExternalStringResource( |
57 Bootstrapper* bootstrapper, | 53 Bootstrapper* bootstrapper, |
58 const char* source, | 54 const char* source, |
59 size_t length) | 55 size_t length) |
60 : data_(source), length_(length) { | 56 : data_(source), length_(length) { |
61 if (bootstrapper->delete_these_non_arrays_on_tear_down_ == NULL) { | 57 if (bootstrapper->delete_these_non_arrays_on_tear_down_ == NULL) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 95 |
100 void Bootstrapper::Initialize(bool create_heap_objects) { | 96 void Bootstrapper::Initialize(bool create_heap_objects) { |
101 extensions_cache_.Initialize(isolate_, create_heap_objects); | 97 extensions_cache_.Initialize(isolate_, create_heap_objects); |
102 } | 98 } |
103 | 99 |
104 | 100 |
105 void Bootstrapper::InitializeOncePerProcess() { | 101 void Bootstrapper::InitializeOncePerProcess() { |
106 GCExtension::Register(); | 102 GCExtension::Register(); |
107 ExternalizeStringExtension::Register(); | 103 ExternalizeStringExtension::Register(); |
108 StatisticsExtension::Register(); | 104 StatisticsExtension::Register(); |
109 #if defined(V8_I18N_SUPPORT) | |
110 v8_i18n::Extension::Register(); | |
111 #endif | |
112 } | 105 } |
113 | 106 |
114 | 107 |
115 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) { | 108 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) { |
116 char* memory = new char[bytes]; | 109 char* memory = new char[bytes]; |
117 if (memory != NULL) { | 110 if (memory != NULL) { |
118 if (delete_these_arrays_on_tear_down_ == NULL) { | 111 if (delete_these_arrays_on_tear_down_ == NULL) { |
119 delete_these_arrays_on_tear_down_ = new List<char*>(2); | 112 delete_these_arrays_on_tear_down_ = new List<char*>(2); |
120 } | 113 } |
121 delete_these_arrays_on_tear_down_->Add(memory); | 114 delete_these_arrays_on_tear_down_->Add(memory); |
(...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2284 } | 2277 } |
2285 | 2278 |
2286 if (FLAG_expose_gc) InstallExtension(isolate, "v8/gc", &extension_states); | 2279 if (FLAG_expose_gc) InstallExtension(isolate, "v8/gc", &extension_states); |
2287 if (FLAG_expose_externalize_string) { | 2280 if (FLAG_expose_externalize_string) { |
2288 InstallExtension(isolate, "v8/externalize", &extension_states); | 2281 InstallExtension(isolate, "v8/externalize", &extension_states); |
2289 } | 2282 } |
2290 if (FLAG_track_gc_object_stats) { | 2283 if (FLAG_track_gc_object_stats) { |
2291 InstallExtension(isolate, "v8/statistics", &extension_states); | 2284 InstallExtension(isolate, "v8/statistics", &extension_states); |
2292 } | 2285 } |
2293 | 2286 |
2294 #if defined(V8_I18N_SUPPORT) | |
2295 if (FLAG_enable_i18n) { | |
2296 InstallExtension(isolate, "v8/i18n", &extension_states); | |
2297 } | |
2298 #endif | |
2299 | |
2300 if (extensions == NULL) return true; | 2287 if (extensions == NULL) return true; |
2301 // Install required extensions | 2288 // Install required extensions |
2302 int count = v8::ImplementationUtilities::GetNameCount(extensions); | 2289 int count = v8::ImplementationUtilities::GetNameCount(extensions); |
2303 const char** names = v8::ImplementationUtilities::GetNames(extensions); | 2290 const char** names = v8::ImplementationUtilities::GetNames(extensions); |
2304 for (int i = 0; i < count; i++) { | 2291 for (int i = 0; i < count; i++) { |
2305 if (!InstallExtension(isolate, names[i], &extension_states)) | 2292 if (!InstallExtension(isolate, names[i], &extension_states)) |
2306 return false; | 2293 return false; |
2307 } | 2294 } |
2308 | 2295 |
2309 return true; | 2296 return true; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2677 return from + sizeof(NestingCounterType); | 2664 return from + sizeof(NestingCounterType); |
2678 } | 2665 } |
2679 | 2666 |
2680 | 2667 |
2681 // Called when the top-level V8 mutex is destroyed. | 2668 // Called when the top-level V8 mutex is destroyed. |
2682 void Bootstrapper::FreeThreadResources() { | 2669 void Bootstrapper::FreeThreadResources() { |
2683 ASSERT(!IsActive()); | 2670 ASSERT(!IsActive()); |
2684 } | 2671 } |
2685 | 2672 |
2686 } } // namespace v8::internal | 2673 } } // namespace v8::internal |
OLD | NEW |