OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 return malloc(0); | 1671 return malloc(0); |
1672 } | 1672 } |
1673 virtual void Free(void*, size_t) V8_OVERRIDE { | 1673 virtual void Free(void*, size_t) V8_OVERRIDE { |
1674 } | 1674 } |
1675 }; | 1675 }; |
1676 | 1676 |
1677 | 1677 |
1678 int Shell::Main(int argc, char* argv[]) { | 1678 int Shell::Main(int argc, char* argv[]) { |
1679 if (!SetOptions(argc, argv)) return 1; | 1679 if (!SetOptions(argc, argv)) return 1; |
1680 v8::V8::InitializeICU(options.icu_data_file); | 1680 v8::V8::InitializeICU(options.icu_data_file); |
| 1681 v8::V8::Initialize(); |
1681 #ifndef V8_SHARED | 1682 #ifndef V8_SHARED |
1682 i::FLAG_trace_hydrogen_file = "hydrogen.cfg"; | 1683 i::FLAG_trace_hydrogen_file = "hydrogen.cfg"; |
1683 i::FLAG_redirect_code_traces_to = "code.asm"; | 1684 i::FLAG_redirect_code_traces_to = "code.asm"; |
1684 #else | 1685 #else |
1685 SetStandaloneFlagsViaCommandLine(); | 1686 SetStandaloneFlagsViaCommandLine(); |
1686 #endif | 1687 #endif |
1687 ShellArrayBufferAllocator array_buffer_allocator; | 1688 ShellArrayBufferAllocator array_buffer_allocator; |
1688 MockArrayBufferAllocator mock_arraybuffer_allocator; | 1689 MockArrayBufferAllocator mock_arraybuffer_allocator; |
1689 if (options.mock_arraybuffer_allocator) { | 1690 if (options.mock_arraybuffer_allocator) { |
1690 v8::V8::SetArrayBufferAllocator(&mock_arraybuffer_allocator); | 1691 v8::V8::SetArrayBufferAllocator(&mock_arraybuffer_allocator); |
1691 } else { | 1692 } else { |
1692 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); | 1693 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); |
1693 } | 1694 } |
1694 int result = 0; | 1695 int result = 0; |
1695 Isolate* isolate = Isolate::GetCurrent(); | 1696 Isolate* isolate = Isolate::New(); |
1696 #ifndef V8_SHARED | 1697 #ifndef V8_SHARED |
1697 v8::ResourceConstraints constraints; | 1698 v8::ResourceConstraints constraints; |
1698 constraints.ConfigureDefaults(i::OS::TotalPhysicalMemory(), | 1699 constraints.ConfigureDefaults(i::OS::TotalPhysicalMemory(), |
1699 i::OS::MaxVirtualMemory(), | 1700 i::OS::MaxVirtualMemory(), |
1700 i::CPU::NumberOfProcessorsOnline()); | 1701 i::CPU::NumberOfProcessorsOnline()); |
1701 v8::SetResourceConstraints(isolate, &constraints); | 1702 v8::SetResourceConstraints(isolate, &constraints); |
1702 #endif | 1703 #endif |
1703 DumbLineEditor dumb_line_editor(isolate); | 1704 DumbLineEditor dumb_line_editor(isolate); |
1704 { | 1705 { |
1705 Initialize(isolate); | 1706 Initialize(isolate); |
| 1707 Isolate::Scope isolate_scope(isolate); |
1706 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 1708 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
1707 vTune::InitializeVtuneForV8(); | 1709 vTune::InitializeVtuneForV8(); |
1708 #endif | 1710 #endif |
1709 PerIsolateData data(isolate); | 1711 PerIsolateData data(isolate); |
1710 InitializeDebugger(isolate); | 1712 InitializeDebugger(isolate); |
1711 | 1713 |
1712 #ifndef V8_SHARED | 1714 #ifndef V8_SHARED |
1713 if (options.dump_heap_constants) { | 1715 if (options.dump_heap_constants) { |
1714 DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate)); | 1716 DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate)); |
1715 return 0; | 1717 return 0; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 if (( options.interactive_shell || !options.script_executed ) | 1760 if (( options.interactive_shell || !options.script_executed ) |
1759 && !options.test_shell ) { | 1761 && !options.test_shell ) { |
1760 #if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT) | 1762 #if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT) |
1761 if (!i::FLAG_debugger) { | 1763 if (!i::FLAG_debugger) { |
1762 InstallUtilityScript(isolate); | 1764 InstallUtilityScript(isolate); |
1763 } | 1765 } |
1764 #endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT | 1766 #endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT |
1765 RunShell(isolate); | 1767 RunShell(isolate); |
1766 } | 1768 } |
1767 } | 1769 } |
| 1770 isolate->Dispose(); |
1768 V8::Dispose(); | 1771 V8::Dispose(); |
1769 | 1772 |
1770 OnExit(); | 1773 OnExit(); |
1771 | 1774 |
1772 return result; | 1775 return result; |
1773 } | 1776 } |
1774 | 1777 |
1775 } // namespace v8 | 1778 } // namespace v8 |
1776 | 1779 |
1777 | 1780 |
1778 #ifndef GOOGLE3 | 1781 #ifndef GOOGLE3 |
1779 int main(int argc, char* argv[]) { | 1782 int main(int argc, char* argv[]) { |
1780 return v8::Shell::Main(argc, argv); | 1783 return v8::Shell::Main(argc, argv); |
1781 } | 1784 } |
1782 #endif | 1785 #endif |
OLD | NEW |