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

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

Issue 353513002: Use range information for optimizing integer boxing and fix bug in range analysis. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/lib/integers.cc ('k') | runtime/vm/dart_api_message.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 "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 *fits = BigintOperations::FitsIntoUint64(Bigint::Cast(int_obj)); 1967 *fits = BigintOperations::FitsIntoUint64(Bigint::Cast(int_obj));
1968 } 1968 }
1969 return Api::Success(); 1969 return Api::Success();
1970 } 1970 }
1971 1971
1972 1972
1973 DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value) { 1973 DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value) {
1974 // Fast path for Smis. 1974 // Fast path for Smis.
1975 Isolate* isolate = Isolate::Current(); 1975 Isolate* isolate = Isolate::Current();
1976 CHECK_ISOLATE(isolate); 1976 CHECK_ISOLATE(isolate);
1977 if (Smi::IsValid64(value)) { 1977 if (Smi::IsValid(value)) {
1978 NOHANDLESCOPE(isolate); 1978 NOHANDLESCOPE(isolate);
1979 return Api::NewHandle(isolate, Smi::New(static_cast<intptr_t>(value))); 1979 return Api::NewHandle(isolate, Smi::New(static_cast<intptr_t>(value)));
1980 } 1980 }
1981 // Slow path for Mints and Bigints. 1981 // Slow path for Mints and Bigints.
1982 DARTSCOPE(isolate); 1982 DARTSCOPE(isolate);
1983 CHECK_CALLBACK_STATE(isolate); 1983 CHECK_CALLBACK_STATE(isolate);
1984 return Api::NewHandle(isolate, Integer::New(value)); 1984 return Api::NewHandle(isolate, Integer::New(value));
1985 } 1985 }
1986 1986
1987 1987
(...skipping 2704 matching lines...) Expand 10 before | Expand all | Expand 10 after
4692 TRACE_API_CALL(CURRENT_FUNC); 4692 TRACE_API_CALL(CURRENT_FUNC);
4693 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 4693 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
4694 arguments->SetReturn(Bool::Get(retval)); 4694 arguments->SetReturn(Bool::Get(retval));
4695 } 4695 }
4696 4696
4697 4697
4698 DART_EXPORT void Dart_SetIntegerReturnValue(Dart_NativeArguments args, 4698 DART_EXPORT void Dart_SetIntegerReturnValue(Dart_NativeArguments args,
4699 int64_t retval) { 4699 int64_t retval) {
4700 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 4700 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
4701 ASSERT(arguments->isolate() == Isolate::Current()); 4701 ASSERT(arguments->isolate() == Isolate::Current());
4702 if (Smi::IsValid64(retval)) { 4702 if (Smi::IsValid(retval)) {
4703 Api::SetSmiReturnValue(arguments, retval); 4703 Api::SetSmiReturnValue(arguments, retval);
4704 } else { 4704 } else {
4705 // Slow path for Mints and Bigints. 4705 // Slow path for Mints and Bigints.
4706 ASSERT_CALLBACK_STATE(arguments->isolate()); 4706 ASSERT_CALLBACK_STATE(arguments->isolate());
4707 Api::SetIntegerReturnValue(arguments, retval); 4707 Api::SetIntegerReturnValue(arguments, retval);
4708 } 4708 }
4709 } 4709 }
4710 4710
4711 4711
4712 DART_EXPORT void Dart_SetDoubleReturnValue(Dart_NativeArguments args, 4712 DART_EXPORT void Dart_SetDoubleReturnValue(Dart_NativeArguments args,
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
5257 5257
5258 5258
5259 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 5259 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
5260 const char* name, 5260 const char* name,
5261 Dart_ServiceRequestCallback callback, 5261 Dart_ServiceRequestCallback callback,
5262 void* user_data) { 5262 void* user_data) {
5263 Service::RegisterRootEmbedderCallback(name, callback, user_data); 5263 Service::RegisterRootEmbedderCallback(name, callback, user_data);
5264 } 5264 }
5265 5265
5266 } // namespace dart 5266 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/integers.cc ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698