OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 398 |
399 void Shell::AddHistogramSample(void* histogram, int sample) { | 399 void Shell::AddHistogramSample(void* histogram, int sample) { |
400 Counter* counter = reinterpret_cast<Counter*>(histogram); | 400 Counter* counter = reinterpret_cast<Counter*>(histogram); |
401 counter->AddSample(sample); | 401 counter->AddSample(sample); |
402 } | 402 } |
403 | 403 |
404 | 404 |
405 void Shell::Initialize() { | 405 void Shell::Initialize() { |
406 Shell::counter_map_ = new CounterMap(); | 406 Shell::counter_map_ = new CounterMap(); |
407 // Set up counters | 407 // Set up counters |
408 if (i::FLAG_map_counters != NULL) | 408 if (i::StrLength(i::FLAG_map_counters) != 0) |
409 MapCounters(i::FLAG_map_counters); | 409 MapCounters(i::FLAG_map_counters); |
410 if (i::FLAG_dump_counters) { | 410 if (i::FLAG_dump_counters) { |
411 V8::SetCounterFunction(LookupCounter); | 411 V8::SetCounterFunction(LookupCounter); |
412 V8::SetCreateHistogramFunction(CreateHistogram); | 412 V8::SetCreateHistogramFunction(CreateHistogram); |
413 V8::SetAddHistogramSampleFunction(AddHistogramSample); | 413 V8::SetAddHistogramSampleFunction(AddHistogramSample); |
414 } | 414 } |
415 | 415 |
416 // Initialize the global objects | 416 // Initialize the global objects |
417 HandleScope scope; | 417 HandleScope scope; |
418 Handle<ObjectTemplate> global_template = ObjectTemplate::New(); | 418 Handle<ObjectTemplate> global_template = ObjectTemplate::New(); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 return 0; | 777 return 0; |
778 } | 778 } |
779 | 779 |
780 | 780 |
781 } // namespace v8 | 781 } // namespace v8 |
782 | 782 |
783 | 783 |
784 int main(int argc, char* argv[]) { | 784 int main(int argc, char* argv[]) { |
785 return v8::Shell::Main(argc, argv); | 785 return v8::Shell::Main(argc, argv); |
786 } | 786 } |
OLD | NEW |