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

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

Issue 23453035: 1. Add flag --trace-api to trace API function invocation (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
« runtime/vm/native_arguments.h ('K') | « runtime/vm/native_entry.h ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/native_entry.h" 5 #include "vm/native_entry.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_state.h" 10 #include "vm/dart_api_state.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 void NativeEntry::NativeCallWrapper(Dart_NativeArguments args, 46 void NativeEntry::NativeCallWrapper(Dart_NativeArguments args,
47 Dart_NativeFunction func) { 47 Dart_NativeFunction func) {
48 CHECK_STACK_ALIGNMENT; 48 CHECK_STACK_ALIGNMENT;
49 VERIFY_ON_TRANSITION; 49 VERIFY_ON_TRANSITION;
50 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 50 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
51 Isolate* isolate = arguments->isolate(); 51 Isolate* isolate = arguments->isolate();
52 ApiState* state = isolate->api_state(); 52 ApiState* state = isolate->api_state();
53 ASSERT(state != NULL); 53 ASSERT(state != NULL);
54 ApiLocalScope* current_top_scope = state->top_scope(); 54 ApiLocalScope* current_top_scope = state->top_scope();
55 ApiLocalScope* scope = state->reusable_scope(); 55 ApiLocalScope* scope = state->reusable_scope();
56 TRACE_NATIVES("0x%" Px "", reinterpret_cast<uintptr_t>(func));
56 if (scope == NULL) { 57 if (scope == NULL) {
57 scope = new ApiLocalScope(current_top_scope, 58 scope = new ApiLocalScope(current_top_scope,
58 isolate->top_exit_frame_info()); 59 isolate->top_exit_frame_info());
59 ASSERT(scope != NULL); 60 ASSERT(scope != NULL);
60 } else { 61 } else {
61 scope->Reinit(isolate, 62 scope->Reinit(isolate,
62 current_top_scope, 63 current_top_scope,
63 isolate->top_exit_frame_info()); 64 isolate->top_exit_frame_info());
64 state->set_reusable_scope(NULL); 65 state->set_reusable_scope(NULL);
65 } 66 }
66 state->set_top_scope(scope); // New scope is now the top scope. 67 state->set_top_scope(scope); // New scope is now the top scope.
67 68
68 func(args); 69 func(args);
69 70
70 ASSERT(current_top_scope == scope->previous()); 71 ASSERT(current_top_scope == scope->previous());
71 state->set_top_scope(current_top_scope); // Reset top scope to previous. 72 state->set_top_scope(current_top_scope); // Reset top scope to previous.
72 if (state->reusable_scope() == NULL) { 73 if (state->reusable_scope() == NULL) {
73 scope->Reset(isolate); // Reset the old scope which we just exited. 74 scope->Reset(isolate); // Reset the old scope which we just exited.
74 state->set_reusable_scope(scope); 75 state->set_reusable_scope(scope);
75 } else { 76 } else {
76 ASSERT(state->reusable_scope() != scope); 77 ASSERT(state->reusable_scope() != scope);
77 delete scope; 78 delete scope;
78 } 79 }
79 DEOPTIMIZE_ALOT; 80 DEOPTIMIZE_ALOT;
80 VERIFY_ON_TRANSITION; 81 VERIFY_ON_TRANSITION;
81 } 82 }
82 83
83 } // namespace dart 84 } // namespace dart
OLDNEW
« runtime/vm/native_arguments.h ('K') | « runtime/vm/native_entry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698