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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) | 228 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) |
229 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) | 229 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) |
230 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) | 230 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) |
231 #undef DECLARE_FEATURE_INITIALIZATION | 231 #undef DECLARE_FEATURE_INITIALIZATION |
232 | 232 |
233 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, | 233 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, |
234 const char* name, | 234 const char* name, |
235 ElementsKind elements_kind); | 235 ElementsKind elements_kind); |
236 bool InstallNatives(ContextType context_type); | 236 bool InstallNatives(ContextType context_type); |
237 | 237 |
238 void InstallTypedArray( | 238 void InstallTypedArray(const char* name, ElementsKind elements_kind, |
239 const char* name, | 239 Handle<JSFunction>* fun); |
240 ElementsKind elements_kind, | |
241 Handle<JSFunction>* fun, | |
242 Handle<Map>* external_map); | |
243 bool InstallExperimentalNatives(); | 240 bool InstallExperimentalNatives(); |
244 bool InstallExtraNatives(); | 241 bool InstallExtraNatives(); |
245 void InstallBuiltinFunctionIds(); | 242 void InstallBuiltinFunctionIds(); |
246 void InstallExperimentalBuiltinFunctionIds(); | 243 void InstallExperimentalBuiltinFunctionIds(); |
247 void InstallJSFunctionResultCaches(); | 244 void InstallJSFunctionResultCaches(); |
248 void InitializeNormalizedMapCaches(); | 245 void InitializeNormalizedMapCaches(); |
249 | 246 |
250 enum ExtensionTraversalState { | 247 enum ExtensionTraversalState { |
251 UNVISITED, VISITED, INSTALLED | 248 UNVISITED, VISITED, INSTALLED |
252 }; | 249 }; |
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 Handle<JSFunction> array_buffer_fun = | 1274 Handle<JSFunction> array_buffer_fun = |
1278 InstallFunction( | 1275 InstallFunction( |
1279 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE, | 1276 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE, |
1280 JSArrayBuffer::kSizeWithInternalFields, | 1277 JSArrayBuffer::kSizeWithInternalFields, |
1281 isolate->initial_object_prototype(), | 1278 isolate->initial_object_prototype(), |
1282 Builtins::kIllegal); | 1279 Builtins::kIllegal); |
1283 native_context()->set_array_buffer_fun(*array_buffer_fun); | 1280 native_context()->set_array_buffer_fun(*array_buffer_fun); |
1284 } | 1281 } |
1285 | 1282 |
1286 { // -- T y p e d A r r a y s | 1283 { // -- T y p e d A r r a y s |
1287 #define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ | 1284 #define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ |
1288 { \ | 1285 { \ |
1289 Handle<JSFunction> fun; \ | 1286 Handle<JSFunction> fun; \ |
1290 Handle<Map> external_map; \ | 1287 InstallTypedArray(#Type "Array", TYPE##_ELEMENTS, &fun); \ |
1291 InstallTypedArray(#Type "Array", \ | 1288 native_context()->set_##type##_array_fun(*fun); \ |
1292 TYPE##_ELEMENTS, \ | 1289 } |
1293 &fun, \ | |
1294 &external_map); \ | |
1295 native_context()->set_##type##_array_fun(*fun); \ | |
1296 native_context()->set_##type##_array_external_map(*external_map); \ | |
1297 } | |
1298 TYPED_ARRAYS(INSTALL_TYPED_ARRAY) | 1290 TYPED_ARRAYS(INSTALL_TYPED_ARRAY) |
1299 #undef INSTALL_TYPED_ARRAY | 1291 #undef INSTALL_TYPED_ARRAY |
1300 | 1292 |
1301 Handle<JSFunction> data_view_fun = | 1293 Handle<JSFunction> data_view_fun = |
1302 InstallFunction( | 1294 InstallFunction( |
1303 global, "DataView", JS_DATA_VIEW_TYPE, | 1295 global, "DataView", JS_DATA_VIEW_TYPE, |
1304 JSDataView::kSizeWithInternalFields, | 1296 JSDataView::kSizeWithInternalFields, |
1305 isolate->initial_object_prototype(), | 1297 isolate->initial_object_prototype(), |
1306 Builtins::kIllegal); | 1298 Builtins::kIllegal); |
1307 native_context()->set_data_view_fun(*data_view_fun); | 1299 native_context()->set_data_view_fun(*data_view_fun); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 Handle<Code>(isolate->builtins()->builtin( | 1490 Handle<Code>(isolate->builtins()->builtin( |
1499 Builtins::kHandleApiCallAsConstructor)); | 1491 Builtins::kHandleApiCallAsConstructor)); |
1500 Handle<JSFunction> delegate = factory->NewFunction( | 1492 Handle<JSFunction> delegate = factory->NewFunction( |
1501 factory->empty_string(), code, JS_OBJECT_TYPE, JSObject::kHeaderSize); | 1493 factory->empty_string(), code, JS_OBJECT_TYPE, JSObject::kHeaderSize); |
1502 native_context()->set_call_as_constructor_delegate(*delegate); | 1494 native_context()->set_call_as_constructor_delegate(*delegate); |
1503 delegate->shared()->DontAdaptArguments(); | 1495 delegate->shared()->DontAdaptArguments(); |
1504 } | 1496 } |
1505 } | 1497 } |
1506 | 1498 |
1507 | 1499 |
1508 void Genesis::InstallTypedArray( | 1500 void Genesis::InstallTypedArray(const char* name, ElementsKind elements_kind, |
1509 const char* name, | 1501 Handle<JSFunction>* fun) { |
1510 ElementsKind elements_kind, | |
1511 Handle<JSFunction>* fun, | |
1512 Handle<Map>* external_map) { | |
1513 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); | 1502 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); |
1514 Handle<JSFunction> result = InstallFunction( | 1503 Handle<JSFunction> result = InstallFunction( |
1515 global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize, | 1504 global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize, |
1516 isolate()->initial_object_prototype(), Builtins::kIllegal); | 1505 isolate()->initial_object_prototype(), Builtins::kIllegal); |
1517 | 1506 |
1518 Handle<Map> initial_map = isolate()->factory()->NewMap( | 1507 Handle<Map> initial_map = isolate()->factory()->NewMap( |
1519 JS_TYPED_ARRAY_TYPE, | 1508 JS_TYPED_ARRAY_TYPE, |
1520 JSTypedArray::kSizeWithInternalFields, | 1509 JSTypedArray::kSizeWithInternalFields, |
1521 elements_kind); | 1510 elements_kind); |
1522 JSFunction::SetInitialMap(result, initial_map, | 1511 JSFunction::SetInitialMap(result, initial_map, |
1523 handle(initial_map->prototype(), isolate())); | 1512 handle(initial_map->prototype(), isolate())); |
1524 *fun = result; | 1513 *fun = result; |
1525 | |
1526 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind); | |
1527 *external_map = Map::AsElementsKind(initial_map, external_kind); | |
1528 } | 1514 } |
1529 | 1515 |
1530 | 1516 |
1531 void Genesis::InitializeExperimentalGlobal() { | 1517 void Genesis::InitializeExperimentalGlobal() { |
1532 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 1518 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
1533 | 1519 |
1534 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 1520 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
1535 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 1521 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
1536 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | 1522 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
1537 #undef FEATURE_INITIALIZE_GLOBAL | 1523 #undef FEATURE_INITIALIZE_GLOBAL |
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3318 } | 3304 } |
3319 | 3305 |
3320 | 3306 |
3321 // Called when the top-level V8 mutex is destroyed. | 3307 // Called when the top-level V8 mutex is destroyed. |
3322 void Bootstrapper::FreeThreadResources() { | 3308 void Bootstrapper::FreeThreadResources() { |
3323 DCHECK(!IsActive()); | 3309 DCHECK(!IsActive()); |
3324 } | 3310 } |
3325 | 3311 |
3326 } // namespace internal | 3312 } // namespace internal |
3327 } // namespace v8 | 3313 } // namespace v8 |
OLD | NEW |