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 24 matching lines...) Expand all Loading... |
35 #include "execution.h" | 35 #include "execution.h" |
36 #include "global-handles.h" | 36 #include "global-handles.h" |
37 #include "isolate-inl.h" | 37 #include "isolate-inl.h" |
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/counters-extension.h" |
45 | 46 |
46 namespace v8 { | 47 namespace v8 { |
47 namespace internal { | 48 namespace internal { |
48 | 49 |
49 | 50 |
50 NativesExternalStringResource::NativesExternalStringResource( | 51 NativesExternalStringResource::NativesExternalStringResource( |
51 Bootstrapper* bootstrapper, | 52 Bootstrapper* bootstrapper, |
52 const char* source, | 53 const char* source, |
53 size_t length) | 54 size_t length) |
54 : data_(source), length_(length) { | 55 : data_(source), length_(length) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 89 } |
89 Handle<Object> cached_source(heap->natives_source_cache()->get(index)); | 90 Handle<Object> cached_source(heap->natives_source_cache()->get(index)); |
90 return Handle<String>::cast(cached_source); | 91 return Handle<String>::cast(cached_source); |
91 } | 92 } |
92 | 93 |
93 | 94 |
94 void Bootstrapper::Initialize(bool create_heap_objects) { | 95 void Bootstrapper::Initialize(bool create_heap_objects) { |
95 extensions_cache_.Initialize(create_heap_objects); | 96 extensions_cache_.Initialize(create_heap_objects); |
96 GCExtension::Register(); | 97 GCExtension::Register(); |
97 ExternalizeStringExtension::Register(); | 98 ExternalizeStringExtension::Register(); |
| 99 CountersExtension::Register(); |
98 } | 100 } |
99 | 101 |
100 | 102 |
101 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) { | 103 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) { |
102 char* memory = new char[bytes]; | 104 char* memory = new char[bytes]; |
103 if (memory != NULL) { | 105 if (memory != NULL) { |
104 if (delete_these_arrays_on_tear_down_ == NULL) { | 106 if (delete_these_arrays_on_tear_down_ == NULL) { |
105 delete_these_arrays_on_tear_down_ = new List<char*>(2); | 107 delete_these_arrays_on_tear_down_ = new List<char*>(2); |
106 } | 108 } |
107 delete_these_arrays_on_tear_down_->Add(memory); | 109 delete_these_arrays_on_tear_down_->Add(memory); |
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 while (current != NULL) { | 1992 while (current != NULL) { |
1991 if (current->extension()->auto_enable()) | 1993 if (current->extension()->auto_enable()) |
1992 InstallExtension(current, &extension_states); | 1994 InstallExtension(current, &extension_states); |
1993 current = current->next(); | 1995 current = current->next(); |
1994 } | 1996 } |
1995 | 1997 |
1996 if (FLAG_expose_gc) InstallExtension("v8/gc", &extension_states); | 1998 if (FLAG_expose_gc) InstallExtension("v8/gc", &extension_states); |
1997 if (FLAG_expose_externalize_string) { | 1999 if (FLAG_expose_externalize_string) { |
1998 InstallExtension("v8/externalize", &extension_states); | 2000 InstallExtension("v8/externalize", &extension_states); |
1999 } | 2001 } |
| 2002 if (FLAG_track_gc_object_stats) { |
| 2003 InstallExtension("v8/counters", &extension_states); |
| 2004 } |
2000 | 2005 |
2001 if (extensions == NULL) return true; | 2006 if (extensions == NULL) return true; |
2002 // Install required extensions | 2007 // Install required extensions |
2003 int count = v8::ImplementationUtilities::GetNameCount(extensions); | 2008 int count = v8::ImplementationUtilities::GetNameCount(extensions); |
2004 const char** names = v8::ImplementationUtilities::GetNames(extensions); | 2009 const char** names = v8::ImplementationUtilities::GetNames(extensions); |
2005 for (int i = 0; i < count; i++) { | 2010 for (int i = 0; i < count; i++) { |
2006 if (!InstallExtension(names[i], &extension_states)) | 2011 if (!InstallExtension(names[i], &extension_states)) |
2007 return false; | 2012 return false; |
2008 } | 2013 } |
2009 | 2014 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2353 return from + sizeof(NestingCounterType); | 2358 return from + sizeof(NestingCounterType); |
2354 } | 2359 } |
2355 | 2360 |
2356 | 2361 |
2357 // Called when the top-level V8 mutex is destroyed. | 2362 // Called when the top-level V8 mutex is destroyed. |
2358 void Bootstrapper::FreeThreadResources() { | 2363 void Bootstrapper::FreeThreadResources() { |
2359 ASSERT(!IsActive()); | 2364 ASSERT(!IsActive()); |
2360 } | 2365 } |
2361 | 2366 |
2362 } } // namespace v8::internal | 2367 } } // namespace v8::internal |
OLD | NEW |