OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // passed through the API. The global from the snapshot is detached from the | 195 // passed through the API. The global from the snapshot is detached from the |
196 // other objects in the snapshot. | 196 // other objects in the snapshot. |
197 void HookUpGlobalObject(Handle<GlobalObject> global_object); | 197 void HookUpGlobalObject(Handle<GlobalObject> global_object); |
198 // New context initialization. Used for creating a context from scratch. | 198 // New context initialization. Used for creating a context from scratch. |
199 void InitializeGlobal(Handle<GlobalObject> global_object, | 199 void InitializeGlobal(Handle<GlobalObject> global_object, |
200 Handle<JSFunction> empty_function); | 200 Handle<JSFunction> empty_function); |
201 void InitializeExperimentalGlobal(); | 201 void InitializeExperimentalGlobal(); |
202 // Installs the contents of the native .js files on the global objects. | 202 // Installs the contents of the native .js files on the global objects. |
203 // Used for creating a context from scratch. | 203 // Used for creating a context from scratch. |
204 void InstallNativeFunctions(); | 204 void InstallNativeFunctions(); |
205 void InstallExperimentalBuiltinFunctionIds(); | |
206 void InstallExperimentalNativeFunctions(); | 205 void InstallExperimentalNativeFunctions(); |
207 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, | 206 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, |
208 const char* name, | 207 const char* name, |
209 ElementsKind elements_kind); | 208 ElementsKind elements_kind); |
210 bool InstallNatives(); | 209 bool InstallNatives(); |
211 | 210 |
212 void InstallTypedArray( | 211 void InstallTypedArray( |
213 const char* name, | 212 const char* name, |
214 ElementsKind elements_kind, | 213 ElementsKind elements_kind, |
215 Handle<JSFunction>* fun, | 214 Handle<JSFunction>* fun, |
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2016 i++) { | 2015 i++) { |
2017 INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js") | 2016 INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js") |
2018 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js") | 2017 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js") |
2019 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js") | 2018 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js") |
2020 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection-iterator.js") | 2019 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection-iterator.js") |
2021 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") | 2020 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") |
2022 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") | 2021 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") |
2023 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "string-iterator.js") | 2022 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "string-iterator.js") |
2024 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") | 2023 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") |
2025 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") | 2024 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") |
2026 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js") | |
2027 } | 2025 } |
2028 | 2026 |
2029 InstallExperimentalNativeFunctions(); | 2027 InstallExperimentalNativeFunctions(); |
2030 InstallExperimentalBuiltinFunctionIds(); | |
2031 return true; | 2028 return true; |
2032 } | 2029 } |
2033 | 2030 |
2034 | 2031 |
2035 static Handle<JSObject> ResolveBuiltinIdHolder( | 2032 static Handle<JSObject> ResolveBuiltinIdHolder( |
2036 Handle<Context> native_context, | 2033 Handle<Context> native_context, |
2037 const char* holder_expr) { | 2034 const char* holder_expr) { |
2038 Isolate* isolate = native_context->GetIsolate(); | 2035 Isolate* isolate = native_context->GetIsolate(); |
2039 Factory* factory = isolate->factory(); | 2036 Factory* factory = isolate->factory(); |
2040 Handle<GlobalObject> global(native_context->global_object()); | 2037 Handle<GlobalObject> global(native_context->global_object()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2072 Handle<JSObject> holder = ResolveBuiltinIdHolder( \ | 2069 Handle<JSObject> holder = ResolveBuiltinIdHolder( \ |
2073 native_context(), #holder_expr); \ | 2070 native_context(), #holder_expr); \ |
2074 BuiltinFunctionId id = k##name; \ | 2071 BuiltinFunctionId id = k##name; \ |
2075 InstallBuiltinFunctionId(holder, #fun_name, id); \ | 2072 InstallBuiltinFunctionId(holder, #fun_name, id); \ |
2076 } | 2073 } |
2077 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID) | 2074 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID) |
2078 #undef INSTALL_BUILTIN_ID | 2075 #undef INSTALL_BUILTIN_ID |
2079 } | 2076 } |
2080 | 2077 |
2081 | 2078 |
2082 void Genesis::InstallExperimentalBuiltinFunctionIds() { | |
2083 HandleScope scope(isolate()); | |
2084 if (FLAG_harmony_maths) { | |
2085 Handle<JSObject> holder = ResolveBuiltinIdHolder(native_context(), "Math"); | |
2086 InstallBuiltinFunctionId(holder, "clz32", kMathClz32); | |
2087 } | |
2088 } | |
2089 | |
2090 | |
2091 // Do not forget to update macros.py with named constant | 2079 // Do not forget to update macros.py with named constant |
2092 // of cache id. | 2080 // of cache id. |
2093 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ | 2081 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ |
2094 F(16, native_context()->regexp_function()) | 2082 F(16, native_context()->regexp_function()) |
2095 | 2083 |
2096 | 2084 |
2097 static FixedArray* CreateCache(int size, Handle<JSFunction> factory_function) { | 2085 static FixedArray* CreateCache(int size, Handle<JSFunction> factory_function) { |
2098 Factory* factory = factory_function->GetIsolate()->factory(); | 2086 Factory* factory = factory_function->GetIsolate()->factory(); |
2099 // Caches are supposed to live for a long time, allocate in old space. | 2087 // Caches are supposed to live for a long time, allocate in old space. |
2100 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size; | 2088 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size; |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2705 return from + sizeof(NestingCounterType); | 2693 return from + sizeof(NestingCounterType); |
2706 } | 2694 } |
2707 | 2695 |
2708 | 2696 |
2709 // Called when the top-level V8 mutex is destroyed. | 2697 // Called when the top-level V8 mutex is destroyed. |
2710 void Bootstrapper::FreeThreadResources() { | 2698 void Bootstrapper::FreeThreadResources() { |
2711 ASSERT(!IsActive()); | 2699 ASSERT(!IsActive()); |
2712 } | 2700 } |
2713 | 2701 |
2714 } } // namespace v8::internal | 2702 } } // namespace v8::internal |
OLD | NEW |