| 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); | 485 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); |
| 486 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); | 486 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); |
| 487 ASSERT(!context.IsEmpty()); | 487 ASSERT(!context.IsEmpty()); |
| 488 { | 488 { |
| 489 v8::Context::Scope scope(context); | 489 v8::Context::Scope scope(context); |
| 490 Isolate* internal_isolate = Isolate::Current(); | 490 Isolate* internal_isolate = Isolate::Current(); |
| 491 double baseline_total = 0, experimental_total = 0; | 491 double baseline_total = 0, experimental_total = 0; |
| 492 for (size_t i = 0; i < fnames.size(); i++) { | 492 for (size_t i = 0; i < fnames.size(); i++) { |
| 493 std::pair<TimeDelta, TimeDelta> times; | 493 std::pair<TimeDelta, TimeDelta> times; |
| 494 bool can_truncate = eos_test; | 494 bool can_truncate = eos_test; |
| 495 for (int truncate_by = 0; can_truncate; ++truncate_by) { | 495 int truncate_by = 0; |
| 496 do { |
| 496 times = ProcessFile(fnames[i].c_str(), | 497 times = ProcessFile(fnames[i].c_str(), |
| 497 encoding, | 498 encoding, |
| 498 internal_isolate, | 499 internal_isolate, |
| 499 run_baseline, | 500 run_baseline, |
| 500 run_experimental, | 501 run_experimental, |
| 501 print_tokens, | 502 print_tokens, |
| 502 check_tokens, | 503 check_tokens, |
| 503 break_after_illegal, | 504 break_after_illegal, |
| 504 repeat, | 505 repeat, |
| 505 harmony_settings, | 506 harmony_settings, |
| 506 truncate_by, | 507 truncate_by, |
| 507 &can_truncate); | 508 &can_truncate); |
| 508 baseline_total += times.first.InMillisecondsF(); | 509 baseline_total += times.first.InMillisecondsF(); |
| 509 experimental_total += times.second.InMillisecondsF(); | 510 experimental_total += times.second.InMillisecondsF(); |
| 510 } | 511 ++truncate_by; |
| 512 } while (can_truncate); |
| 511 } | 513 } |
| 512 if (run_baseline) { | 514 if (run_baseline) { |
| 513 printf("Baseline%s(RunTime): %.f ms\n", benchmark.c_str(), | 515 printf("Baseline%s(RunTime): %.f ms\n", benchmark.c_str(), |
| 514 baseline_total); | 516 baseline_total); |
| 515 } | 517 } |
| 516 if (run_experimental) { | 518 if (run_experimental) { |
| 517 if (benchmark.empty()) benchmark = "Experimental"; | 519 if (benchmark.empty()) benchmark = "Experimental"; |
| 518 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), | 520 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), |
| 519 experimental_total); | 521 experimental_total); |
| 520 } | 522 } |
| 521 } | 523 } |
| 522 } | 524 } |
| 523 v8::V8::Dispose(); | 525 v8::V8::Dispose(); |
| 524 return 0; | 526 return 0; |
| 525 } | 527 } |
| OLD | NEW |