| OLD | NEW |
| 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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 | 123 |
| 124 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { | 124 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { |
| 125 Dart_EnterScope(); | 125 Dart_EnterScope(); |
| 126 Builtin::PrintString(stdout, Dart_GetNativeArgument(args, 0)); | 126 Builtin::PrintString(stdout, Dart_GetNativeArgument(args, 0)); |
| 127 Dart_ExitScope(); | 127 Dart_ExitScope(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void FUNCTION_NAME(Exit)(Dart_NativeArguments args) { | 130 void FUNCTION_NAME(Exit)(Dart_NativeArguments args) { |
| 131 Dart_EnterScope(); | 131 Dart_EnterScope(); |
| 132 int64_t status = 0; | 132 int64_t status = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); |
| 133 // Ignore result if passing invalid argument and just exit 0. | |
| 134 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); | |
| 135 Dart_ExitScope(); | 133 Dart_ExitScope(); |
| 136 exit(status); | 134 exit(status); |
| 137 } | 135 } |
| 138 | 136 |
| 139 | 137 |
| 140 void Builtin::SetNativeResolver(Builtin::BuiltinLibraryId id) { | 138 void Builtin::SetNativeResolver(Builtin::BuiltinLibraryId id) { |
| 141 Dart_Handle url; | 139 Dart_Handle url; |
| 142 if (id == Builtin::kBuiltinLibrary) { | 140 if (id == Builtin::kBuiltinLibrary) { |
| 143 url = Dart_NewString(DartUtils::kBuiltinLibURL); | 141 url = Dart_NewString(DartUtils::kBuiltinLibURL); |
| 144 } else { | 142 } else { |
| 145 ASSERT(id == Builtin::kIOLibrary); | 143 ASSERT(id == Builtin::kIOLibrary); |
| 146 url = Dart_NewString(DartUtils::kIOLibURL); | 144 url = Dart_NewString(DartUtils::kIOLibURL); |
| 147 } | 145 } |
| 148 Dart_Handle builtin_lib = Dart_LookupLibrary(url); | 146 Dart_Handle builtin_lib = Dart_LookupLibrary(url); |
| 149 DART_CHECK_VALID(builtin_lib); | 147 DART_CHECK_VALID(builtin_lib); |
| 150 // Setup the native resolver for built in library functions. | 148 // Setup the native resolver for built in library functions. |
| 151 Dart_Handle result = Dart_SetNativeResolver(builtin_lib, NativeLookup); | 149 Dart_Handle result = Dart_SetNativeResolver(builtin_lib, NativeLookup); |
| 152 DART_CHECK_VALID(result); | 150 DART_CHECK_VALID(result); |
| 153 } | 151 } |
| OLD | NEW |