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

Side by Side Diff: runtime/bin/builtin_gen_snapshot.cc

Issue 227433004: Add runtime and native entry tags (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « runtime/bin/builtin.cc ('k') | runtime/bin/builtin_natives.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 <stdlib.h> 5 #include <stdlib.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 struct NativeEntries* entry = &(BuiltinEntries[i]); 42 struct NativeEntries* entry = &(BuiltinEntries[i]);
43 if (!strcmp(function_name, entry->name_) && 43 if (!strcmp(function_name, entry->name_) &&
44 (entry->argument_count_ == argument_count)) { 44 (entry->argument_count_ == argument_count)) {
45 return reinterpret_cast<Dart_NativeFunction>(entry->function_); 45 return reinterpret_cast<Dart_NativeFunction>(entry->function_);
46 } 46 }
47 } 47 }
48 return NULL; 48 return NULL;
49 } 49 }
50 50
51 51
52 const uint8_t* Builtin::NativeSymbol(Dart_NativeFunction nf) {
53 int num_entries = sizeof(BuiltinEntries) / sizeof(struct NativeEntries);
54 for (int i = 0; i < num_entries; i++) {
55 struct NativeEntries* entry = &(BuiltinEntries[i]);
56 if (reinterpret_cast<Dart_NativeFunction>(entry->function_) == nf) {
57 return reinterpret_cast<const uint8_t*>(entry->name_);
58 }
59 }
60 return NULL;
61 }
62
63
52 // Implementation of native functions which are used for some 64 // Implementation of native functions which are used for some
53 // test/debug functionality in standalone dart mode. 65 // test/debug functionality in standalone dart mode.
54 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { 66 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) {
55 Dart_EnterScope(); 67 Dart_EnterScope();
56 intptr_t length = 0; 68 intptr_t length = 0;
57 uint8_t* chars = NULL; 69 uint8_t* chars = NULL;
58 Dart_Handle str = Dart_GetNativeArgument(args, 0); 70 Dart_Handle str = Dart_GetNativeArgument(args, 0);
59 Dart_Handle result = Dart_StringToUTF8(str, &chars, &length); 71 Dart_Handle result = Dart_StringToUTF8(str, &chars, &length);
60 if (Dart_IsError(result)) { 72 if (Dart_IsError(result)) {
61 // TODO(turnidge): Consider propagating some errors here. What if 73 // TODO(turnidge): Consider propagating some errors here. What if
62 // an isolate gets interrupted by the embedder in the middle of 74 // an isolate gets interrupted by the embedder in the middle of
63 // Dart_StringToUTF8? We need to make sure not to swallow the 75 // Dart_StringToUTF8? We need to make sure not to swallow the
64 // interrupt. 76 // interrupt.
65 fputs(Dart_GetError(result), stdout); 77 fputs(Dart_GetError(result), stdout);
66 } else { 78 } else {
67 fwrite(chars, sizeof(*chars), length, stdout); 79 fwrite(chars, sizeof(*chars), length, stdout);
68 } 80 }
69 fputc('\n', stdout); 81 fputc('\n', stdout);
70 fflush(stdout); 82 fflush(stdout);
71 Dart_ExitScope(); 83 Dart_ExitScope();
72 } 84 }
73 85
74 } // namespace bin 86 } // namespace bin
75 } // namespace dart 87 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/builtin.cc ('k') | runtime/bin/builtin_natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698