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 |
11 // with the distribution. | 11 // with the distribution. |
12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
15 // | 15 // |
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <v8.h> | 28 #include <v8.h> |
29 | 29 |
| 30 #include <cstring> |
30 #include <string> | 31 #include <string> |
31 #include <map> | 32 #include <map> |
32 | 33 |
33 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 34 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
34 #error Using compressed startup data is not supported for this sample | 35 #error Using compressed startup data is not supported for this sample |
35 #endif | 36 #endif |
36 | 37 |
37 using namespace std; | 38 using namespace std; |
38 using namespace v8; | 39 using namespace v8; |
39 | 40 |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 628 |
628 | 629 |
629 int main(int argc, char* argv[]) { | 630 int main(int argc, char* argv[]) { |
630 map<string, string> options; | 631 map<string, string> options; |
631 string file; | 632 string file; |
632 ParseOptions(argc, argv, options, &file); | 633 ParseOptions(argc, argv, options, &file); |
633 if (file.empty()) { | 634 if (file.empty()) { |
634 fprintf(stderr, "No script was specified.\n"); | 635 fprintf(stderr, "No script was specified.\n"); |
635 return 1; | 636 return 1; |
636 } | 637 } |
| 638 V8::SetFlagsFromString("--noenable_i18n", |
| 639 static_cast<int>(strlen("--noenable_i18n"))); |
637 Isolate* isolate = Isolate::GetCurrent(); | 640 Isolate* isolate = Isolate::GetCurrent(); |
638 HandleScope scope(isolate); | 641 HandleScope scope(isolate); |
639 Handle<String> source = ReadFile(file); | 642 Handle<String> source = ReadFile(file); |
640 if (source.IsEmpty()) { | 643 if (source.IsEmpty()) { |
641 fprintf(stderr, "Error reading '%s'.\n", file.c_str()); | 644 fprintf(stderr, "Error reading '%s'.\n", file.c_str()); |
642 return 1; | 645 return 1; |
643 } | 646 } |
644 JsHttpRequestProcessor processor(isolate, source); | 647 JsHttpRequestProcessor processor(isolate, source); |
645 map<string, string> output; | 648 map<string, string> output; |
646 if (!processor.Initialize(&options, &output)) { | 649 if (!processor.Initialize(&options, &output)) { |
647 fprintf(stderr, "Error initializing processor.\n"); | 650 fprintf(stderr, "Error initializing processor.\n"); |
648 return 1; | 651 return 1; |
649 } | 652 } |
650 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) | 653 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) |
651 return 1; | 654 return 1; |
652 PrintMap(&output); | 655 PrintMap(&output); |
653 } | 656 } |
OLD | NEW |