| 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 counters_in_use_ = 0; | 658 counters_in_use_ = 0; |
| 659 } | 659 } |
| 660 | 660 |
| 661 | 661 |
| 662 Counter* CounterCollection::GetNextCounter() { | 662 Counter* CounterCollection::GetNextCounter() { |
| 663 if (counters_in_use_ == kMaxCounters) return NULL; | 663 if (counters_in_use_ == kMaxCounters) return NULL; |
| 664 return &counters_[counters_in_use_++]; | 664 return &counters_[counters_in_use_++]; |
| 665 } | 665 } |
| 666 | 666 |
| 667 | 667 |
| 668 void Shell::MapCounters(const char* name) { | 668 void Shell::MapCounters(v8::Isolate* isolate, const char* name) { |
| 669 counters_file_ = i::OS::MemoryMappedFile::create( | 669 counters_file_ = i::OS::MemoryMappedFile::create( |
| 670 name, sizeof(CounterCollection), &local_counters_); | 670 name, sizeof(CounterCollection), &local_counters_); |
| 671 void* memory = (counters_file_ == NULL) ? | 671 void* memory = (counters_file_ == NULL) ? |
| 672 NULL : counters_file_->memory(); | 672 NULL : counters_file_->memory(); |
| 673 if (memory == NULL) { | 673 if (memory == NULL) { |
| 674 printf("Could not map counters file %s\n", name); | 674 printf("Could not map counters file %s\n", name); |
| 675 Exit(1); | 675 Exit(1); |
| 676 } | 676 } |
| 677 counters_ = static_cast<CounterCollection*>(memory); | 677 counters_ = static_cast<CounterCollection*>(memory); |
| 678 V8::SetCounterFunction(LookupCounter); | 678 isolate->SetCounterFunction(LookupCounter); |
| 679 V8::SetCreateHistogramFunction(CreateHistogram); | 679 isolate->SetCreateHistogramFunction(CreateHistogram); |
| 680 V8::SetAddHistogramSampleFunction(AddHistogramSample); | 680 isolate->SetAddHistogramSampleFunction(AddHistogramSample); |
| 681 } | 681 } |
| 682 | 682 |
| 683 | 683 |
| 684 int CounterMap::Hash(const char* name) { | 684 int CounterMap::Hash(const char* name) { |
| 685 int h = 0; | 685 int h = 0; |
| 686 int c; | 686 int c; |
| 687 while ((c = *name++) != 0) { | 687 while ((c = *name++) != 0) { |
| 688 h += h << 5; | 688 h += h << 5; |
| 689 h += c; | 689 h += c; |
| 690 } | 690 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 if (bz2_result != BZ_OK) { | 880 if (bz2_result != BZ_OK) { |
| 881 fprintf(stderr, "bzip error code: %d\n", bz2_result); | 881 fprintf(stderr, "bzip error code: %d\n", bz2_result); |
| 882 Exit(1); | 882 Exit(1); |
| 883 } | 883 } |
| 884 #endif | 884 #endif |
| 885 | 885 |
| 886 #ifndef V8_SHARED | 886 #ifndef V8_SHARED |
| 887 Shell::counter_map_ = new CounterMap(); | 887 Shell::counter_map_ = new CounterMap(); |
| 888 // Set up counters | 888 // Set up counters |
| 889 if (i::StrLength(i::FLAG_map_counters) != 0) | 889 if (i::StrLength(i::FLAG_map_counters) != 0) |
| 890 MapCounters(i::FLAG_map_counters); | 890 MapCounters(isolate, i::FLAG_map_counters); |
| 891 if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) { | 891 if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) { |
| 892 V8::SetCounterFunction(LookupCounter); | 892 V8::SetCounterFunction(LookupCounter); |
| 893 V8::SetCreateHistogramFunction(CreateHistogram); | 893 V8::SetCreateHistogramFunction(CreateHistogram); |
| 894 V8::SetAddHistogramSampleFunction(AddHistogramSample); | 894 V8::SetAddHistogramSampleFunction(AddHistogramSample); |
| 895 } | 895 } |
| 896 #endif // !V8_SHARED | 896 #endif // !V8_SHARED |
| 897 } | 897 } |
| 898 | 898 |
| 899 | 899 |
| 900 void Shell::InitializeDebugger(Isolate* isolate) { | 900 void Shell::InitializeDebugger(Isolate* isolate) { |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 } | 1560 } |
| 1561 | 1561 |
| 1562 } // namespace v8 | 1562 } // namespace v8 |
| 1563 | 1563 |
| 1564 | 1564 |
| 1565 #ifndef GOOGLE3 | 1565 #ifndef GOOGLE3 |
| 1566 int main(int argc, char* argv[]) { | 1566 int main(int argc, char* argv[]) { |
| 1567 return v8::Shell::Main(argc, argv); | 1567 return v8::Shell::Main(argc, argv); |
| 1568 } | 1568 } |
| 1569 #endif | 1569 #endif |
| OLD | NEW |