| 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 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2134 } | 2134 } |
| 2135 } | 2135 } |
| 2136 // Slow path for Mints and Bigints. | 2136 // Slow path for Mints and Bigints. |
| 2137 DARTSCOPE(thread); | 2137 DARTSCOPE(thread); |
| 2138 const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer); | 2138 const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer); |
| 2139 if (int_obj.IsNull()) { | 2139 if (int_obj.IsNull()) { |
| 2140 RETURN_TYPE_ERROR(Z, integer, Integer); | 2140 RETURN_TYPE_ERROR(Z, integer, Integer); |
| 2141 } | 2141 } |
| 2142 if (int_obj.IsSmi()) { | 2142 if (int_obj.IsSmi()) { |
| 2143 ASSERT(int_obj.IsNegative()); | 2143 ASSERT(int_obj.IsNegative()); |
| 2144 } else if (int_obj.IsMint() && !int_obj.IsNegative()) { | 2144 } else if (int_obj.IsMint()) { |
| 2145 *value = int_obj.AsInt64Value(); | 2145 if (!int_obj.IsNegative()) { |
| 2146 return Api::Success(); | 2146 *value = int_obj.AsInt64Value(); |
| 2147 return Api::Success(); |
| 2148 } |
| 2147 } else { | 2149 } else { |
| 2148 const Bigint& bigint = Bigint::Cast(int_obj); | 2150 const Bigint& bigint = Bigint::Cast(int_obj); |
| 2149 if (bigint.FitsIntoUint64()) { | 2151 if (bigint.FitsIntoUint64()) { |
| 2150 *value = bigint.AsUint64Value(); | 2152 *value = bigint.AsUint64Value(); |
| 2151 return Api::Success(); | 2153 return Api::Success(); |
| 2152 } | 2154 } |
| 2153 } | 2155 } |
| 2154 return Api::NewError("%s: Integer %s cannot be represented as a uint64_t.", | 2156 return Api::NewError("%s: Integer %s cannot be represented as a uint64_t.", |
| 2155 CURRENT_FUNC, int_obj.ToCString()); | 2157 CURRENT_FUNC, int_obj.ToCString()); |
| 2156 } | 2158 } |
| (...skipping 4538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6695 #endif | 6697 #endif |
| 6696 } | 6698 } |
| 6697 | 6699 |
| 6698 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { | 6700 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { |
| 6699 #ifndef PRODUCT | 6701 #ifndef PRODUCT |
| 6700 Profiler::DumpStackTrace(context); | 6702 Profiler::DumpStackTrace(context); |
| 6701 #endif | 6703 #endif |
| 6702 } | 6704 } |
| 6703 | 6705 |
| 6704 } // namespace dart | 6706 } // namespace dart |
| OLD | NEW |