| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void FUNCTION_NAME(Exit)(Dart_NativeArguments args) { | 132 void FUNCTION_NAME(Exit)(Dart_NativeArguments args) { |
| 133 Dart_EnterScope(); | 133 Dart_EnterScope(); |
| 134 int64_t status = 0; | 134 int64_t status = 0; |
| 135 // Ignore result if passing invalid argument and just exit 0. | 135 // Ignore result if passing invalid argument and just exit 0. |
| 136 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); | 136 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
| 137 Dart_ExitScope(); | 137 Dart_ExitScope(); |
| 138 exit(status); | 138 exit(status); |
| 139 } | 139 } |
| 140 | 140 |
| 141 | 141 |
| 142 void Builtin::SetNativeResolver(Builtin::BuiltinLibraryId id) { | 142 void Builtin::SetupIOLibrary(Dart_Handle io_lib) { |
| 143 Dart_Handle url; | 143 Dart_Handle url = Dart_NewString(DartUtils::kIsolateLibURL); |
| 144 if (id == Builtin::kBuiltinLibrary) { | 144 DART_CHECK_VALID(url); |
| 145 url = Dart_NewString(DartUtils::kBuiltinLibURL); | 145 Dart_Handle isolate_lib = Dart_LookupLibrary(url); |
| 146 } else { | 146 DART_CHECK_VALID(isolate_lib); |
| 147 ASSERT(id == Builtin::kIOLibrary); | 147 Dart_Handle timer_closure = |
| 148 url = Dart_NewString(DartUtils::kIOLibURL); | 148 Dart_Invoke(io_lib, Dart_NewString("_getTimerFactoryClosure"), 0, NULL); |
| 149 } | 149 Dart_Handle args[1]; |
| 150 Dart_Handle builtin_lib = Dart_LookupLibrary(url); | 150 args[0] = timer_closure; |
| 151 DART_CHECK_VALID(builtin_lib); | 151 DART_CHECK_VALID(Dart_Invoke(isolate_lib, |
| 152 // Setup the native resolver for built in library functions. | 152 Dart_NewString("_setTimerFactoryClosure"), |
| 153 Dart_Handle result = Dart_SetNativeResolver(builtin_lib, NativeLookup); | 153 1, args)); |
| 154 DART_CHECK_VALID(result); | |
| 155 } | 154 } |
| OLD | NEW |