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

Side by Side Diff: runtime/vm/benchmark_test.cc

Issue 270503007: Eliminate unused url mapping parameter in dartutils (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | « runtime/bin/gen_snapshot.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/benchmark_test.h" 5 #include "vm/benchmark_test.h"
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 "import 'dart:collection';\n" 431 "import 'dart:collection';\n"
432 "import 'dart:_internal';\n" 432 "import 'dart:_internal';\n"
433 "import 'dart:math';\n" 433 "import 'dart:math';\n"
434 "import 'dart:isolate';\n" 434 "import 'dart:isolate';\n"
435 "import 'dart:mirrors';\n" 435 "import 'dart:mirrors';\n"
436 "import 'dart:typed_data';\n" 436 "import 'dart:typed_data';\n"
437 "\n"; 437 "\n";
438 438
439 // Start an Isolate, load a script and create a full snapshot. 439 // Start an Isolate, load a script and create a full snapshot.
440 uint8_t* buffer; 440 uint8_t* buffer;
441 TestCase::LoadTestScript(kScriptChars, NULL); 441 // Need to load the script into the dart: core library due to
442 // the import of dart:_internal.
443 TestCase::LoadCoreTestScript(kScriptChars, NULL);
442 Api::CheckIsolateState(Isolate::Current()); 444 Api::CheckIsolateState(Isolate::Current());
443 445
444 // Write snapshot with object content. 446 // Write snapshot with object content.
445 FullSnapshotWriter writer(&buffer, &malloc_allocator); 447 FullSnapshotWriter writer(&buffer, &malloc_allocator);
446 writer.WriteFullSnapshot(); 448 writer.WriteFullSnapshot();
447 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 449 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
448 ASSERT(snapshot->kind() == Snapshot::kFull); 450 ASSERT(snapshot->kind() == Snapshot::kFull);
449 benchmark->set_score(snapshot->length()); 451 benchmark->set_score(snapshot->length());
450 } 452 }
451 453
452 454
453 BENCHMARK(StandaloneSnapshotSize) { 455 BENCHMARK(StandaloneSnapshotSize) {
454 const char* kScriptChars = 456 const char* kScriptChars =
455 "import 'dart:async';\n" 457 "import 'dart:async';\n"
456 "import 'dart:core';\n" 458 "import 'dart:core';\n"
457 "import 'dart:collection';\n" 459 "import 'dart:collection';\n"
458 "import 'dart:_internal';\n" 460 "import 'dart:_internal';\n"
459 "import 'dart:convert';\n" 461 "import 'dart:convert';\n"
460 "import 'dart:math';\n" 462 "import 'dart:math';\n"
461 "import 'dart:isolate';\n" 463 "import 'dart:isolate';\n"
462 "import 'dart:mirrors';\n" 464 "import 'dart:mirrors';\n"
463 "import 'dart:typed_data';\n" 465 "import 'dart:typed_data';\n"
464 "import 'dart:builtin';\n" 466 "import 'dart:builtin';\n"
465 "import 'dart:io';\n" 467 "import 'dart:io';\n"
466 "\n"; 468 "\n";
467 469
468 // Start an Isolate, load a script and create a full snapshot. 470 // Start an Isolate, load a script and create a full snapshot.
469 uint8_t* buffer; 471 uint8_t* buffer;
470 TestCase::LoadTestScript(kScriptChars, NULL); 472 // Need to load the script into the dart: core library due to
473 // the import of dart:_internal.
474 TestCase::LoadCoreTestScript(kScriptChars, NULL);
471 Api::CheckIsolateState(Isolate::Current()); 475 Api::CheckIsolateState(Isolate::Current());
472 476
473 // Write snapshot with object content. 477 // Write snapshot with object content.
474 FullSnapshotWriter writer(&buffer, &malloc_allocator); 478 FullSnapshotWriter writer(&buffer, &malloc_allocator);
475 writer.WriteFullSnapshot(); 479 writer.WriteFullSnapshot();
476 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 480 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
477 ASSERT(snapshot->kind() == Snapshot::kFull); 481 ASSERT(snapshot->kind() == Snapshot::kFull);
478 benchmark->set_score(snapshot->length()); 482 benchmark->set_score(snapshot->length());
479 } 483 }
480 484
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate); 591 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate);
588 reader.ReadObject(); 592 reader.ReadObject();
589 free(buffer); 593 free(buffer);
590 } 594 }
591 timer.Stop(); 595 timer.Stop();
592 int64_t elapsed_time = timer.TotalElapsedTime(); 596 int64_t elapsed_time = timer.TotalElapsedTime();
593 benchmark->set_score(elapsed_time); 597 benchmark->set_score(elapsed_time);
594 } 598 }
595 599
596 } // namespace dart 600 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/gen_snapshot.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698