| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 beg = scanner.scanner_->location().beg_pos; | 203 beg = scanner.scanner_->location().beg_pos; |
| 204 end = scanner.scanner_->location().end_pos; | 204 end = scanner.scanner_->location().end_pos; |
| 205 if (dump_tokens) { | 205 if (dump_tokens) { |
| 206 tokens->push_back(TokenWithLocation(token, beg, end)); | 206 tokens->push_back(TokenWithLocation(token, beg, end)); |
| 207 } | 207 } |
| 208 } while (token != Token::EOS); | 208 } while (token != Token::EOS); |
| 209 return timer.Elapsed(); | 209 return timer.Elapsed(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 | 212 |
| 213 template<typename YYCTYPE> | 213 template<typename Char> |
| 214 TimeDelta RunExperimentalScanner(Handle<String> source, | 214 TimeDelta RunExperimentalScanner(Handle<String> source, |
| 215 Isolate* isolate, | 215 Isolate* isolate, |
| 216 Encoding encoding, | 216 Encoding encoding, |
| 217 bool dump_tokens, | 217 bool dump_tokens, |
| 218 std::vector<TokenWithLocation>* tokens, | 218 std::vector<TokenWithLocation>* tokens, |
| 219 int repeat, | 219 int repeat, |
| 220 HarmonySettings harmony_settings) { | 220 HarmonySettings harmony_settings) { |
| 221 ElapsedTimer timer; | 221 ElapsedTimer timer; |
| 222 timer.Start(); | 222 timer.Start(); |
| 223 ExperimentalScanner<YYCTYPE> scanner(source, isolate); | 223 ExperimentalScanner<Char> scanner(source, isolate); |
| 224 scanner.SetHarmonyNumericLiterals(harmony_settings.numeric_literals); | 224 scanner.SetHarmonyNumericLiterals(harmony_settings.numeric_literals); |
| 225 scanner.SetHarmonyModules(harmony_settings.modules); | 225 scanner.SetHarmonyModules(harmony_settings.modules); |
| 226 scanner.SetHarmonyScoping(harmony_settings.scoping); | 226 scanner.SetHarmonyScoping(harmony_settings.scoping); |
| 227 | 227 |
| 228 Token::Value token; | 228 Token::Value token; |
| 229 int beg, end; | 229 int beg, end; |
| 230 do { | 230 do { |
| 231 token = scanner.Next(); | 231 token = scanner.Next(); |
| 232 beg = scanner.location().beg_pos; | 232 beg = scanner.location().beg_pos; |
| 233 end = scanner.location().end_pos; | 233 end = scanner.location().end_pos; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 if (run_experimental) { | 425 if (run_experimental) { |
| 426 if (benchmark.empty()) benchmark = "Experimental"; | 426 if (benchmark.empty()) benchmark = "Experimental"; |
| 427 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), | 427 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), |
| 428 experimental_total); | 428 experimental_total); |
| 429 } | 429 } |
| 430 } | 430 } |
| 431 } | 431 } |
| 432 v8::V8::Dispose(); | 432 v8::V8::Dispose(); |
| 433 return 0; | 433 return 0; |
| 434 } | 434 } |
| OLD | NEW |