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/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 // Make sure we can recognize argument objects at runtime. | 1657 // Make sure we can recognize argument objects at runtime. |
1658 // This is done by introducing an anonymous function with | 1658 // This is done by introducing an anonymous function with |
1659 // class_name equals 'Arguments'. | 1659 // class_name equals 'Arguments'. |
1660 Handle<String> arguments_string = factory->Arguments_string(); | 1660 Handle<String> arguments_string = factory->Arguments_string(); |
1661 Handle<Code> code = isolate->builtins()->Illegal(); | 1661 Handle<Code> code = isolate->builtins()->Illegal(); |
1662 Handle<JSFunction> function = factory->NewFunctionWithoutPrototype( | 1662 Handle<JSFunction> function = factory->NewFunctionWithoutPrototype( |
1663 arguments_string, code); | 1663 arguments_string, code); |
1664 function->shared()->set_instance_class_name(*arguments_string); | 1664 function->shared()->set_instance_class_name(*arguments_string); |
1665 | 1665 |
1666 Handle<Map> map = factory->NewMap( | 1666 Handle<Map> map = factory->NewMap( |
1667 JS_OBJECT_TYPE, Heap::kSloppyArgumentsObjectSize, FAST_ELEMENTS); | 1667 JS_OBJECT_TYPE, JSSloppyArgumentsObject::kSize, FAST_ELEMENTS); |
1668 // Create the descriptor array for the arguments object. | 1668 // Create the descriptor array for the arguments object. |
1669 Map::EnsureDescriptorSlack(map, 2); | 1669 Map::EnsureDescriptorSlack(map, 2); |
1670 | 1670 |
1671 { // length | 1671 { // length |
1672 DataDescriptor d(factory->length_string(), Heap::kArgumentsLengthIndex, | 1672 DataDescriptor d(factory->length_string(), |
1673 DONT_ENUM, Representation::Tagged()); | 1673 JSSloppyArgumentsObject::kLengthIndex, DONT_ENUM, |
| 1674 Representation::Tagged()); |
1674 map->AppendDescriptor(&d); | 1675 map->AppendDescriptor(&d); |
1675 } | 1676 } |
1676 { // callee | 1677 { // callee |
1677 DataDescriptor d(factory->callee_string(), Heap::kArgumentsCalleeIndex, | 1678 DataDescriptor d(factory->callee_string(), |
1678 DONT_ENUM, Representation::Tagged()); | 1679 JSSloppyArgumentsObject::kCalleeIndex, DONT_ENUM, |
| 1680 Representation::Tagged()); |
1679 map->AppendDescriptor(&d); | 1681 map->AppendDescriptor(&d); |
1680 } | 1682 } |
1681 // @@iterator method is added later. | 1683 // @@iterator method is added later. |
1682 | 1684 |
1683 map->SetInObjectProperties(2); | 1685 map->SetInObjectProperties(2); |
1684 native_context()->set_sloppy_arguments_map(*map); | 1686 native_context()->set_sloppy_arguments_map(*map); |
1685 | 1687 |
1686 DCHECK(!function->has_initial_map()); | 1688 DCHECK(!function->has_initial_map()); |
1687 JSFunction::SetInitialMap(function, map, | 1689 JSFunction::SetInitialMap(function, map, |
1688 isolate->initial_object_prototype()); | 1690 isolate->initial_object_prototype()); |
1689 | 1691 |
1690 DCHECK(map->GetInObjectProperties() > Heap::kArgumentsCalleeIndex); | |
1691 DCHECK(map->GetInObjectProperties() > Heap::kArgumentsLengthIndex); | |
1692 DCHECK(!map->is_dictionary_map()); | 1692 DCHECK(!map->is_dictionary_map()); |
1693 DCHECK(IsFastObjectElementsKind(map->elements_kind())); | 1693 DCHECK(IsFastObjectElementsKind(map->elements_kind())); |
1694 } | 1694 } |
1695 | 1695 |
1696 { // --- fast and slow aliased arguments map | 1696 { // --- fast and slow aliased arguments map |
1697 Handle<Map> map = isolate->sloppy_arguments_map(); | 1697 Handle<Map> map = isolate->sloppy_arguments_map(); |
1698 map = Map::Copy(map, "FastAliasedArguments"); | 1698 map = Map::Copy(map, "FastAliasedArguments"); |
1699 map->set_elements_kind(FAST_SLOPPY_ARGUMENTS_ELEMENTS); | 1699 map->set_elements_kind(FAST_SLOPPY_ARGUMENTS_ELEMENTS); |
1700 DCHECK_EQ(2, map->GetInObjectProperties()); | 1700 DCHECK_EQ(2, map->GetInObjectProperties()); |
1701 native_context()->set_fast_aliased_arguments_map(*map); | 1701 native_context()->set_fast_aliased_arguments_map(*map); |
(...skipping 15 matching lines...) Expand all Loading... |
1717 Handle<JSFunction> poison = GetStrictArgumentsPoisonFunction(); | 1717 Handle<JSFunction> poison = GetStrictArgumentsPoisonFunction(); |
1718 | 1718 |
1719 // Install the ThrowTypeError functions. | 1719 // Install the ThrowTypeError functions. |
1720 callee->set_getter(*poison); | 1720 callee->set_getter(*poison); |
1721 callee->set_setter(*poison); | 1721 callee->set_setter(*poison); |
1722 caller->set_getter(*poison); | 1722 caller->set_getter(*poison); |
1723 caller->set_setter(*poison); | 1723 caller->set_setter(*poison); |
1724 | 1724 |
1725 // Create the map. Allocate one in-object field for length. | 1725 // Create the map. Allocate one in-object field for length. |
1726 Handle<Map> map = factory->NewMap( | 1726 Handle<Map> map = factory->NewMap( |
1727 JS_OBJECT_TYPE, Heap::kStrictArgumentsObjectSize, FAST_ELEMENTS); | 1727 JS_OBJECT_TYPE, JSStrictArgumentsObject::kSize, FAST_ELEMENTS); |
1728 // Create the descriptor array for the arguments object. | 1728 // Create the descriptor array for the arguments object. |
1729 Map::EnsureDescriptorSlack(map, 3); | 1729 Map::EnsureDescriptorSlack(map, 3); |
1730 | 1730 |
1731 { // length | 1731 { // length |
1732 DataDescriptor d(factory->length_string(), Heap::kArgumentsLengthIndex, | 1732 DataDescriptor d(factory->length_string(), |
1733 DONT_ENUM, Representation::Tagged()); | 1733 JSStrictArgumentsObject::kLengthIndex, DONT_ENUM, |
| 1734 Representation::Tagged()); |
1734 map->AppendDescriptor(&d); | 1735 map->AppendDescriptor(&d); |
1735 } | 1736 } |
1736 { // callee | 1737 { // callee |
1737 AccessorConstantDescriptor d(factory->callee_string(), callee, | 1738 AccessorConstantDescriptor d(factory->callee_string(), callee, |
1738 attributes); | 1739 attributes); |
1739 map->AppendDescriptor(&d); | 1740 map->AppendDescriptor(&d); |
1740 } | 1741 } |
1741 { // caller | 1742 { // caller |
1742 AccessorConstantDescriptor d(factory->caller_string(), caller, | 1743 AccessorConstantDescriptor d(factory->caller_string(), caller, |
1743 attributes); | 1744 attributes); |
1744 map->AppendDescriptor(&d); | 1745 map->AppendDescriptor(&d); |
1745 } | 1746 } |
1746 // @@iterator method is added later. | 1747 // @@iterator method is added later. |
1747 | 1748 |
1748 DCHECK_EQ(native_context()->object_function()->prototype(), | 1749 DCHECK_EQ(native_context()->object_function()->prototype(), |
1749 *isolate->initial_object_prototype()); | 1750 *isolate->initial_object_prototype()); |
1750 Map::SetPrototype(map, isolate->initial_object_prototype()); | 1751 Map::SetPrototype(map, isolate->initial_object_prototype()); |
1751 map->SetInObjectProperties(1); | 1752 map->SetInObjectProperties(1); |
1752 | 1753 |
1753 // Copy constructor from the sloppy arguments boilerplate. | 1754 // Copy constructor from the sloppy arguments boilerplate. |
1754 map->SetConstructor( | 1755 map->SetConstructor( |
1755 native_context()->sloppy_arguments_map()->GetConstructor()); | 1756 native_context()->sloppy_arguments_map()->GetConstructor()); |
1756 | 1757 |
1757 native_context()->set_strict_arguments_map(*map); | 1758 native_context()->set_strict_arguments_map(*map); |
1758 | 1759 |
1759 DCHECK(map->GetInObjectProperties() > Heap::kArgumentsLengthIndex); | |
1760 DCHECK(!map->is_dictionary_map()); | 1760 DCHECK(!map->is_dictionary_map()); |
1761 DCHECK(IsFastObjectElementsKind(map->elements_kind())); | 1761 DCHECK(IsFastObjectElementsKind(map->elements_kind())); |
1762 } | 1762 } |
1763 | 1763 |
1764 { // --- context extension | 1764 { // --- context extension |
1765 // Create a function for the context extension objects. | 1765 // Create a function for the context extension objects. |
1766 Handle<Code> code = isolate->builtins()->Illegal(); | 1766 Handle<Code> code = isolate->builtins()->Illegal(); |
1767 Handle<JSFunction> context_extension_fun = factory->NewFunction( | 1767 Handle<JSFunction> context_extension_fun = factory->NewFunction( |
1768 factory->empty_string(), code, JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 1768 factory->empty_string(), code, JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
1769 JSObject::kHeaderSize); | 1769 JSObject::kHeaderSize); |
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3651 } | 3651 } |
3652 | 3652 |
3653 | 3653 |
3654 // Called when the top-level V8 mutex is destroyed. | 3654 // Called when the top-level V8 mutex is destroyed. |
3655 void Bootstrapper::FreeThreadResources() { | 3655 void Bootstrapper::FreeThreadResources() { |
3656 DCHECK(!IsActive()); | 3656 DCHECK(!IsActive()); |
3657 } | 3657 } |
3658 | 3658 |
3659 } // namespace internal | 3659 } // namespace internal |
3660 } // namespace v8 | 3660 } // namespace v8 |
OLD | NEW |