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

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

Issue 9979016: Add a unit test Benchmark_UseDartApi to measure dart api overhead. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | runtime/vm/dart_api_impl_test.cc » ('J')
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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2912 } 2912 }
2913 2913
2914 2914
2915 // --- Native functions --- 2915 // --- Native functions ---
2916 2916
2917 2917
2918 DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, 2918 DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args,
2919 int index) { 2919 int index) {
2920 DARTSCOPE(Isolate::Current()); 2920 DARTSCOPE(Isolate::Current());
2921 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 2921 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
2922 if (index < 0 || index >= arguments->Count()) {
2923 return Api::NewError(
2924 "%s: argument 'index' out of range. Expected 0..%d but saw %d.",
2925 CURRENT_FUNC, arguments->Count() - 1, index);
2926 }
2922 const Object& obj = Object::Handle(arguments->At(index)); 2927 const Object& obj = Object::Handle(arguments->At(index));
2923 return Api::NewLocalHandle(obj); 2928 return Api::NewLocalHandle(obj);
2924 } 2929 }
2925 2930
2926 2931
2927 DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args) { 2932 DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args) {
2928 CHECK_ISOLATE(Isolate::Current()); 2933 CHECK_ISOLATE(Isolate::Current());
2929 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 2934 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
2930 return arguments->Count(); 2935 return arguments->Count();
2931 } 2936 }
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
3258 *buffer = NULL; 3263 *buffer = NULL;
3259 } 3264 }
3260 delete debug_region; 3265 delete debug_region;
3261 } else { 3266 } else {
3262 *buffer = NULL; 3267 *buffer = NULL;
3263 *buffer_size = 0; 3268 *buffer_size = 0;
3264 } 3269 }
3265 } 3270 }
3266 3271
3267 } // namespace dart 3272 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | runtime/vm/dart_api_impl_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698