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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 CreateFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); | 473 CreateFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); |
474 | 474 |
475 Factory* factory = isolate->factory(); | 475 Factory* factory = isolate->factory(); |
476 | 476 |
477 Handle<String> object_name = factory->Object_string(); | 477 Handle<String> object_name = factory->Object_string(); |
478 | 478 |
479 { // --- O b j e c t --- | 479 { // --- O b j e c t --- |
480 Handle<JSFunction> object_fun = factory->NewFunction(object_name); | 480 Handle<JSFunction> object_fun = factory->NewFunction(object_name); |
481 Handle<Map> object_function_map = | 481 Handle<Map> object_function_map = |
482 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 482 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
483 object_fun->set_initial_map(*object_function_map); | 483 JSFunction::SetInitialMap(object_fun, object_function_map); |
484 object_function_map->set_constructor(*object_fun); | |
485 object_function_map->set_unused_property_fields( | 484 object_function_map->set_unused_property_fields( |
486 JSObject::kInitialGlobalObjectUnusedPropertiesCount); | 485 JSObject::kInitialGlobalObjectUnusedPropertiesCount); |
487 | 486 |
488 native_context()->set_object_function(*object_fun); | 487 native_context()->set_object_function(*object_fun); |
489 | 488 |
490 // Allocate a new prototype for the object function. | 489 // Allocate a new prototype for the object function. |
491 Handle<JSObject> prototype = factory->NewJSObject( | 490 Handle<JSObject> prototype = factory->NewJSObject( |
492 isolate->object_function(), | 491 isolate->object_function(), |
493 TENURED); | 492 TENURED); |
494 | 493 |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 map->AppendDescriptor(&d); | 1203 map->AppendDescriptor(&d); |
1205 } | 1204 } |
1206 | 1205 |
1207 map->set_function_with_prototype(true); | 1206 map->set_function_with_prototype(true); |
1208 map->set_prototype(native_context()->object_function()->prototype()); | 1207 map->set_prototype(native_context()->object_function()->prototype()); |
1209 map->set_pre_allocated_property_fields(2); | 1208 map->set_pre_allocated_property_fields(2); |
1210 map->set_inobject_properties(2); | 1209 map->set_inobject_properties(2); |
1211 native_context()->set_sloppy_arguments_map(*map); | 1210 native_context()->set_sloppy_arguments_map(*map); |
1212 | 1211 |
1213 DCHECK(!function->has_initial_map()); | 1212 DCHECK(!function->has_initial_map()); |
1214 function->set_initial_map(*map); | 1213 JSFunction::SetInitialMap(function, map); |
1215 map->set_constructor(*function); | |
1216 | 1214 |
1217 DCHECK(map->inobject_properties() > Heap::kArgumentsCalleeIndex); | 1215 DCHECK(map->inobject_properties() > Heap::kArgumentsCalleeIndex); |
1218 DCHECK(map->inobject_properties() > Heap::kArgumentsLengthIndex); | 1216 DCHECK(map->inobject_properties() > Heap::kArgumentsLengthIndex); |
1219 DCHECK(!map->is_dictionary_map()); | 1217 DCHECK(!map->is_dictionary_map()); |
1220 DCHECK(IsFastObjectElementsKind(map->elements_kind())); | 1218 DCHECK(IsFastObjectElementsKind(map->elements_kind())); |
1221 } | 1219 } |
1222 | 1220 |
1223 { // --- aliased arguments map | 1221 { // --- aliased arguments map |
1224 Handle<Map> map = Map::Copy(isolate->sloppy_arguments_map()); | 1222 Handle<Map> map = Map::Copy(isolate->sloppy_arguments_map()); |
1225 map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS); | 1223 map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 Handle<Map>* external_map) { | 1327 Handle<Map>* external_map) { |
1330 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); | 1328 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); |
1331 Handle<JSFunction> result = InstallFunction( | 1329 Handle<JSFunction> result = InstallFunction( |
1332 global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize, | 1330 global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize, |
1333 isolate()->initial_object_prototype(), Builtins::kIllegal); | 1331 isolate()->initial_object_prototype(), Builtins::kIllegal); |
1334 | 1332 |
1335 Handle<Map> initial_map = isolate()->factory()->NewMap( | 1333 Handle<Map> initial_map = isolate()->factory()->NewMap( |
1336 JS_TYPED_ARRAY_TYPE, | 1334 JS_TYPED_ARRAY_TYPE, |
1337 JSTypedArray::kSizeWithInternalFields, | 1335 JSTypedArray::kSizeWithInternalFields, |
1338 elements_kind); | 1336 elements_kind); |
1339 result->set_initial_map(*initial_map); | 1337 JSFunction::SetInitialMap(result, initial_map); |
1340 initial_map->set_constructor(*result); | |
1341 *fun = result; | 1338 *fun = result; |
1342 | 1339 |
1343 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind); | 1340 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind); |
1344 *external_map = Map::AsElementsKind(initial_map, external_kind); | 1341 *external_map = Map::AsElementsKind(initial_map, external_kind); |
1345 } | 1342 } |
1346 | 1343 |
1347 | 1344 |
1348 void Genesis::InitializeExperimentalGlobal() { | 1345 void Genesis::InitializeExperimentalGlobal() { |
1349 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no | 1346 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no |
1350 // longer need to live behind flags, so functions get added to the snapshot. | 1347 // longer need to live behind flags, so functions get added to the snapshot. |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1651 prototype, Builtins::kInternalArrayCode); | 1648 prototype, Builtins::kInternalArrayCode); |
1652 | 1649 |
1653 InternalArrayConstructorStub internal_array_constructor_stub(isolate()); | 1650 InternalArrayConstructorStub internal_array_constructor_stub(isolate()); |
1654 Handle<Code> code = internal_array_constructor_stub.GetCode(); | 1651 Handle<Code> code = internal_array_constructor_stub.GetCode(); |
1655 array_function->shared()->set_construct_stub(*code); | 1652 array_function->shared()->set_construct_stub(*code); |
1656 array_function->shared()->DontAdaptArguments(); | 1653 array_function->shared()->DontAdaptArguments(); |
1657 | 1654 |
1658 Handle<Map> original_map(array_function->initial_map()); | 1655 Handle<Map> original_map(array_function->initial_map()); |
1659 Handle<Map> initial_map = Map::Copy(original_map); | 1656 Handle<Map> initial_map = Map::Copy(original_map); |
1660 initial_map->set_elements_kind(elements_kind); | 1657 initial_map->set_elements_kind(elements_kind); |
1661 array_function->set_initial_map(*initial_map); | 1658 JSFunction::SetInitialMap(array_function, initial_map); |
1662 | 1659 |
1663 // Make "length" magic on instances. | 1660 // Make "length" magic on instances. |
1664 Map::EnsureDescriptorSlack(initial_map, 1); | 1661 Map::EnsureDescriptorSlack(initial_map, 1); |
1665 | 1662 |
1666 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 1663 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
1667 DONT_ENUM | DONT_DELETE); | 1664 DONT_ENUM | DONT_DELETE); |
1668 | 1665 |
1669 Handle<AccessorInfo> array_length = | 1666 Handle<AccessorInfo> array_length = |
1670 Accessors::ArrayLengthInfo(isolate(), attribs); | 1667 Accessors::ArrayLengthInfo(isolate(), attribs); |
1671 { // Add length. | 1668 { // Add length. |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2698 return from + sizeof(NestingCounterType); | 2695 return from + sizeof(NestingCounterType); |
2699 } | 2696 } |
2700 | 2697 |
2701 | 2698 |
2702 // Called when the top-level V8 mutex is destroyed. | 2699 // Called when the top-level V8 mutex is destroyed. |
2703 void Bootstrapper::FreeThreadResources() { | 2700 void Bootstrapper::FreeThreadResources() { |
2704 DCHECK(!IsActive()); | 2701 DCHECK(!IsActive()); |
2705 } | 2702 } |
2706 | 2703 |
2707 } } // namespace v8::internal | 2704 } } // namespace v8::internal |
OLD | NEW |