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

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

Issue 117723002: Allow the native resolver to setup whether it needs the Dart API scope to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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/include/dart_api.h ('k') | runtime/vm/bootstrap_natives.h » ('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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 result = Dart_IntegerToInt64(param1, &value1); 127 result = Dart_IntegerToInt64(param1, &value1);
128 EXPECT_VALID(result); 128 EXPECT_VALID(result);
129 EXPECT_LE(0, value1); 129 EXPECT_LE(0, value1);
130 EXPECT_LE(value1, 1000000); 130 EXPECT_LE(value1, 1000000);
131 131
132 // Return param + receiver.field. 132 // Return param + receiver.field.
133 Dart_SetReturnValue(args, Dart_NewInteger(value1 * receiver_value)); 133 Dart_SetReturnValue(args, Dart_NewInteger(value1 * receiver_value));
134 } 134 }
135 135
136 136
137 static Dart_NativeFunction bm_uda_lookup(Dart_Handle name, int argument_count) { 137 static Dart_NativeFunction bm_uda_lookup(Dart_Handle name,
138 int argument_count,
139 bool* auto_setup_scope) {
140 ASSERT(auto_setup_scope != NULL);
141 *auto_setup_scope = false;
138 const char* cstr = NULL; 142 const char* cstr = NULL;
139 Dart_Handle result = Dart_StringToCString(name, &cstr); 143 Dart_Handle result = Dart_StringToCString(name, &cstr);
140 EXPECT_VALID(result); 144 EXPECT_VALID(result);
141 if (strcmp(cstr, "init") == 0) { 145 if (strcmp(cstr, "init") == 0) {
142 return InitNativeFields; 146 return InitNativeFields;
143 } else { 147 } else {
144 return UseDartApi; 148 return UseDartApi;
145 } 149 }
146 } 150 }
147 151
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 262 }
259 return dart2js_path; 263 return dart2js_path;
260 } 264 }
261 265
262 266
263 static void func(Dart_NativeArguments args) { 267 static void func(Dart_NativeArguments args) {
264 } 268 }
265 269
266 270
267 static Dart_NativeFunction NativeResolver(Dart_Handle name, 271 static Dart_NativeFunction NativeResolver(Dart_Handle name,
268 int arg_count) { 272 int arg_count,
273 bool* auto_setup_scope) {
274 ASSERT(auto_setup_scope != NULL);
275 *auto_setup_scope = false;
269 return &func; 276 return &func;
270 } 277 }
271 278
272 279
273 BENCHMARK(Dart2JSCompileAll) { 280 BENCHMARK(Dart2JSCompileAll) {
274 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); 281 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary);
275 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); 282 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary);
276 char* dart_root = ComputeDart2JSPath(Benchmark::Executable()); 283 char* dart_root = ComputeDart2JSPath(Benchmark::Executable());
277 char* script = NULL; 284 char* script = NULL;
278 if (dart_root != NULL) { 285 if (dart_root != NULL) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 frame = frames.NextFrame(); 335 frame = frames.NextFrame();
329 } 336 }
330 } 337 }
331 timer.Stop(); 338 timer.Stop();
332 int64_t elapsed_time = timer.TotalElapsedTime(); 339 int64_t elapsed_time = timer.TotalElapsedTime();
333 Dart_SetReturnValue(args, Dart_NewInteger(elapsed_time)); 340 Dart_SetReturnValue(args, Dart_NewInteger(elapsed_time));
334 } 341 }
335 342
336 343
337 static Dart_NativeFunction StackFrameNativeResolver(Dart_Handle name, 344 static Dart_NativeFunction StackFrameNativeResolver(Dart_Handle name,
338 int arg_count) { 345 int arg_count,
346 bool* auto_setup_scope) {
347 ASSERT(auto_setup_scope != NULL);
348 *auto_setup_scope = false;
339 return &StackFrame_accessFrame; 349 return &StackFrame_accessFrame;
340 } 350 }
341 351
342 352
343 // Unit test case to verify stack frame iteration. 353 // Unit test case to verify stack frame iteration.
344 BENCHMARK(FrameLookup) { 354 BENCHMARK(FrameLookup) {
345 const char* kScriptChars = 355 const char* kScriptChars =
346 "class StackFrame {" 356 "class StackFrame {"
347 " static int accessFrame() native \"StackFrame_accessFrame\";" 357 " static int accessFrame() native \"StackFrame_accessFrame\";"
348 "} " 358 "} "
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 476
467 Timer timer(true, "currentMirrorSystem() benchmark"); 477 Timer timer(true, "currentMirrorSystem() benchmark");
468 timer.Start(); 478 timer.Start();
469 Dart_Invoke(lib, NewString("benchmark"), 0, NULL); 479 Dart_Invoke(lib, NewString("benchmark"), 0, NULL);
470 timer.Stop(); 480 timer.Stop();
471 int64_t elapsed_time = timer.TotalElapsedTime(); 481 int64_t elapsed_time = timer.TotalElapsedTime();
472 benchmark->set_score(elapsed_time); 482 benchmark->set_score(elapsed_time);
473 } 483 }
474 484
475 } // namespace dart 485 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698