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

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

Issue 10693071: Use VM type cast and save handles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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/vm/ast.cc ('k') | runtime/vm/class_finalizer.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/file.h" 7 #include "bin/file.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 10
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 const int kNumIterations = 100; 262 const int kNumIterations = 100;
263 Dart_EnterScope(); 263 Dart_EnterScope();
264 Code& code = Code::Handle(); 264 Code& code = Code::Handle();
265 Timer timer(true, "LookupDartCode benchmark"); 265 Timer timer(true, "LookupDartCode benchmark");
266 timer.Start(); 266 timer.Start();
267 for (int i = 0; i < kNumIterations; i++) { 267 for (int i = 0; i < kNumIterations; i++) {
268 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); 268 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
269 StackFrame* frame = frames.NextFrame(); 269 StackFrame* frame = frames.NextFrame();
270 while (frame != NULL) { 270 while (frame != NULL) {
271 if (frame->IsStubFrame()) { 271 if (frame->IsStubFrame()) {
272 code ^= frame->LookupDartCode(); 272 code = frame->LookupDartCode();
273 EXPECT(code.function() == Function::null()); 273 EXPECT(code.function() == Function::null());
274 } else if (frame->IsDartFrame()) { 274 } else if (frame->IsDartFrame()) {
275 code ^= frame->LookupDartCode(); 275 code = frame->LookupDartCode();
276 EXPECT(code.function() != Function::null()); 276 EXPECT(code.function() != Function::null());
277 } 277 }
278 frame = frames.NextFrame(); 278 frame = frames.NextFrame();
279 } 279 }
280 } 280 }
281 timer.Stop(); 281 timer.Stop();
282 int64_t elapsed_time = timer.TotalElapsedTime(); 282 int64_t elapsed_time = timer.TotalElapsedTime();
283 Dart_SetReturnValue(args, Dart_NewInteger(elapsed_time)); 283 Dart_SetReturnValue(args, Dart_NewInteger(elapsed_time));
284 Dart_ExitScope(); 284 Dart_ExitScope();
285 } 285 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 reinterpret_cast<Dart_NativeEntryResolver>(StackFrameNativeResolver)); 336 reinterpret_cast<Dart_NativeEntryResolver>(StackFrameNativeResolver));
337 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrameTest")); 337 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrameTest"));
338 Dart_Handle result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL); 338 Dart_Handle result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL);
339 EXPECT_VALID(result); 339 EXPECT_VALID(result);
340 int64_t elapsed_time = 0; 340 int64_t elapsed_time = 0;
341 EXPECT(!Dart_IsError(Dart_IntegerToInt64(result, &elapsed_time))); 341 EXPECT(!Dart_IsError(Dart_IntegerToInt64(result, &elapsed_time)));
342 benchmark->set_score(elapsed_time); 342 benchmark->set_score(elapsed_time);
343 } 343 }
344 344
345 } // namespace dart 345 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/ast.cc ('k') | runtime/vm/class_finalizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698