| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler.h" | 38 #include "src/compiler.h" |
| 38 #include "src/scanner-character-streams.h" | 39 #include "src/scanner-character-streams.h" |
| 39 #include "tools/shell-utils.h" | 40 #include "tools/shell-utils.h" |
| 40 #include "src/parser.h" | 41 #include "src/parser.h" |
| 41 #include "src/preparse-data-format.h" | 42 #include "src/preparse-data-format.h" |
| 42 #include "src/preparse-data.h" | 43 #include "src/preparse-data.h" |
| 43 #include "src/preparser.h" | 44 #include "src/preparser.h" |
| 44 | 45 |
| 45 using namespace v8::internal; | 46 using namespace v8::internal; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 fprintf(stderr, "Parsing failed\n"); | 115 fprintf(stderr, "Parsing failed\n"); |
| 115 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta()); | 116 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta()); |
| 116 } | 117 } |
| 117 } | 118 } |
| 118 return std::make_pair(parse_time1, parse_time2); | 119 return std::make_pair(parse_time1, parse_time2); |
| 119 } | 120 } |
| 120 | 121 |
| 121 | 122 |
| 122 int main(int argc, char* argv[]) { | 123 int main(int argc, char* argv[]) { |
| 123 v8::V8::InitializeICU(); | 124 v8::V8::InitializeICU(); |
| 125 v8::Platform* platform = v8::platform::CreateDefaultPlatform( |
| 126 v8::base::OS::NumberOfProcessorsOnline()); |
| 127 v8::V8::InitializePlatform(platform); |
| 124 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); | 128 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); |
| 125 Encoding encoding = LATIN1; | 129 Encoding encoding = LATIN1; |
| 126 std::vector<std::string> fnames; | 130 std::vector<std::string> fnames; |
| 127 std::string benchmark; | 131 std::string benchmark; |
| 128 int repeat = 1; | 132 int repeat = 1; |
| 129 for (int i = 0; i < argc; ++i) { | 133 for (int i = 0; i < argc; ++i) { |
| 130 if (strcmp(argv[i], "--latin1") == 0) { | 134 if (strcmp(argv[i], "--latin1") == 0) { |
| 131 encoding = LATIN1; | 135 encoding = LATIN1; |
| 132 } else if (strcmp(argv[i], "--utf8") == 0) { | 136 } else if (strcmp(argv[i], "--utf8") == 0) { |
| 133 encoding = UTF8; | 137 encoding = UTF8; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 161 second_parse_total += time.second.InMillisecondsF(); | 165 second_parse_total += time.second.InMillisecondsF(); |
| 162 } | 166 } |
| 163 if (benchmark.empty()) benchmark = "Baseline"; | 167 if (benchmark.empty()) benchmark = "Baseline"; |
| 164 printf("%s(FirstParseRunTime): %.f ms\n", benchmark.c_str(), | 168 printf("%s(FirstParseRunTime): %.f ms\n", benchmark.c_str(), |
| 165 first_parse_total); | 169 first_parse_total); |
| 166 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), | 170 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), |
| 167 second_parse_total); | 171 second_parse_total); |
| 168 } | 172 } |
| 169 } | 173 } |
| 170 v8::V8::Dispose(); | 174 v8::V8::Dispose(); |
| 175 v8::V8::ShutdownPlatform(); |
| 176 delete platform; |
| 171 return 0; | 177 return 0; |
| 172 } | 178 } |
| OLD | NEW |