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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 | 644 |
645 int main(int argc, char* argv[]) { | 645 int main(int argc, char* argv[]) { |
646 v8::V8::InitializeICU(); | 646 v8::V8::InitializeICU(); |
647 map<string, string> options; | 647 map<string, string> options; |
648 string file; | 648 string file; |
649 ParseOptions(argc, argv, options, &file); | 649 ParseOptions(argc, argv, options, &file); |
650 if (file.empty()) { | 650 if (file.empty()) { |
651 fprintf(stderr, "No script was specified.\n"); | 651 fprintf(stderr, "No script was specified.\n"); |
652 return 1; | 652 return 1; |
653 } | 653 } |
654 Isolate* isolate = Isolate::GetCurrent(); | 654 Isolate* isolate = Isolate::New(); |
| 655 Isolate::Scope isolate_scope(isolate); |
655 HandleScope scope(isolate); | 656 HandleScope scope(isolate); |
656 Handle<String> source = ReadFile(isolate, file); | 657 Handle<String> source = ReadFile(isolate, file); |
657 if (source.IsEmpty()) { | 658 if (source.IsEmpty()) { |
658 fprintf(stderr, "Error reading '%s'.\n", file.c_str()); | 659 fprintf(stderr, "Error reading '%s'.\n", file.c_str()); |
659 return 1; | 660 return 1; |
660 } | 661 } |
661 JsHttpRequestProcessor processor(isolate, source); | 662 JsHttpRequestProcessor processor(isolate, source); |
662 map<string, string> output; | 663 map<string, string> output; |
663 if (!processor.Initialize(&options, &output)) { | 664 if (!processor.Initialize(&options, &output)) { |
664 fprintf(stderr, "Error initializing processor.\n"); | 665 fprintf(stderr, "Error initializing processor.\n"); |
665 return 1; | 666 return 1; |
666 } | 667 } |
667 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) | 668 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) |
668 return 1; | 669 return 1; |
669 PrintMap(&output); | 670 PrintMap(&output); |
670 } | 671 } |
OLD | NEW |