OLD | NEW |
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 BENCHMARK(StandaloneSnapshotSize) { | 427 BENCHMARK(StandaloneSnapshotSize) { |
428 const char* kScriptChars = | 428 const char* kScriptChars = |
429 "import 'dart:async';\n" | 429 "import 'dart:async';\n" |
430 "import 'dart:core';\n" | 430 "import 'dart:core';\n" |
431 "import 'dart:collection';\n" | 431 "import 'dart:collection';\n" |
432 "import 'dart:_collection-dev';\n" | 432 "import 'dart:_collection-dev';\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 "import 'dart:uri';\n" | |
438 "import 'dart:utf';\n" | 437 "import 'dart:utf';\n" |
439 "import 'dart:json';\n" | 438 "import 'dart:json';\n" |
440 "import 'dart:crypto';\n" | 439 "import 'dart:crypto';\n" |
441 "import 'dart:builtin';\n" | 440 "import 'dart:builtin';\n" |
442 "import 'dart:io';\n" | 441 "import 'dart:io';\n" |
443 "\n"; | 442 "\n"; |
444 | 443 |
445 // Start an Isolate, load a script and create a full snapshot. | 444 // Start an Isolate, load a script and create a full snapshot. |
446 uint8_t* buffer; | 445 uint8_t* buffer; |
447 TestCase::LoadTestScript(kScriptChars, NULL); | 446 TestCase::LoadTestScript(kScriptChars, NULL); |
448 Api::CheckIsolateState(Isolate::Current()); | 447 Api::CheckIsolateState(Isolate::Current()); |
449 | 448 |
450 // Write snapshot with object content. | 449 // Write snapshot with object content. |
451 FullSnapshotWriter writer(&buffer, &malloc_allocator); | 450 FullSnapshotWriter writer(&buffer, &malloc_allocator); |
452 writer.WriteFullSnapshot(); | 451 writer.WriteFullSnapshot(); |
453 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); | 452 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); |
454 ASSERT(snapshot->kind() == Snapshot::kFull); | 453 ASSERT(snapshot->kind() == Snapshot::kFull); |
455 benchmark->set_score(snapshot->length()); | 454 benchmark->set_score(snapshot->length()); |
456 } | 455 } |
457 | 456 |
458 } // namespace dart | 457 } // namespace dart |
OLD | NEW |