Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: src/d8.cc

Issue 782573002: Sketch of on demand snapshot generation for d8 Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add bits needed by the Chrome implementation Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | src/mksnapshot.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 5
6 // Defined when linking against shared lib on Windows. 6 // Defined when linking against shared lib on Windows.
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED)
8 #define V8_SHARED 8 #define V8_SHARED
9 #endif 9 #endif
10 10
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 const char* snapshot_blob) { 1558 const char* snapshot_blob) {
1559 Load(natives_blob, &natives_, v8::V8::SetNativesDataBlob); 1559 Load(natives_blob, &natives_, v8::V8::SetNativesDataBlob);
1560 Load(snapshot_blob, &snapshot_, v8::V8::SetSnapshotDataBlob); 1560 Load(snapshot_blob, &snapshot_, v8::V8::SetSnapshotDataBlob);
1561 } 1561 }
1562 1562
1563 ~StartupDataHandler() { 1563 ~StartupDataHandler() {
1564 delete[] natives_.data; 1564 delete[] natives_.data;
1565 delete[] snapshot_.data; 1565 delete[] snapshot_.data;
1566 } 1566 }
1567 1567
1568 void SetSnapshotOnly(const char* snapshot_blob) {
1569 Load(snapshot_blob, &snapshot_, v8::V8::SetSnapshotDataBlob);
1570 }
1571
1572
1568 private: 1573 private:
1569 void Load(const char* blob_file, 1574 void Load(const char* blob_file,
1570 v8::StartupData* startup_data, 1575 v8::StartupData* startup_data,
1571 void (*setter_fn)(v8::StartupData*)) { 1576 void (*setter_fn)(v8::StartupData*)) {
1572 startup_data->data = NULL; 1577 startup_data->data = NULL;
1573 startup_data->raw_size = 0; 1578 startup_data->raw_size = 0;
1574 1579
1575 if (!blob_file) 1580 if (!blob_file)
1576 return; 1581 return;
1577 1582
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); 1617 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
1613 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); 1618 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
1614 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); 1619 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
1615 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); 1620 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
1616 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); 1621 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
1617 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); 1622 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
1618 _set_error_mode(_OUT_TO_STDERR); 1623 _set_error_mode(_OUT_TO_STDERR);
1619 #endif // defined(_MSC_VER) 1624 #endif // defined(_MSC_VER)
1620 #endif // defined(_WIN32) || defined(_WIN64) 1625 #endif // defined(_WIN32) || defined(_WIN64)
1621 if (!SetOptions(argc, argv)) return 1; 1626 if (!SetOptions(argc, argv)) return 1;
1627
1628 i::FLAG_harmony_shipping = false;
1629 i::FLAG_random_seed = 314159265;
1630
1631 i::CpuFeatures::Probe(true);
1622 v8::V8::InitializeICU(options.icu_data_file); 1632 v8::V8::InitializeICU(options.icu_data_file);
1623 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); 1633 v8::Platform* platform = v8::platform::CreateDefaultPlatform();
1624 v8::V8::InitializePlatform(platform); 1634 v8::V8::InitializePlatform(platform);
1625 v8::V8::Initialize(); 1635 v8::V8::Initialize();
1626 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 1636 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
1627 StartupDataHandler startup_data(options.natives_blob, options.snapshot_blob); 1637 StartupDataHandler startup_data(options.natives_blob, options.snapshot_blob);
1628 #endif 1638 #endif
1629 SetFlagsFromString("--trace-hydrogen-file=hydrogen.cfg"); 1639 SetFlagsFromString("--trace-hydrogen-file=hydrogen.cfg");
1630 SetFlagsFromString("--trace-turbo-cfg-file=turbo.cfg"); 1640 SetFlagsFromString("--trace-turbo-cfg-file=turbo.cfg");
1631 SetFlagsFromString("--redirect-code-traces-to=code.asm"); 1641 SetFlagsFromString("--redirect-code-traces-to=code.asm");
(...skipping 13 matching lines...) Expand all
1645 #endif 1655 #endif
1646 #ifdef ENABLE_VTUNE_JIT_INTERFACE 1656 #ifdef ENABLE_VTUNE_JIT_INTERFACE
1647 create_params.code_event_handler = vTune::GetVtuneCodeEventHandler(); 1657 create_params.code_event_handler = vTune::GetVtuneCodeEventHandler();
1648 #endif 1658 #endif
1649 #ifndef V8_SHARED 1659 #ifndef V8_SHARED
1650 create_params.constraints.ConfigureDefaults( 1660 create_params.constraints.ConfigureDefaults(
1651 base::SysInfo::AmountOfPhysicalMemory(), 1661 base::SysInfo::AmountOfPhysicalMemory(),
1652 base::SysInfo::AmountOfVirtualMemory(), 1662 base::SysInfo::AmountOfVirtualMemory(),
1653 base::SysInfo::NumberOfProcessors()); 1663 base::SysInfo::NumberOfProcessors());
1654 #endif 1664 #endif
1665 i::FLAG_logfile_per_isolate = false;
1666 create_params.enable_serializer = true;
1655 Isolate* isolate = Isolate::New(create_params); 1667 Isolate* isolate = Isolate::New(create_params);
1668 v8::V8::CreateSnapshotFromHeap(isolate, NULL, NULL, "snapshot.bin", NULL,
1669 "snapshot.cc");
1670 startup_data.SetSnapshotOnly("snapshot.bin");
1656 DumbLineEditor dumb_line_editor(isolate); 1671 DumbLineEditor dumb_line_editor(isolate);
1657 { 1672 {
1658 Isolate::Scope scope(isolate); 1673 Isolate::Scope scope(isolate);
1659 Initialize(isolate); 1674 Initialize(isolate);
1660 PerIsolateData data(isolate); 1675 PerIsolateData data(isolate);
1661 InitializeDebugger(isolate); 1676 InitializeDebugger(isolate);
1662 1677
1663 #ifndef V8_SHARED 1678 #ifndef V8_SHARED
1664 if (options.dump_heap_constants) { 1679 if (options.dump_heap_constants) {
1665 DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate)); 1680 DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 } 1737 }
1723 1738
1724 } // namespace v8 1739 } // namespace v8
1725 1740
1726 1741
1727 #ifndef GOOGLE3 1742 #ifndef GOOGLE3
1728 int main(int argc, char* argv[]) { 1743 int main(int argc, char* argv[]) {
1729 return v8::Shell::Main(argc, argv); 1744 return v8::Shell::Main(argc, argv);
1730 } 1745 }
1731 #endif 1746 #endif
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/mksnapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698