| 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 = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | 132 int64_t status = 0; |
| 133 // Ignore result if passing invalid argument and just exit 0. |
| 134 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
| 133 Dart_ExitScope(); | 135 Dart_ExitScope(); |
| 134 exit(status); | 136 exit(status); |
| 135 } | 137 } |
| 136 | 138 |
| 137 | 139 |
| 138 void Builtin::SetNativeResolver(Builtin::BuiltinLibraryId id) { | 140 void Builtin::SetNativeResolver(Builtin::BuiltinLibraryId id) { |
| 139 Dart_Handle url; | 141 Dart_Handle url; |
| 140 if (id == Builtin::kBuiltinLibrary) { | 142 if (id == Builtin::kBuiltinLibrary) { |
| 141 url = Dart_NewString(DartUtils::kBuiltinLibURL); | 143 url = Dart_NewString(DartUtils::kBuiltinLibURL); |
| 142 } else { | 144 } else { |
| 143 ASSERT(id == Builtin::kIOLibrary); | 145 ASSERT(id == Builtin::kIOLibrary); |
| 144 url = Dart_NewString(DartUtils::kIOLibURL); | 146 url = Dart_NewString(DartUtils::kIOLibURL); |
| 145 } | 147 } |
| 146 Dart_Handle builtin_lib = Dart_LookupLibrary(url); | 148 Dart_Handle builtin_lib = Dart_LookupLibrary(url); |
| 147 DART_CHECK_VALID(builtin_lib); | 149 DART_CHECK_VALID(builtin_lib); |
| 148 // Setup the native resolver for built in library functions. | 150 // Setup the native resolver for built in library functions. |
| 149 Dart_Handle result = Dart_SetNativeResolver(builtin_lib, NativeLookup); | 151 Dart_Handle result = Dart_SetNativeResolver(builtin_lib, NativeLookup); |
| 150 DART_CHECK_VALID(result); | 152 DART_CHECK_VALID(result); |
| 151 } | 153 } |
| OLD | NEW |