Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 2992733003: Revert "[vm] Revise Dart_IntegerToHexCString to avoid dependency on Bigint" (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 2182
2183 DART_EXPORT Dart_Handle Dart_IntegerToHexCString(Dart_Handle integer, 2183 DART_EXPORT Dart_Handle Dart_IntegerToHexCString(Dart_Handle integer,
2184 const char** value) { 2184 const char** value) {
2185 API_TIMELINE_DURATION; 2185 API_TIMELINE_DURATION;
2186 DARTSCOPE(Thread::Current()); 2186 DARTSCOPE(Thread::Current());
2187 const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer); 2187 const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer);
2188 if (int_obj.IsNull()) { 2188 if (int_obj.IsNull()) {
2189 RETURN_TYPE_ERROR(Z, integer, Integer); 2189 RETURN_TYPE_ERROR(Z, integer, Integer);
2190 } 2190 }
2191 Zone* scope_zone = Api::TopScope(Thread::Current())->zone(); 2191 Zone* scope_zone = Api::TopScope(Thread::Current())->zone();
2192 *value = int_obj.ToHexCString(scope_zone); 2192 if (int_obj.IsSmi() || int_obj.IsMint()) {
2193 const Bigint& bigint =
2194 Bigint::Handle(Z, Bigint::NewFromInt64(int_obj.AsInt64Value()));
2195 *value = bigint.ToHexCString(scope_zone);
2196 } else {
2197 *value = Bigint::Cast(int_obj).ToHexCString(scope_zone);
2198 }
2193 return Api::Success(); 2199 return Api::Success();
2194 } 2200 }
2195 2201
2196 DART_EXPORT Dart_Handle Dart_NewDouble(double value) { 2202 DART_EXPORT Dart_Handle Dart_NewDouble(double value) {
2197 DARTSCOPE(Thread::Current()); 2203 DARTSCOPE(Thread::Current());
2198 CHECK_CALLBACK_STATE(T); 2204 CHECK_CALLBACK_STATE(T);
2199 return Api::NewHandle(T, Double::New(value)); 2205 return Api::NewHandle(T, Double::New(value));
2200 } 2206 }
2201 2207
2202 DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj, 2208 DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj,
(...skipping 4536 matching lines...) Expand 10 before | Expand all | Expand 10 after
6739 #endif 6745 #endif
6740 } 6746 }
6741 6747
6742 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { 6748 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) {
6743 #ifndef PRODUCT 6749 #ifndef PRODUCT
6744 Profiler::DumpStackTrace(context); 6750 Profiler::DumpStackTrace(context);
6745 #endif 6751 #endif
6746 } 6752 }
6747 6753
6748 } // namespace dart 6754 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698