| 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 480 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
| 481 prototype, ro_attribs); | 481 prototype, ro_attribs); |
| 482 map->AppendDescriptor(&d); | 482 map->AppendDescriptor(&d); |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 | 485 |
| 486 | 486 |
| 487 Handle<Map> Genesis::CreateSloppyFunctionMap(FunctionMode function_mode) { | 487 Handle<Map> Genesis::CreateSloppyFunctionMap(FunctionMode function_mode) { |
| 488 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 488 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); |
| 489 SetFunctionInstanceDescriptor(map, function_mode); | 489 SetFunctionInstanceDescriptor(map, function_mode); |
| 490 map->set_function_with_prototype(IsFunctionModeWithPrototype(function_mode)); | 490 map->set_is_constructor(IsFunctionModeWithPrototype(function_mode)); |
| 491 map->set_is_callable(); | 491 map->set_is_callable(); |
| 492 return map; | 492 return map; |
| 493 } | 493 } |
| 494 | 494 |
| 495 | 495 |
| 496 Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) { | 496 Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) { |
| 497 // Allocate the map for function instances. Maps are allocated first and their | 497 // Allocate the map for function instances. Maps are allocated first and their |
| 498 // prototypes patched later, once empty function is created. | 498 // prototypes patched later, once empty function is created. |
| 499 | 499 |
| 500 // Functions with this map will not have a 'prototype' property, and | 500 // Functions with this map will not have a 'prototype' property, and |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 Builtins::kRestrictedStrictArgumentsPropertiesThrower); | 720 Builtins::kRestrictedStrictArgumentsPropertiesThrower); |
| 721 } | 721 } |
| 722 return strict_poison_function_; | 722 return strict_poison_function_; |
| 723 } | 723 } |
| 724 | 724 |
| 725 | 725 |
| 726 Handle<Map> Genesis::CreateStrictFunctionMap( | 726 Handle<Map> Genesis::CreateStrictFunctionMap( |
| 727 FunctionMode function_mode, Handle<JSFunction> empty_function) { | 727 FunctionMode function_mode, Handle<JSFunction> empty_function) { |
| 728 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 728 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); |
| 729 SetStrictFunctionInstanceDescriptor(map, function_mode); | 729 SetStrictFunctionInstanceDescriptor(map, function_mode); |
| 730 map->set_function_with_prototype(IsFunctionModeWithPrototype(function_mode)); | 730 map->set_is_constructor(IsFunctionModeWithPrototype(function_mode)); |
| 731 map->set_is_callable(); | 731 map->set_is_callable(); |
| 732 Map::SetPrototype(map, empty_function); | 732 Map::SetPrototype(map, empty_function); |
| 733 return map; | 733 return map; |
| 734 } | 734 } |
| 735 | 735 |
| 736 | 736 |
| 737 Handle<Map> Genesis::CreateStrongFunctionMap( | 737 Handle<Map> Genesis::CreateStrongFunctionMap( |
| 738 Handle<JSFunction> empty_function, bool is_constructor) { | 738 Handle<JSFunction> empty_function, bool is_constructor) { |
| 739 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 739 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); |
| 740 SetStrongFunctionInstanceDescriptor(map); | 740 SetStrongFunctionInstanceDescriptor(map); |
| 741 map->set_function_with_prototype(is_constructor); | 741 map->set_is_constructor(is_constructor); |
| 742 Map::SetPrototype(map, empty_function); | 742 Map::SetPrototype(map, empty_function); |
| 743 map->set_is_callable(); | 743 map->set_is_callable(); |
| 744 map->set_is_extensible(is_constructor); | 744 map->set_is_extensible(is_constructor); |
| 745 map->set_is_strong(); | 745 map->set_is_strong(); |
| 746 return map; | 746 return map; |
| 747 } | 747 } |
| 748 | 748 |
| 749 | 749 |
| 750 void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) { | 750 void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) { |
| 751 // Allocate map for the prototype-less strict mode instances. | 751 // Allocate map for the prototype-less strict mode instances. |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 DONT_ENUM, Representation::Tagged()); | 1366 DONT_ENUM, Representation::Tagged()); |
| 1367 map->AppendDescriptor(&d); | 1367 map->AppendDescriptor(&d); |
| 1368 } | 1368 } |
| 1369 { // callee | 1369 { // callee |
| 1370 DataDescriptor d(factory->callee_string(), Heap::kArgumentsCalleeIndex, | 1370 DataDescriptor d(factory->callee_string(), Heap::kArgumentsCalleeIndex, |
| 1371 DONT_ENUM, Representation::Tagged()); | 1371 DONT_ENUM, Representation::Tagged()); |
| 1372 map->AppendDescriptor(&d); | 1372 map->AppendDescriptor(&d); |
| 1373 } | 1373 } |
| 1374 // @@iterator method is added later. | 1374 // @@iterator method is added later. |
| 1375 | 1375 |
| 1376 map->set_function_with_prototype(true); | |
| 1377 map->SetInObjectProperties(2); | 1376 map->SetInObjectProperties(2); |
| 1378 native_context()->set_sloppy_arguments_map(*map); | 1377 native_context()->set_sloppy_arguments_map(*map); |
| 1379 | 1378 |
| 1380 DCHECK(!function->has_initial_map()); | 1379 DCHECK(!function->has_initial_map()); |
| 1381 JSFunction::SetInitialMap(function, map, | 1380 JSFunction::SetInitialMap(function, map, |
| 1382 isolate->initial_object_prototype()); | 1381 isolate->initial_object_prototype()); |
| 1383 | 1382 |
| 1384 DCHECK(map->GetInObjectProperties() > Heap::kArgumentsCalleeIndex); | 1383 DCHECK(map->GetInObjectProperties() > Heap::kArgumentsCalleeIndex); |
| 1385 DCHECK(map->GetInObjectProperties() > Heap::kArgumentsLengthIndex); | 1384 DCHECK(map->GetInObjectProperties() > Heap::kArgumentsLengthIndex); |
| 1386 DCHECK(!map->is_dictionary_map()); | 1385 DCHECK(!map->is_dictionary_map()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 attributes); | 1431 attributes); |
| 1433 map->AppendDescriptor(&d); | 1432 map->AppendDescriptor(&d); |
| 1434 } | 1433 } |
| 1435 { // caller | 1434 { // caller |
| 1436 AccessorConstantDescriptor d(factory->caller_string(), caller, | 1435 AccessorConstantDescriptor d(factory->caller_string(), caller, |
| 1437 attributes); | 1436 attributes); |
| 1438 map->AppendDescriptor(&d); | 1437 map->AppendDescriptor(&d); |
| 1439 } | 1438 } |
| 1440 // @@iterator method is added later. | 1439 // @@iterator method is added later. |
| 1441 | 1440 |
| 1442 map->set_function_with_prototype(true); | |
| 1443 DCHECK_EQ(native_context()->object_function()->prototype(), | 1441 DCHECK_EQ(native_context()->object_function()->prototype(), |
| 1444 *isolate->initial_object_prototype()); | 1442 *isolate->initial_object_prototype()); |
| 1445 Map::SetPrototype(map, isolate->initial_object_prototype()); | 1443 Map::SetPrototype(map, isolate->initial_object_prototype()); |
| 1446 map->SetInObjectProperties(1); | 1444 map->SetInObjectProperties(1); |
| 1447 | 1445 |
| 1448 // Copy constructor from the sloppy arguments boilerplate. | 1446 // Copy constructor from the sloppy arguments boilerplate. |
| 1449 map->SetConstructor( | 1447 map->SetConstructor( |
| 1450 native_context()->sloppy_arguments_map()->GetConstructor()); | 1448 native_context()->sloppy_arguments_map()->GetConstructor()); |
| 1451 | 1449 |
| 1452 native_context()->set_strict_arguments_map(*map); | 1450 native_context()->set_strict_arguments_map(*map); |
| (...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3266 } | 3264 } |
| 3267 | 3265 |
| 3268 | 3266 |
| 3269 // Called when the top-level V8 mutex is destroyed. | 3267 // Called when the top-level V8 mutex is destroyed. |
| 3270 void Bootstrapper::FreeThreadResources() { | 3268 void Bootstrapper::FreeThreadResources() { |
| 3271 DCHECK(!IsActive()); | 3269 DCHECK(!IsActive()); |
| 3272 } | 3270 } |
| 3273 | 3271 |
| 3274 } // namespace internal | 3272 } // namespace internal |
| 3275 } // namespace v8 | 3273 } // namespace v8 |
| OLD | NEW |