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

Side by Side Diff: runtime/lib/integers.cc

Issue 15741019: Ensures that Bigints returned to Dart are all checked by Integer::AsValidInteger. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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/double.cc ('k') | runtime/lib/typed_data.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/native_entry.h" 10 #include "vm/native_entry.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 DEFINE_NATIVE_ENTRY(Smi_bitNegate, 1) { 297 DEFINE_NATIVE_ENTRY(Smi_bitNegate, 1) {
298 const Smi& operand = Smi::CheckedHandle(arguments->NativeArgAt(0)); 298 const Smi& operand = Smi::CheckedHandle(arguments->NativeArgAt(0));
299 if (FLAG_trace_intrinsified_natives) { 299 if (FLAG_trace_intrinsified_natives) {
300 OS::Print("Smi_bitNegate: %s\n", operand.ToCString()); 300 OS::Print("Smi_bitNegate: %s\n", operand.ToCString());
301 } 301 }
302 intptr_t result = ~operand.Value(); 302 intptr_t result = ~operand.Value();
303 ASSERT(Smi::IsValid(result)); 303 ASSERT(Smi::IsValid(result));
304 return Smi::New(result); 304 return Smi::New(result);
305 } 305 }
306 306
307
307 // Mint natives. 308 // Mint natives.
308 309
309 DEFINE_NATIVE_ENTRY(Mint_bitNegate, 1) { 310 DEFINE_NATIVE_ENTRY(Mint_bitNegate, 1) {
310 const Mint& operand = Mint::CheckedHandle(arguments->NativeArgAt(0)); 311 const Mint& operand = Mint::CheckedHandle(arguments->NativeArgAt(0));
311 ASSERT(CheckInteger(operand)); 312 ASSERT(CheckInteger(operand));
312 if (FLAG_trace_intrinsified_natives) { 313 if (FLAG_trace_intrinsified_natives) {
313 OS::Print("Mint_bitNegate: %s\n", operand.ToCString()); 314 OS::Print("Mint_bitNegate: %s\n", operand.ToCString());
314 } 315 }
315 int64_t result = ~operand.value(); 316 int64_t result = ~operand.value();
316 return Integer::New(result); 317 return Integer::New(result);
317 } 318 }
318 319
320
319 // Bigint natives. 321 // Bigint natives.
320 322
321 DEFINE_NATIVE_ENTRY(Bigint_bitNegate, 1) { 323 DEFINE_NATIVE_ENTRY(Bigint_bitNegate, 1) {
322 const Bigint& value = Bigint::CheckedHandle(arguments->NativeArgAt(0)); 324 const Bigint& value = Bigint::CheckedHandle(arguments->NativeArgAt(0));
323 const Bigint& result = Bigint::Handle(BigintOperations::BitNot(value)); 325 const Bigint& result = Bigint::Handle(BigintOperations::BitNot(value));
324 ASSERT(CheckInteger(value)); 326 ASSERT(CheckInteger(value));
325 ASSERT(CheckInteger(result)); 327 ASSERT(CheckInteger(result));
326 return result.AsValidInteger(); 328 return result.AsValidInteger();
327 } 329 }
328 330
329 } // namespace dart 331 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/double.cc ('k') | runtime/lib/typed_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698