Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: src/lexer/lexer-shell.cc

Issue 130303003: Experimental parser: make lexer_shell fair. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 int repeat, 245 int repeat,
246 HarmonySettings harmony_settings) { 246 HarmonySettings harmony_settings) {
247 ElapsedTimer timer; 247 ElapsedTimer timer;
248 BaselineScanner scanner( 248 BaselineScanner scanner(
249 fname, isolate, encoding, &timer, repeat, harmony_settings); 249 fname, isolate, encoding, &timer, repeat, harmony_settings);
250 Token::Value token; 250 Token::Value token;
251 do { 251 do {
252 token = scanner.scanner_->Next(); 252 token = scanner.scanner_->Next();
253 if (dump_tokens) { 253 if (dump_tokens) {
254 tokens->push_back(GetTokenWithLocation(scanner.scanner_, token)); 254 tokens->push_back(GetTokenWithLocation(scanner.scanner_, token));
255 } else if (HasLiteral(token)) {
256 if (scanner.scanner_->is_literal_ascii()) {
257 scanner.scanner_->literal_ascii_string();
258 } else {
259 scanner.scanner_->literal_utf16_string();
260 }
255 } 261 }
256 } while (token != Token::EOS); 262 } while (token != Token::EOS);
257 return timer.Elapsed(); 263 return timer.Elapsed();
258 } 264 }
259 265
260 266
261 template<typename Char> 267 template<typename Char>
262 TimeDelta RunExperimentalScanner(Handle<String> source, 268 TimeDelta RunExperimentalScanner(Handle<String> source,
263 Isolate* isolate, 269 Isolate* isolate,
264 Encoding encoding, 270 Encoding encoding,
265 bool dump_tokens, 271 bool dump_tokens,
266 std::vector<TokenWithLocation>* tokens, 272 std::vector<TokenWithLocation>* tokens,
267 int repeat, 273 int repeat,
268 HarmonySettings harmony_settings) { 274 HarmonySettings harmony_settings) {
269 ElapsedTimer timer; 275 ElapsedTimer timer;
270 ExperimentalScanner<Char> scanner(source, isolate); 276 ExperimentalScanner<Char> scanner(source, isolate);
271 scanner.SetHarmonyNumericLiterals(harmony_settings.numeric_literals); 277 scanner.SetHarmonyNumericLiterals(harmony_settings.numeric_literals);
272 scanner.SetHarmonyModules(harmony_settings.modules); 278 scanner.SetHarmonyModules(harmony_settings.modules);
273 scanner.SetHarmonyScoping(harmony_settings.scoping); 279 scanner.SetHarmonyScoping(harmony_settings.scoping);
274 280
275 timer.Start(); 281 timer.Start();
276 scanner.Init(); 282 scanner.Init();
277 Token::Value token; 283 Token::Value token;
278 do { 284 do {
279 token = scanner.Next(); 285 token = scanner.Next();
280 if (dump_tokens) { 286 if (dump_tokens) {
281 tokens->push_back(GetTokenWithLocation(&scanner, token)); 287 tokens->push_back(GetTokenWithLocation(&scanner, token));
288 } else if (HasLiteral(token)) {
289 if (scanner.is_literal_ascii()) {
290 scanner.literal_ascii_string();
291 } else {
292 scanner.literal_utf16_string();
293 }
282 } 294 }
283 } while (token != Token::EOS); 295 } while (token != Token::EOS);
284 return timer.Elapsed(); 296 return timer.Elapsed();
285 } 297 }
286 298
287 299
288 void PrintTokens(const char* name, 300 void PrintTokens(const char* name,
289 const std::vector<TokenWithLocation>& tokens) { 301 const std::vector<TokenWithLocation>& tokens) {
290 printf("No of tokens: %d\n", 302 printf("No of tokens: %d\n",
291 static_cast<int>(tokens.size())); 303 static_cast<int>(tokens.size()));
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 if (run_experimental) { 488 if (run_experimental) {
477 if (benchmark.empty()) benchmark = "Experimental"; 489 if (benchmark.empty()) benchmark = "Experimental";
478 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), 490 printf("%s(RunTime): %.f ms\n", benchmark.c_str(),
479 experimental_total); 491 experimental_total);
480 } 492 }
481 } 493 }
482 } 494 }
483 v8::V8::Dispose(); 495 v8::V8::Dispose();
484 return 0; 496 return 0;
485 } 497 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698