Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: src/bootstrapper.cc

Issue 18487004: Import the v8-i18n extension into v8 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
48 namespace v8 { 52 namespace v8 {
49 namespace internal { 53 namespace internal {
50 54
51 55
52 NativesExternalStringResource::NativesExternalStringResource( 56 NativesExternalStringResource::NativesExternalStringResource(
53 Bootstrapper* bootstrapper, 57 Bootstrapper* bootstrapper,
54 const char* source, 58 const char* source,
55 size_t length) 59 size_t length)
56 : data_(source), length_(length) { 60 : data_(source), length_(length) {
57 if (bootstrapper->delete_these_non_arrays_on_tear_down_ == NULL) { 61 if (bootstrapper->delete_these_non_arrays_on_tear_down_ == NULL) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 99
96 void Bootstrapper::Initialize(bool create_heap_objects) { 100 void Bootstrapper::Initialize(bool create_heap_objects) {
97 extensions_cache_.Initialize(create_heap_objects); 101 extensions_cache_.Initialize(create_heap_objects);
98 } 102 }
99 103
100 104
101 void Bootstrapper::InitializeOncePerProcess() { 105 void Bootstrapper::InitializeOncePerProcess() {
102 GCExtension::Register(); 106 GCExtension::Register();
103 ExternalizeStringExtension::Register(); 107 ExternalizeStringExtension::Register();
104 StatisticsExtension::Register(); 108 StatisticsExtension::Register();
109 #if defined(V8_I18N_SUPPORT)
110 v8_i18n::Extension::Register();
111 #endif
105 } 112 }
106 113
107 114
108 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) { 115 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) {
109 char* memory = new char[bytes]; 116 char* memory = new char[bytes];
110 if (memory != NULL) { 117 if (memory != NULL) {
111 if (delete_these_arrays_on_tear_down_ == NULL) { 118 if (delete_these_arrays_on_tear_down_ == NULL) {
112 delete_these_arrays_on_tear_down_ = new List<char*>(2); 119 delete_these_arrays_on_tear_down_ = new List<char*>(2);
113 } 120 }
114 delete_these_arrays_on_tear_down_->Add(memory); 121 delete_these_arrays_on_tear_down_->Add(memory);
(...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 } 2279 }
2273 2280
2274 if (FLAG_expose_gc) InstallExtension(isolate, "v8/gc", &extension_states); 2281 if (FLAG_expose_gc) InstallExtension(isolate, "v8/gc", &extension_states);
2275 if (FLAG_expose_externalize_string) { 2282 if (FLAG_expose_externalize_string) {
2276 InstallExtension(isolate, "v8/externalize", &extension_states); 2283 InstallExtension(isolate, "v8/externalize", &extension_states);
2277 } 2284 }
2278 if (FLAG_track_gc_object_stats) { 2285 if (FLAG_track_gc_object_stats) {
2279 InstallExtension(isolate, "v8/statistics", &extension_states); 2286 InstallExtension(isolate, "v8/statistics", &extension_states);
2280 } 2287 }
2281 2288
2289 #if defined(V8_I18N_SUPPORT)
2290 if (FLAG_enable_i18n) {
2291 InstallExtension(isolate, "v8/i18n", &extension_states);
2292 }
2293 #endif
2294
2282 if (extensions == NULL) return true; 2295 if (extensions == NULL) return true;
2283 // Install required extensions 2296 // Install required extensions
2284 int count = v8::ImplementationUtilities::GetNameCount(extensions); 2297 int count = v8::ImplementationUtilities::GetNameCount(extensions);
2285 const char** names = v8::ImplementationUtilities::GetNames(extensions); 2298 const char** names = v8::ImplementationUtilities::GetNames(extensions);
2286 for (int i = 0; i < count; i++) { 2299 for (int i = 0; i < count; i++) {
2287 if (!InstallExtension(isolate, names[i], &extension_states)) 2300 if (!InstallExtension(isolate, names[i], &extension_states))
2288 return false; 2301 return false;
2289 } 2302 }
2290 2303
2291 return true; 2304 return true;
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2652 return from + sizeof(NestingCounterType); 2665 return from + sizeof(NestingCounterType);
2653 } 2666 }
2654 2667
2655 2668
2656 // Called when the top-level V8 mutex is destroyed. 2669 // Called when the top-level V8 mutex is destroyed.
2657 void Bootstrapper::FreeThreadResources() { 2670 void Bootstrapper::FreeThreadResources() {
2658 ASSERT(!IsActive()); 2671 ASSERT(!IsActive());
2659 } 2672 }
2660 2673
2661 } } // namespace v8::internal 2674 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698