| 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 "bootstrapper.h" | 5 #include "bootstrapper.h" |
| 6 | 6 |
| 7 #include "accessors.h" | 7 #include "accessors.h" |
| 8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
| 9 #include "natives.h" | 9 #include "natives.h" |
| 10 #include "snapshot.h" | 10 #include "snapshot.h" |
| (...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 isolate()->initial_object_prototype(), | 1675 isolate()->initial_object_prototype(), |
| 1676 Builtins::kIllegal, false, false); | 1676 Builtins::kIllegal, false, false); |
| 1677 Handle<JSObject> prototype = | 1677 Handle<JSObject> prototype = |
| 1678 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1678 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 1679 Accessors::FunctionSetPrototype(script_fun, prototype); | 1679 Accessors::FunctionSetPrototype(script_fun, prototype); |
| 1680 native_context()->set_script_function(*script_fun); | 1680 native_context()->set_script_function(*script_fun); |
| 1681 | 1681 |
| 1682 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); | 1682 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); |
| 1683 Map::EnsureDescriptorSlack(script_map, 13); | 1683 Map::EnsureDescriptorSlack(script_map, 13); |
| 1684 | 1684 |
| 1685 Handle<String> type_string(factory()->InternalizeOneByteString( | |
| 1686 STATIC_ASCII_VECTOR("type"))); | |
| 1687 Handle<Foreign> script_type(factory()->NewForeign(&Accessors::ScriptType)); | |
| 1688 Handle<String> compilation_type_string( | |
| 1689 factory()->InternalizeOneByteString( | |
| 1690 STATIC_ASCII_VECTOR("compilation_type"))); | |
| 1691 Handle<Foreign> script_compilation_type( | |
| 1692 factory()->NewForeign(&Accessors::ScriptCompilationType)); | |
| 1693 Handle<String> line_ends_string(factory()->InternalizeOneByteString( | |
| 1694 STATIC_ASCII_VECTOR("line_ends"))); | |
| 1695 Handle<Foreign> script_line_ends( | |
| 1696 factory()->NewForeign(&Accessors::ScriptLineEnds)); | |
| 1697 Handle<String> context_data_string( | |
| 1698 factory()->InternalizeOneByteString( | |
| 1699 STATIC_ASCII_VECTOR("context_data"))); | |
| 1700 Handle<Foreign> script_context_data( | |
| 1701 factory()->NewForeign(&Accessors::ScriptContextData)); | |
| 1702 Handle<String> eval_from_script_string( | |
| 1703 factory()->InternalizeOneByteString( | |
| 1704 STATIC_ASCII_VECTOR("eval_from_script"))); | |
| 1705 Handle<Foreign> script_eval_from_script( | |
| 1706 factory()->NewForeign(&Accessors::ScriptEvalFromScript)); | |
| 1707 Handle<String> eval_from_script_position_string( | |
| 1708 factory()->InternalizeOneByteString( | |
| 1709 STATIC_ASCII_VECTOR("eval_from_script_position"))); | |
| 1710 Handle<Foreign> script_eval_from_script_position( | |
| 1711 factory()->NewForeign(&Accessors::ScriptEvalFromScriptPosition)); | |
| 1712 Handle<String> eval_from_function_name_string( | |
| 1713 factory()->InternalizeOneByteString( | |
| 1714 STATIC_ASCII_VECTOR("eval_from_function_name"))); | |
| 1715 Handle<Foreign> script_eval_from_function_name( | |
| 1716 factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName)); | |
| 1717 PropertyAttributes attribs = | 1685 PropertyAttributes attribs = |
| 1718 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 1686 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 1719 | 1687 |
| 1720 Handle<AccessorInfo> script_column = | 1688 Handle<AccessorInfo> script_column = |
| 1721 Accessors::ScriptColumnOffsetInfo(isolate(), attribs); | 1689 Accessors::ScriptColumnOffsetInfo(isolate(), attribs); |
| 1722 { | 1690 { |
| 1723 CallbacksDescriptor d(Handle<Name>(Name::cast(script_column->name())), | 1691 CallbacksDescriptor d(Handle<Name>(Name::cast(script_column->name())), |
| 1724 script_column, attribs); | 1692 script_column, attribs); |
| 1725 script_map->AppendDescriptor(&d); | 1693 script_map->AppendDescriptor(&d); |
| 1726 } | 1694 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1751 } | 1719 } |
| 1752 | 1720 |
| 1753 Handle<AccessorInfo> script_source = | 1721 Handle<AccessorInfo> script_source = |
| 1754 Accessors::ScriptSourceInfo(isolate(), attribs); | 1722 Accessors::ScriptSourceInfo(isolate(), attribs); |
| 1755 { | 1723 { |
| 1756 CallbacksDescriptor d(Handle<Name>(Name::cast(script_source->name())), | 1724 CallbacksDescriptor d(Handle<Name>(Name::cast(script_source->name())), |
| 1757 script_source, attribs); | 1725 script_source, attribs); |
| 1758 script_map->AppendDescriptor(&d); | 1726 script_map->AppendDescriptor(&d); |
| 1759 } | 1727 } |
| 1760 | 1728 |
| 1729 Handle<AccessorInfo> script_type = |
| 1730 Accessors::ScriptTypeInfo(isolate(), attribs); |
| 1761 { | 1731 { |
| 1762 CallbacksDescriptor d(type_string, script_type, attribs); | 1732 CallbacksDescriptor d(Handle<Name>(Name::cast(script_type->name())), |
| 1733 script_type, attribs); |
| 1763 script_map->AppendDescriptor(&d); | 1734 script_map->AppendDescriptor(&d); |
| 1764 } | 1735 } |
| 1765 | 1736 |
| 1737 Handle<AccessorInfo> script_compilation_type = |
| 1738 Accessors::ScriptCompilationTypeInfo(isolate(), attribs); |
| 1766 { | 1739 { |
| 1767 CallbacksDescriptor d( | 1740 CallbacksDescriptor d( |
| 1768 compilation_type_string, script_compilation_type, attribs); | 1741 Handle<Name>(Name::cast(script_compilation_type->name())), |
| 1742 script_compilation_type, attribs); |
| 1769 script_map->AppendDescriptor(&d); | 1743 script_map->AppendDescriptor(&d); |
| 1770 } | 1744 } |
| 1771 | 1745 |
| 1746 Handle<AccessorInfo> script_line_ends = |
| 1747 Accessors::ScriptLineEndsInfo(isolate(), attribs); |
| 1772 { | 1748 { |
| 1773 CallbacksDescriptor d(line_ends_string, script_line_ends, attribs); | 1749 CallbacksDescriptor d(Handle<Name>(Name::cast(script_line_ends->name())), |
| 1750 script_line_ends, attribs); |
| 1774 script_map->AppendDescriptor(&d); | 1751 script_map->AppendDescriptor(&d); |
| 1775 } | 1752 } |
| 1776 | 1753 |
| 1754 Handle<AccessorInfo> script_context_data = |
| 1755 Accessors::ScriptContextDataInfo(isolate(), attribs); |
| 1777 { | 1756 { |
| 1778 CallbacksDescriptor d( | 1757 CallbacksDescriptor d( |
| 1779 context_data_string, script_context_data, attribs); | 1758 Handle<Name>(Name::cast(script_context_data->name())), |
| 1759 script_context_data, attribs); |
| 1780 script_map->AppendDescriptor(&d); | 1760 script_map->AppendDescriptor(&d); |
| 1781 } | 1761 } |
| 1782 | 1762 |
| 1763 Handle<AccessorInfo> script_eval_from_script = |
| 1764 Accessors::ScriptEvalFromScriptInfo(isolate(), attribs); |
| 1783 { | 1765 { |
| 1784 CallbacksDescriptor d( | 1766 CallbacksDescriptor d( |
| 1785 eval_from_script_string, script_eval_from_script, attribs); | 1767 Handle<Name>(Name::cast(script_eval_from_script->name())), |
| 1768 script_eval_from_script, attribs); |
| 1786 script_map->AppendDescriptor(&d); | 1769 script_map->AppendDescriptor(&d); |
| 1787 } | 1770 } |
| 1788 | 1771 |
| 1772 Handle<AccessorInfo> script_eval_from_script_position = |
| 1773 Accessors::ScriptEvalFromScriptPositionInfo(isolate(), attribs); |
| 1789 { | 1774 { |
| 1790 CallbacksDescriptor d( | 1775 CallbacksDescriptor d( |
| 1791 eval_from_script_position_string, | 1776 Handle<Name>(Name::cast(script_eval_from_script_position->name())), |
| 1792 script_eval_from_script_position, | 1777 script_eval_from_script_position, attribs); |
| 1793 attribs); | |
| 1794 script_map->AppendDescriptor(&d); | 1778 script_map->AppendDescriptor(&d); |
| 1795 } | 1779 } |
| 1796 | 1780 |
| 1781 Handle<AccessorInfo> script_eval_from_function_name = |
| 1782 Accessors::ScriptEvalFromFunctionNameInfo(isolate(), attribs); |
| 1797 { | 1783 { |
| 1798 CallbacksDescriptor d( | 1784 CallbacksDescriptor d( |
| 1799 eval_from_function_name_string, | 1785 Handle<Name>(Name::cast(script_eval_from_function_name->name())), |
| 1800 script_eval_from_function_name, | 1786 script_eval_from_function_name, attribs); |
| 1801 attribs); | |
| 1802 script_map->AppendDescriptor(&d); | 1787 script_map->AppendDescriptor(&d); |
| 1803 } | 1788 } |
| 1804 | 1789 |
| 1805 // Allocate the empty script. | 1790 // Allocate the empty script. |
| 1806 Handle<Script> script = factory()->NewScript(factory()->empty_string()); | 1791 Handle<Script> script = factory()->NewScript(factory()->empty_string()); |
| 1807 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 1792 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
| 1808 heap()->public_set_empty_script(*script); | 1793 heap()->public_set_empty_script(*script); |
| 1809 } | 1794 } |
| 1810 { | 1795 { |
| 1811 // Builtin function for OpaqueReference -- a JSValue-based object, | 1796 // Builtin function for OpaqueReference -- a JSValue-based object, |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2682 return from + sizeof(NestingCounterType); | 2667 return from + sizeof(NestingCounterType); |
| 2683 } | 2668 } |
| 2684 | 2669 |
| 2685 | 2670 |
| 2686 // Called when the top-level V8 mutex is destroyed. | 2671 // Called when the top-level V8 mutex is destroyed. |
| 2687 void Bootstrapper::FreeThreadResources() { | 2672 void Bootstrapper::FreeThreadResources() { |
| 2688 ASSERT(!IsActive()); | 2673 ASSERT(!IsActive()); |
| 2689 } | 2674 } |
| 2690 | 2675 |
| 2691 } } // namespace v8::internal | 2676 } } // namespace v8::internal |
| OLD | NEW |