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

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

Issue 1127343004: Reland r45669: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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.dart ('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
11 #include "bin/builtin.h" 11 #include "bin/builtin.h"
12 12
13 namespace dart { 13 namespace dart {
14 namespace bin { 14 namespace bin {
15 15
16 // Lists the native function implementing basic logging facility. 16 // Lists the native function implementing basic logging facility.
17 #define BUILTIN_NATIVE_LIST(V) \ 17 #define BUILTIN_NATIVE_LIST(V) \
18 V(Logger_PrintString, 1) 18 V(Builtin_PrintString, 1)
19 19
20 BUILTIN_NATIVE_LIST(DECLARE_FUNCTION); 20 BUILTIN_NATIVE_LIST(DECLARE_FUNCTION);
21 21
22 static struct NativeEntries { 22 static struct NativeEntries {
23 const char* name_; 23 const char* name_;
24 Dart_NativeFunction function_; 24 Dart_NativeFunction function_;
25 int argument_count_; 25 int argument_count_;
26 } BuiltinEntries[] = { 26 } BuiltinEntries[] = {
27 BUILTIN_NATIVE_LIST(REGISTER_FUNCTION) 27 BUILTIN_NATIVE_LIST(REGISTER_FUNCTION)
28 }; 28 };
(...skipping 27 matching lines...) Expand all
56 if (reinterpret_cast<Dart_NativeFunction>(entry->function_) == nf) { 56 if (reinterpret_cast<Dart_NativeFunction>(entry->function_) == nf) {
57 return reinterpret_cast<const uint8_t*>(entry->name_); 57 return reinterpret_cast<const uint8_t*>(entry->name_);
58 } 58 }
59 } 59 }
60 return NULL; 60 return NULL;
61 } 61 }
62 62
63 63
64 // Implementation of native functions which are used for some 64 // Implementation of native functions which are used for some
65 // test/debug functionality in standalone dart mode. 65 // test/debug functionality in standalone dart mode.
66 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { 66 void FUNCTION_NAME(Builtin_PrintString)(Dart_NativeArguments args) {
67 Dart_EnterScope(); 67 Dart_EnterScope();
68 intptr_t length = 0; 68 intptr_t length = 0;
69 uint8_t* chars = NULL; 69 uint8_t* chars = NULL;
70 Dart_Handle str = Dart_GetNativeArgument(args, 0); 70 Dart_Handle str = Dart_GetNativeArgument(args, 0);
71 Dart_Handle result = Dart_StringToUTF8(str, &chars, &length); 71 Dart_Handle result = Dart_StringToUTF8(str, &chars, &length);
72 if (Dart_IsError(result)) { 72 if (Dart_IsError(result)) {
73 // TODO(turnidge): Consider propagating some errors here. What if 73 // TODO(turnidge): Consider propagating some errors here. What if
74 // an isolate gets interrupted by the embedder in the middle of 74 // an isolate gets interrupted by the embedder in the middle of
75 // Dart_StringToUTF8? We need to make sure not to swallow the 75 // Dart_StringToUTF8? We need to make sure not to swallow the
76 // interrupt. 76 // interrupt.
77 fputs(Dart_GetError(result), stdout); 77 fputs(Dart_GetError(result), stdout);
78 } else { 78 } else {
79 fwrite(chars, sizeof(*chars), length, stdout); 79 fwrite(chars, sizeof(*chars), length, stdout);
80 } 80 }
81 fputc('\n', stdout); 81 fputc('\n', stdout);
82 fflush(stdout); 82 fflush(stdout);
83 Dart_ExitScope(); 83 Dart_ExitScope();
84 } 84 }
85 85
86 } // namespace bin 86 } // namespace bin
87 } // namespace dart 87 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/builtin.dart ('k') | runtime/bin/builtin_natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698