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