Chromium Code Reviews| 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 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2083 // Slow path for Mints and Bigints. | 2083 // Slow path for Mints and Bigints. |
| 2084 DARTSCOPE(thread); | 2084 DARTSCOPE(thread); |
| 2085 CHECK_CALLBACK_STATE(thread); | 2085 CHECK_CALLBACK_STATE(thread); |
| 2086 return Api::NewHandle(thread, Integer::New(value)); | 2086 return Api::NewHandle(thread, Integer::New(value)); |
| 2087 } | 2087 } |
| 2088 | 2088 |
| 2089 DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64(uint64_t value) { | 2089 DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64(uint64_t value) { |
| 2090 DARTSCOPE(Thread::Current()); | 2090 DARTSCOPE(Thread::Current()); |
| 2091 CHECK_CALLBACK_STATE(T); | 2091 CHECK_CALLBACK_STATE(T); |
| 2092 API_TIMELINE_DURATION; | 2092 API_TIMELINE_DURATION; |
| 2093 RawInteger* integer = Integer::NewFromUint64(value); | 2093 if (Integer::IsValidUint64(value)) { |
| 2094 if (integer == Integer::null()) { | 2094 return Api::NewHandle(T, Integer::NewFromUint64(value)); |
| 2095 } else { | |
|
zra
2017/07/28 21:47:46
else not needed.
alexmarkov
2017/07/28 23:09:29
Done.
| |
| 2095 return Api::NewError("%s: Cannot create Dart integer from value %" Pu64, | 2096 return Api::NewError("%s: Cannot create Dart integer from value %" Pu64, |
| 2096 CURRENT_FUNC, value); | 2097 CURRENT_FUNC, value); |
| 2097 } | 2098 } |
| 2098 return Api::NewHandle(T, integer); | |
| 2099 } | 2099 } |
| 2100 | 2100 |
| 2101 DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* str) { | 2101 DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* str) { |
| 2102 DARTSCOPE(Thread::Current()); | 2102 DARTSCOPE(Thread::Current()); |
| 2103 CHECK_CALLBACK_STATE(T); | 2103 CHECK_CALLBACK_STATE(T); |
| 2104 API_TIMELINE_DURATION; | 2104 API_TIMELINE_DURATION; |
| 2105 const String& str_obj = String::Handle(Z, String::New(str)); | 2105 const String& str_obj = String::Handle(Z, String::New(str)); |
| 2106 RawInteger* integer = Integer::New(str_obj); | 2106 RawInteger* integer = Integer::New(str_obj); |
| 2107 if (integer == Integer::null()) { | 2107 if (integer == Integer::null()) { |
| 2108 return Api::NewError("%s: Cannot create Dart integer from string %s", | 2108 return Api::NewError("%s: Cannot create Dart integer from string %s", |
| (...skipping 4637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6746 #endif | 6746 #endif |
| 6747 } | 6747 } |
| 6748 | 6748 |
| 6749 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { | 6749 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { |
| 6750 #ifndef PRODUCT | 6750 #ifndef PRODUCT |
| 6751 Profiler::DumpStackTrace(context); | 6751 Profiler::DumpStackTrace(context); |
| 6752 #endif | 6752 #endif |
| 6753 } | 6753 } |
| 6754 | 6754 |
| 6755 } // namespace dart | 6755 } // namespace dart |
| OLD | NEW |