| 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 "bootstrapper.h" | 5 #include "bootstrapper.h" |
| 6 | 6 |
| 7 #include "accessors.h" | 7 #include "accessors.h" |
| 8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
| 9 #include "natives.h" | 9 #include "natives.h" |
| 10 #include "snapshot.h" | 10 #include "snapshot.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // Installs the contents of the native .js files on the global objects. | 200 // Installs the contents of the native .js files on the global objects. |
| 201 // Used for creating a context from scratch. | 201 // Used for creating a context from scratch. |
| 202 void InstallNativeFunctions(); | 202 void InstallNativeFunctions(); |
| 203 void InstallExperimentalBuiltinFunctionIds(); | 203 void InstallExperimentalBuiltinFunctionIds(); |
| 204 void InstallExperimentalNativeFunctions(); | 204 void InstallExperimentalNativeFunctions(); |
| 205 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, | 205 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, |
| 206 const char* name, | 206 const char* name, |
| 207 ElementsKind elements_kind); | 207 ElementsKind elements_kind); |
| 208 bool InstallNatives(); | 208 bool InstallNatives(); |
| 209 | 209 |
| 210 Handle<JSFunction> InstallTypedArray(const char* name, | 210 void InstallTypedArray( |
| 211 ElementsKind elementsKind); | 211 const char* name, |
| 212 ElementsKind elements_kind, |
| 213 Handle<JSFunction>* fun, |
| 214 Handle<Map>* external_map); |
| 212 bool InstallExperimentalNatives(); | 215 bool InstallExperimentalNatives(); |
| 213 void InstallBuiltinFunctionIds(); | 216 void InstallBuiltinFunctionIds(); |
| 214 void InstallJSFunctionResultCaches(); | 217 void InstallJSFunctionResultCaches(); |
| 215 void InitializeNormalizedMapCaches(); | 218 void InitializeNormalizedMapCaches(); |
| 216 | 219 |
| 217 enum ExtensionTraversalState { | 220 enum ExtensionTraversalState { |
| 218 UNVISITED, VISITED, INSTALLED | 221 UNVISITED, VISITED, INSTALLED |
| 219 }; | 222 }; |
| 220 | 223 |
| 221 class ExtensionStates { | 224 class ExtensionStates { |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE, | 1035 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE, |
| 1033 JSArrayBuffer::kSizeWithInternalFields, | 1036 JSArrayBuffer::kSizeWithInternalFields, |
| 1034 isolate->initial_object_prototype(), | 1037 isolate->initial_object_prototype(), |
| 1035 Builtins::kIllegal, true, true); | 1038 Builtins::kIllegal, true, true); |
| 1036 native_context()->set_array_buffer_fun(*array_buffer_fun); | 1039 native_context()->set_array_buffer_fun(*array_buffer_fun); |
| 1037 } | 1040 } |
| 1038 | 1041 |
| 1039 { // -- T y p e d A r r a y s | 1042 { // -- T y p e d A r r a y s |
| 1040 #define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ | 1043 #define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ |
| 1041 { \ | 1044 { \ |
| 1042 Handle<JSFunction> fun = InstallTypedArray(#Type "Array", \ | 1045 Handle<JSFunction> fun; \ |
| 1043 TYPE##_ELEMENTS); \ | 1046 Handle<Map> external_map; \ |
| 1047 InstallTypedArray(#Type "Array", \ |
| 1048 TYPE##_ELEMENTS, \ |
| 1049 &fun, \ |
| 1050 &external_map); \ |
| 1044 native_context()->set_##type##_array_fun(*fun); \ | 1051 native_context()->set_##type##_array_fun(*fun); \ |
| 1052 native_context()->set_##type##_array_external_map(*external_map); \ |
| 1045 } | 1053 } |
| 1046 TYPED_ARRAYS(INSTALL_TYPED_ARRAY) | 1054 TYPED_ARRAYS(INSTALL_TYPED_ARRAY) |
| 1047 #undef INSTALL_TYPED_ARRAY | 1055 #undef INSTALL_TYPED_ARRAY |
| 1048 | 1056 |
| 1049 Handle<JSFunction> data_view_fun = | 1057 Handle<JSFunction> data_view_fun = |
| 1050 InstallFunction( | 1058 InstallFunction( |
| 1051 global, "DataView", JS_DATA_VIEW_TYPE, | 1059 global, "DataView", JS_DATA_VIEW_TYPE, |
| 1052 JSDataView::kSizeWithInternalFields, | 1060 JSDataView::kSizeWithInternalFields, |
| 1053 isolate->initial_object_prototype(), | 1061 isolate->initial_object_prototype(), |
| 1054 Builtins::kIllegal, true, true); | 1062 Builtins::kIllegal, true, true); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 native_context()->set_call_as_constructor_delegate(*delegate); | 1253 native_context()->set_call_as_constructor_delegate(*delegate); |
| 1246 delegate->shared()->DontAdaptArguments(); | 1254 delegate->shared()->DontAdaptArguments(); |
| 1247 } | 1255 } |
| 1248 | 1256 |
| 1249 // Initialize the embedder data slot. | 1257 // Initialize the embedder data slot. |
| 1250 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); | 1258 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); |
| 1251 native_context()->set_embedder_data(*embedder_data); | 1259 native_context()->set_embedder_data(*embedder_data); |
| 1252 } | 1260 } |
| 1253 | 1261 |
| 1254 | 1262 |
| 1255 Handle<JSFunction> Genesis::InstallTypedArray( | 1263 void Genesis::InstallTypedArray( |
| 1256 const char* name, ElementsKind elementsKind) { | 1264 const char* name, |
| 1265 ElementsKind elements_kind, |
| 1266 Handle<JSFunction>* fun, |
| 1267 Handle<Map>* external_map) { |
| 1257 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); | 1268 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); |
| 1258 Handle<JSFunction> result = InstallFunction(global, name, JS_TYPED_ARRAY_TYPE, | 1269 Handle<JSFunction> result = InstallFunction(global, name, JS_TYPED_ARRAY_TYPE, |
| 1259 JSTypedArray::kSize, isolate()->initial_object_prototype(), | 1270 JSTypedArray::kSize, isolate()->initial_object_prototype(), |
| 1260 Builtins::kIllegal, false, true); | 1271 Builtins::kIllegal, false, true); |
| 1261 | 1272 |
| 1262 Handle<Map> initial_map = isolate()->factory()->NewMap( | 1273 Handle<Map> initial_map = isolate()->factory()->NewMap( |
| 1263 JS_TYPED_ARRAY_TYPE, JSTypedArray::kSizeWithInternalFields, elementsKind); | 1274 JS_TYPED_ARRAY_TYPE, |
| 1275 JSTypedArray::kSizeWithInternalFields, |
| 1276 elements_kind); |
| 1264 result->set_initial_map(*initial_map); | 1277 result->set_initial_map(*initial_map); |
| 1265 initial_map->set_constructor(*result); | 1278 initial_map->set_constructor(*result); |
| 1266 return result; | 1279 *fun = result; |
| 1280 |
| 1281 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind); |
| 1282 *external_map = Map::AsElementsKind(initial_map, external_kind); |
| 1267 } | 1283 } |
| 1268 | 1284 |
| 1269 | 1285 |
| 1270 void Genesis::InitializeExperimentalGlobal() { | 1286 void Genesis::InitializeExperimentalGlobal() { |
| 1271 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); | 1287 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); |
| 1272 | 1288 |
| 1273 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no | 1289 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no |
| 1274 // longer need to live behind flags, so functions get added to the snapshot. | 1290 // longer need to live behind flags, so functions get added to the snapshot. |
| 1275 | 1291 |
| 1276 if (FLAG_harmony_symbols) { | 1292 if (FLAG_harmony_symbols) { |
| (...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2666 return from + sizeof(NestingCounterType); | 2682 return from + sizeof(NestingCounterType); |
| 2667 } | 2683 } |
| 2668 | 2684 |
| 2669 | 2685 |
| 2670 // Called when the top-level V8 mutex is destroyed. | 2686 // Called when the top-level V8 mutex is destroyed. |
| 2671 void Bootstrapper::FreeThreadResources() { | 2687 void Bootstrapper::FreeThreadResources() { |
| 2672 ASSERT(!IsActive()); | 2688 ASSERT(!IsActive()); |
| 2673 } | 2689 } |
| 2674 | 2690 |
| 2675 } } // namespace v8::internal | 2691 } } // namespace v8::internal |
| OLD | NEW |