| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "lib/stacktrace.h" | 9 #include "lib/stacktrace.h" |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2183 | 2183 |
| 2184 DART_EXPORT Dart_Handle Dart_IntegerToHexCString(Dart_Handle integer, | 2184 DART_EXPORT Dart_Handle Dart_IntegerToHexCString(Dart_Handle integer, |
| 2185 const char** value) { | 2185 const char** value) { |
| 2186 API_TIMELINE_DURATION; | 2186 API_TIMELINE_DURATION; |
| 2187 DARTSCOPE(Thread::Current()); | 2187 DARTSCOPE(Thread::Current()); |
| 2188 const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer); | 2188 const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer); |
| 2189 if (int_obj.IsNull()) { | 2189 if (int_obj.IsNull()) { |
| 2190 RETURN_TYPE_ERROR(Z, integer, Integer); | 2190 RETURN_TYPE_ERROR(Z, integer, Integer); |
| 2191 } | 2191 } |
| 2192 Zone* scope_zone = Api::TopScope(Thread::Current())->zone(); | 2192 Zone* scope_zone = Api::TopScope(Thread::Current())->zone(); |
| 2193 if (int_obj.IsSmi() || int_obj.IsMint()) { | 2193 *value = int_obj.ToHexCString(scope_zone); |
| 2194 const Bigint& bigint = | |
| 2195 Bigint::Handle(Z, Bigint::NewFromInt64(int_obj.AsInt64Value())); | |
| 2196 *value = bigint.ToHexCString(scope_zone); | |
| 2197 } else { | |
| 2198 *value = Bigint::Cast(int_obj).ToHexCString(scope_zone); | |
| 2199 } | |
| 2200 return Api::Success(); | 2194 return Api::Success(); |
| 2201 } | 2195 } |
| 2202 | 2196 |
| 2203 DART_EXPORT Dart_Handle Dart_NewDouble(double value) { | 2197 DART_EXPORT Dart_Handle Dart_NewDouble(double value) { |
| 2204 DARTSCOPE(Thread::Current()); | 2198 DARTSCOPE(Thread::Current()); |
| 2205 CHECK_CALLBACK_STATE(T); | 2199 CHECK_CALLBACK_STATE(T); |
| 2206 return Api::NewHandle(T, Double::New(value)); | 2200 return Api::NewHandle(T, Double::New(value)); |
| 2207 } | 2201 } |
| 2208 | 2202 |
| 2209 DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj, | 2203 DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj, |
| (...skipping 4536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6746 #endif | 6740 #endif |
| 6747 } | 6741 } |
| 6748 | 6742 |
| 6749 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { | 6743 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { |
| 6750 #ifndef PRODUCT | 6744 #ifndef PRODUCT |
| 6751 Profiler::DumpStackTrace(context); | 6745 Profiler::DumpStackTrace(context); |
| 6752 #endif | 6746 #endif |
| 6753 } | 6747 } |
| 6754 | 6748 |
| 6755 } // namespace dart | 6749 } // namespace dart |
| OLD | NEW |