| 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/api-natives.h" | 8 #include "src/api-natives.h" |
| 9 #include "src/base/utils/random-number-generator.h" | 9 #include "src/base/utils/random-number-generator.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 Handle<JSGlobalProxy> global_proxy); | 194 Handle<JSGlobalProxy> global_proxy); |
| 195 // Similarly, we want to use the global that has been created by the templates | 195 // Similarly, we want to use the global that has been created by the templates |
| 196 // passed through the API. The global from the snapshot is detached from the | 196 // passed through the API. The global from the snapshot is detached from the |
| 197 // other objects in the snapshot. | 197 // other objects in the snapshot. |
| 198 void HookUpGlobalObject(Handle<GlobalObject> global_object, | 198 void HookUpGlobalObject(Handle<GlobalObject> global_object, |
| 199 Handle<FixedArray> outdated_contexts); | 199 Handle<FixedArray> outdated_contexts); |
| 200 // New context initialization. Used for creating a context from scratch. | 200 // New context initialization. Used for creating a context from scratch. |
| 201 void InitializeGlobal(Handle<GlobalObject> global_object, | 201 void InitializeGlobal(Handle<GlobalObject> global_object, |
| 202 Handle<JSFunction> empty_function); | 202 Handle<JSFunction> empty_function); |
| 203 void InitializeExperimentalGlobal(); | 203 void InitializeExperimentalGlobal(); |
| 204 void InitializeExtrasExportsObject(); | |
| 205 // Installs the contents of the native .js files on the global objects. | 204 // Installs the contents of the native .js files on the global objects. |
| 206 // Used for creating a context from scratch. | 205 // Used for creating a context from scratch. |
| 207 void InstallNativeFunctions(); | 206 void InstallNativeFunctions(); |
| 208 void InstallExperimentalNativeFunctions(); | 207 void InstallExperimentalNativeFunctions(); |
| 209 // Typed arrays are not serializable and have to initialized afterwards. | 208 // Typed arrays are not serializable and have to initialized afterwards. |
| 210 void InitializeBuiltinTypedArrays(); | 209 void InitializeBuiltinTypedArrays(); |
| 211 | 210 |
| 212 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ | 211 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ |
| 213 void InstallNativeFunctions_##id(); \ | 212 void InstallNativeFunctions_##id(); \ |
| 214 void InitializeGlobal_##id(); | 213 void InitializeGlobal_##id(); |
| (...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 void Genesis::InitializeExperimentalGlobal() { | 1434 void Genesis::InitializeExperimentalGlobal() { |
| 1436 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 1435 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
| 1437 | 1436 |
| 1438 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 1437 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
| 1439 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 1438 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
| 1440 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | 1439 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
| 1441 #undef FEATURE_INITIALIZE_GLOBAL | 1440 #undef FEATURE_INITIALIZE_GLOBAL |
| 1442 } | 1441 } |
| 1443 | 1442 |
| 1444 | 1443 |
| 1445 void Genesis::InitializeExtrasExportsObject() { | |
| 1446 Handle<JSObject> exports = | |
| 1447 factory()->NewJSObject(isolate()->object_function(), TENURED); | |
| 1448 | |
| 1449 native_context()->set_extras_exports_object(*exports); | |
| 1450 | |
| 1451 Handle<JSBuiltinsObject> builtins(native_context()->builtins()); | |
| 1452 Handle<String> exports_string = | |
| 1453 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("extrasExports")); | |
| 1454 Runtime::SetObjectProperty(isolate(), builtins, exports_string, exports, | |
| 1455 STRICT).Assert(); | |
| 1456 } | |
| 1457 | |
| 1458 | |
| 1459 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { | 1444 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { |
| 1460 Vector<const char> name = Natives::GetScriptName(index); | 1445 Vector<const char> name = Natives::GetScriptName(index); |
| 1461 Handle<String> source_code = | 1446 Handle<String> source_code = |
| 1462 isolate->bootstrapper()->SourceLookup<Natives>(index); | 1447 isolate->bootstrapper()->SourceLookup<Natives>(index); |
| 1463 return CompileNative(isolate, name, source_code); | 1448 return CompileNative(isolate, name, source_code); |
| 1464 } | 1449 } |
| 1465 | 1450 |
| 1466 | 1451 |
| 1467 bool Genesis::CompileExperimentalBuiltin(Isolate* isolate, int index) { | 1452 bool Genesis::CompileExperimentalBuiltin(Isolate* isolate, int index) { |
| 1468 Vector<const char> name = ExperimentalNatives::GetScriptName(index); | 1453 Vector<const char> name = ExperimentalNatives::GetScriptName(index); |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2970 | 2955 |
| 2971 if (!ConfigureGlobalObjects(global_proxy_template)) return; | 2956 if (!ConfigureGlobalObjects(global_proxy_template)) return; |
| 2972 isolate->counters()->contexts_created_from_scratch()->Increment(); | 2957 isolate->counters()->contexts_created_from_scratch()->Increment(); |
| 2973 } | 2958 } |
| 2974 | 2959 |
| 2975 // Install experimental and extra natives. Do not include them into the | 2960 // Install experimental and extra natives. Do not include them into the |
| 2976 // snapshot as we should be able to turn them off at runtime. Re-installing | 2961 // snapshot as we should be able to turn them off at runtime. Re-installing |
| 2977 // them after they have already been deserialized would also fail. | 2962 // them after they have already been deserialized would also fail. |
| 2978 if (!isolate->serializer_enabled()) { | 2963 if (!isolate->serializer_enabled()) { |
| 2979 InitializeExperimentalGlobal(); | 2964 InitializeExperimentalGlobal(); |
| 2980 InitializeExtrasExportsObject(); | |
| 2981 if (!InstallExperimentalNatives()) return; | 2965 if (!InstallExperimentalNatives()) return; |
| 2982 if (!InstallExtraNatives()) return; | 2966 if (!InstallExtraNatives()) return; |
| 2983 } | 2967 } |
| 2984 | 2968 |
| 2985 // The serializer cannot serialize typed arrays. Reset those typed arrays | 2969 // The serializer cannot serialize typed arrays. Reset those typed arrays |
| 2986 // for each new context. | 2970 // for each new context. |
| 2987 InitializeBuiltinTypedArrays(); | 2971 InitializeBuiltinTypedArrays(); |
| 2988 | 2972 |
| 2989 result_ = native_context(); | 2973 result_ = native_context(); |
| 2990 } | 2974 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3012 return from + sizeof(NestingCounterType); | 2996 return from + sizeof(NestingCounterType); |
| 3013 } | 2997 } |
| 3014 | 2998 |
| 3015 | 2999 |
| 3016 // Called when the top-level V8 mutex is destroyed. | 3000 // Called when the top-level V8 mutex is destroyed. |
| 3017 void Bootstrapper::FreeThreadResources() { | 3001 void Bootstrapper::FreeThreadResources() { |
| 3018 DCHECK(!IsActive()); | 3002 DCHECK(!IsActive()); |
| 3019 } | 3003 } |
| 3020 | 3004 |
| 3021 } } // namespace v8::internal | 3005 } } // namespace v8::internal |
| OLD | NEW |