OLD | NEW |
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 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 Handle<ObjectTemplate> os_templ = ObjectTemplate::New(isolate); | 956 Handle<ObjectTemplate> os_templ = ObjectTemplate::New(isolate); |
957 AddOSMethods(isolate, os_templ); | 957 AddOSMethods(isolate, os_templ); |
958 global_template->Set(String::NewFromUtf8(isolate, "os"), os_templ); | 958 global_template->Set(String::NewFromUtf8(isolate, "os"), os_templ); |
959 | 959 |
960 return global_template; | 960 return global_template; |
961 } | 961 } |
962 | 962 |
963 | 963 |
964 void Shell::Initialize(Isolate* isolate) { | 964 void Shell::Initialize(Isolate* isolate) { |
965 #ifndef V8_SHARED | 965 #ifndef V8_SHARED |
966 Shell::counter_map_ = new CounterMap(); | |
967 // Set up counters | 966 // Set up counters |
968 if (i::StrLength(i::FLAG_map_counters) != 0) | 967 if (i::StrLength(i::FLAG_map_counters) != 0) |
969 MapCounters(isolate, i::FLAG_map_counters); | 968 MapCounters(isolate, i::FLAG_map_counters); |
970 if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) { | |
971 isolate->SetCounterFunction(LookupCounter); | |
972 isolate->SetCreateHistogramFunction(CreateHistogram); | |
973 isolate->SetAddHistogramSampleFunction(AddHistogramSample); | |
974 } | |
975 #endif // !V8_SHARED | 969 #endif // !V8_SHARED |
976 } | 970 } |
977 | 971 |
978 | 972 |
979 void Shell::InitializeDebugger(Isolate* isolate) { | 973 void Shell::InitializeDebugger(Isolate* isolate) { |
980 if (options.test_shell) return; | 974 if (options.test_shell) return; |
981 #ifndef V8_SHARED | 975 #ifndef V8_SHARED |
982 HandleScope scope(isolate); | 976 HandleScope scope(isolate); |
983 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); | 977 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); |
984 utility_context_.Reset(isolate, | 978 utility_context_.Reset(isolate, |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 } | 1626 } |
1633 #endif | 1627 #endif |
1634 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 1628 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
1635 create_params.code_event_handler = vTune::GetVtuneCodeEventHandler(); | 1629 create_params.code_event_handler = vTune::GetVtuneCodeEventHandler(); |
1636 #endif | 1630 #endif |
1637 #ifndef V8_SHARED | 1631 #ifndef V8_SHARED |
1638 create_params.constraints.ConfigureDefaults( | 1632 create_params.constraints.ConfigureDefaults( |
1639 base::SysInfo::AmountOfPhysicalMemory(), | 1633 base::SysInfo::AmountOfPhysicalMemory(), |
1640 base::SysInfo::AmountOfVirtualMemory(), | 1634 base::SysInfo::AmountOfVirtualMemory(), |
1641 base::SysInfo::NumberOfProcessors()); | 1635 base::SysInfo::NumberOfProcessors()); |
| 1636 |
| 1637 Shell::counter_map_ = new CounterMap(); |
| 1638 if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) { |
| 1639 create_params.counter_lookup_callback = LookupCounter; |
| 1640 create_params.create_histogram_callback = CreateHistogram; |
| 1641 create_params.add_histogram_sample_callback = AddHistogramSample; |
| 1642 } |
1642 #endif | 1643 #endif |
1643 Isolate* isolate = Isolate::New(create_params); | 1644 Isolate* isolate = Isolate::New(create_params); |
1644 DumbLineEditor dumb_line_editor(isolate); | 1645 DumbLineEditor dumb_line_editor(isolate); |
1645 { | 1646 { |
1646 Isolate::Scope scope(isolate); | 1647 Isolate::Scope scope(isolate); |
1647 Initialize(isolate); | 1648 Initialize(isolate); |
1648 PerIsolateData data(isolate); | 1649 PerIsolateData data(isolate); |
1649 InitializeDebugger(isolate); | 1650 InitializeDebugger(isolate); |
1650 | 1651 |
1651 #ifndef V8_SHARED | 1652 #ifndef V8_SHARED |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1710 } | 1711 } |
1711 | 1712 |
1712 } // namespace v8 | 1713 } // namespace v8 |
1713 | 1714 |
1714 | 1715 |
1715 #ifndef GOOGLE3 | 1716 #ifndef GOOGLE3 |
1716 int main(int argc, char* argv[]) { | 1717 int main(int argc, char* argv[]) { |
1717 return v8::Shell::Main(argc, argv); | 1718 return v8::Shell::Main(argc, argv); |
1718 } | 1719 } |
1719 #endif | 1720 #endif |
OLD | NEW |