OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 15 matching lines...) Expand all Loading... |
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 <assert.h> | 28 #include <assert.h> |
29 #include <string.h> | 29 #include <string.h> |
30 #include <stdio.h> | 30 #include <stdio.h> |
31 #include <stdlib.h> | 31 #include <stdlib.h> |
32 #include <string> | 32 #include <string> |
33 #include <vector> | 33 #include <vector> |
34 #include "src/v8.h" | 34 #include "src/v8.h" |
35 | 35 |
| 36 #include "include/libplatform/libplatform.h" |
36 #include "src/api.h" | 37 #include "src/api.h" |
37 #include "src/base/platform/platform.h" | 38 #include "src/base/platform/platform.h" |
38 #include "src/messages.h" | 39 #include "src/messages.h" |
39 #include "src/runtime.h" | 40 #include "src/runtime.h" |
40 #include "src/scanner-character-streams.h" | 41 #include "src/scanner-character-streams.h" |
41 #include "src/scopeinfo.h" | 42 #include "src/scopeinfo.h" |
42 #include "tools/shell-utils.h" | 43 #include "tools/shell-utils.h" |
43 #include "src/string-stream.h" | 44 #include "src/string-stream.h" |
44 #include "src/scanner.h" | 45 #include "src/scanner.h" |
45 | 46 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 &baseline_tokens, repeat); | 174 &baseline_tokens, repeat); |
174 if (print_tokens) { | 175 if (print_tokens) { |
175 PrintTokens("Baseline", baseline_tokens); | 176 PrintTokens("Baseline", baseline_tokens); |
176 } | 177 } |
177 return baseline_time; | 178 return baseline_time; |
178 } | 179 } |
179 | 180 |
180 | 181 |
181 int main(int argc, char* argv[]) { | 182 int main(int argc, char* argv[]) { |
182 v8::V8::InitializeICU(); | 183 v8::V8::InitializeICU(); |
| 184 v8::Platform* platform = v8::platform::CreateDefaultPlatform( |
| 185 v8::base::OS::NumberOfProcessorsOnline()); |
| 186 v8::V8::InitializePlatform(platform); |
183 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); | 187 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); |
184 Encoding encoding = LATIN1; | 188 Encoding encoding = LATIN1; |
185 bool print_tokens = false; | 189 bool print_tokens = false; |
186 std::vector<std::string> fnames; | 190 std::vector<std::string> fnames; |
187 std::string benchmark; | 191 std::string benchmark; |
188 int repeat = 1; | 192 int repeat = 1; |
189 for (int i = 0; i < argc; ++i) { | 193 for (int i = 0; i < argc; ++i) { |
190 if (strcmp(argv[i], "--latin1") == 0) { | 194 if (strcmp(argv[i], "--latin1") == 0) { |
191 encoding = LATIN1; | 195 encoding = LATIN1; |
192 } else if (strcmp(argv[i], "--utf8") == 0) { | 196 } else if (strcmp(argv[i], "--utf8") == 0) { |
(...skipping 26 matching lines...) Expand all Loading... |
219 time = ProcessFile(fnames[i].c_str(), encoding, | 223 time = ProcessFile(fnames[i].c_str(), encoding, |
220 reinterpret_cast<Isolate*>(isolate), print_tokens, | 224 reinterpret_cast<Isolate*>(isolate), print_tokens, |
221 repeat); | 225 repeat); |
222 baseline_total += time.InMillisecondsF(); | 226 baseline_total += time.InMillisecondsF(); |
223 } | 227 } |
224 if (benchmark.empty()) benchmark = "Baseline"; | 228 if (benchmark.empty()) benchmark = "Baseline"; |
225 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), baseline_total); | 229 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), baseline_total); |
226 } | 230 } |
227 } | 231 } |
228 v8::V8::Dispose(); | 232 v8::V8::Dispose(); |
| 233 v8::V8::ShutdownPlatform(); |
| 234 delete platform; |
229 return 0; | 235 return 0; |
230 } | 236 } |
OLD | NEW |