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 21 matching lines...) Expand all Loading... |
32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
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 "stub-cache.h" | 41 #include "stub-cache.h" |
| 42 #include "extensions/externalize-string-extension.h" |
| 43 #include "extensions/gc-extension.h" |
42 | 44 |
43 namespace v8 { | 45 namespace v8 { |
44 namespace internal { | 46 namespace internal { |
45 | 47 |
46 // A SourceCodeCache uses a FixedArray to store pairs of | 48 // A SourceCodeCache uses a FixedArray to store pairs of |
47 // (AsciiString*, JSFunction*), mapping names of native code files | 49 // (AsciiString*, JSFunction*), mapping names of native code files |
48 // (runtime.js, etc.) to precompiled functions. Instead of mapping | 50 // (runtime.js, etc.) to precompiled functions. Instead of mapping |
49 // names to functions it might make sense to let the JS2C tool | 51 // names to functions it might make sense to let the JS2C tool |
50 // generate an index for each native JS file. | 52 // generate an index for each native JS file. |
51 class SourceCodeCache BASE_EMBEDDED { | 53 class SourceCodeCache BASE_EMBEDDED { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 Heap::natives_source_cache()->set(index, *source_code); | 132 Heap::natives_source_cache()->set(index, *source_code); |
131 } | 133 } |
132 } | 134 } |
133 Handle<Object> cached_source(Heap::natives_source_cache()->get(index)); | 135 Handle<Object> cached_source(Heap::natives_source_cache()->get(index)); |
134 return Handle<String>::cast(cached_source); | 136 return Handle<String>::cast(cached_source); |
135 } | 137 } |
136 | 138 |
137 | 139 |
138 void Bootstrapper::Initialize(bool create_heap_objects) { | 140 void Bootstrapper::Initialize(bool create_heap_objects) { |
139 extensions_cache.Initialize(create_heap_objects); | 141 extensions_cache.Initialize(create_heap_objects); |
| 142 GCExtension::Register(); |
| 143 ExternalizeStringExtension::Register(); |
140 } | 144 } |
141 | 145 |
142 | 146 |
143 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) { | 147 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) { |
144 char* memory = new char[bytes]; | 148 char* memory = new char[bytes]; |
145 if (memory != NULL) { | 149 if (memory != NULL) { |
146 if (delete_these_arrays_on_tear_down == NULL) { | 150 if (delete_these_arrays_on_tear_down == NULL) { |
147 delete_these_arrays_on_tear_down = new List<char*>(2); | 151 delete_these_arrays_on_tear_down = new List<char*>(2); |
148 } | 152 } |
149 delete_these_arrays_on_tear_down->Add(memory); | 153 delete_these_arrays_on_tear_down->Add(memory); |
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1864 } | 1868 } |
1865 | 1869 |
1866 | 1870 |
1867 // Restore statics that are thread local. | 1871 // Restore statics that are thread local. |
1868 char* BootstrapperActive::RestoreState(char* from) { | 1872 char* BootstrapperActive::RestoreState(char* from) { |
1869 nesting_ = *reinterpret_cast<int*>(from); | 1873 nesting_ = *reinterpret_cast<int*>(from); |
1870 return from + sizeof(nesting_); | 1874 return from + sizeof(nesting_); |
1871 } | 1875 } |
1872 | 1876 |
1873 } } // namespace v8::internal | 1877 } } // namespace v8::internal |
OLD | NEW |