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

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

Issue 16271010: Use 'new' in all the snapshot reallocation functions instead of realloc. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/platform/utils.h ('k') | runtime/vm/class_table.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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 EXPECT_VALID(result); 387 EXPECT_VALID(result);
388 int64_t elapsed_time = 0; 388 int64_t elapsed_time = 0;
389 result = Dart_IntegerToInt64(result, &elapsed_time); 389 result = Dart_IntegerToInt64(result, &elapsed_time);
390 EXPECT_VALID(result); 390 EXPECT_VALID(result);
391 benchmark->set_score(elapsed_time); 391 benchmark->set_score(elapsed_time);
392 } 392 }
393 393
394 394
395 static uint8_t* malloc_allocator( 395 static uint8_t* malloc_allocator(
396 uint8_t* ptr, intptr_t old_size, intptr_t new_size) { 396 uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
397 return reinterpret_cast<uint8_t*>(realloc(ptr, new_size)); 397 return Utils::Realloc(ptr, old_size, new_size);
398 } 398 }
399 399
400 400
401 BENCHMARK(CoreSnapshotSize) { 401 BENCHMARK(CoreSnapshotSize) {
402 const char* kScriptChars = 402 const char* kScriptChars =
403 "import 'dart:async';\n" 403 "import 'dart:async';\n"
404 "import 'dart:core';\n" 404 "import 'dart:core';\n"
405 "import 'dart:collection';\n" 405 "import 'dart:collection';\n"
406 "import 'dart:_collection-dev';\n" 406 "import 'dart:_collection-dev';\n"
407 "import 'dart:math';\n" 407 "import 'dart:math';\n"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 447
448 // Write snapshot with object content. 448 // Write snapshot with object content.
449 FullSnapshotWriter writer(&buffer, &malloc_allocator); 449 FullSnapshotWriter writer(&buffer, &malloc_allocator);
450 writer.WriteFullSnapshot(); 450 writer.WriteFullSnapshot();
451 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 451 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
452 ASSERT(snapshot->kind() == Snapshot::kFull); 452 ASSERT(snapshot->kind() == Snapshot::kFull);
453 benchmark->set_score(snapshot->length()); 453 benchmark->set_score(snapshot->length());
454 } 454 }
455 455
456 } // namespace dart 456 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/platform/utils.h ('k') | runtime/vm/class_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698