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

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

Issue 2992013002: [vm] Change TypedData_getUint64 native method to silently cast values (Closed)
Patch Set: Loop test to verify optimized mode too 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/object.h » ('j') | runtime/vm/object.cc » ('J')
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 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 return Api::NewError("%s: Cannot create Dart integer from value %" Pu64,
2096 CURRENT_FUNC, value);
2097 } 2095 }
2098 return Api::NewHandle(T, integer); 2096 return Api::NewError("%s: Cannot create Dart integer from value %" Pu64,
2097 CURRENT_FUNC, value);
2099 } 2098 }
2100 2099
2101 DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* str) { 2100 DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* str) {
2102 DARTSCOPE(Thread::Current()); 2101 DARTSCOPE(Thread::Current());
2103 CHECK_CALLBACK_STATE(T); 2102 CHECK_CALLBACK_STATE(T);
2104 API_TIMELINE_DURATION; 2103 API_TIMELINE_DURATION;
2105 const String& str_obj = String::Handle(Z, String::New(str)); 2104 const String& str_obj = String::Handle(Z, String::New(str));
2106 RawInteger* integer = Integer::New(str_obj); 2105 RawInteger* integer = Integer::New(str_obj);
2107 if (integer == Integer::null()) { 2106 if (integer == Integer::null()) {
2108 return Api::NewError("%s: Cannot create Dart integer from string %s", 2107 return Api::NewError("%s: Cannot create Dart integer from string %s",
(...skipping 4637 matching lines...) Expand 10 before | Expand all | Expand 10 after
6746 #endif 6745 #endif
6747 } 6746 }
6748 6747
6749 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { 6748 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) {
6750 #ifndef PRODUCT 6749 #ifndef PRODUCT
6751 Profiler::DumpStackTrace(context); 6750 Profiler::DumpStackTrace(context);
6752 #endif 6751 #endif
6753 } 6752 }
6754 6753
6755 } // namespace dart 6754 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698