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

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

Issue 19106008: Fix for issue 11680 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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
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"
11 #include "vm/object.h" 11 #include "vm/object.h"
12 #include "vm/object_store.h"
12 #include "vm/symbols.h" 13 #include "vm/symbols.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 DEFINE_FLAG(bool, trace_intrinsified_natives, false, 17 DEFINE_FLAG(bool, trace_intrinsified_natives, false,
17 "Report if any of the intrinsified natives are called"); 18 "Report if any of the intrinsified natives are called");
18 19
19 // Smi natives. 20 // Smi natives.
20 21
21 // Returns false if integer is in wrong representation, e.g., as is a Bigint 22 // Returns false if integer is in wrong representation, e.g., as is a Bigint
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 const Mint& operand = Mint::CheckedHandle(arguments->NativeArgAt(0)); 312 const Mint& operand = Mint::CheckedHandle(arguments->NativeArgAt(0));
312 ASSERT(CheckInteger(operand)); 313 ASSERT(CheckInteger(operand));
313 if (FLAG_trace_intrinsified_natives) { 314 if (FLAG_trace_intrinsified_natives) {
314 OS::Print("Mint_bitNegate: %s\n", operand.ToCString()); 315 OS::Print("Mint_bitNegate: %s\n", operand.ToCString());
315 } 316 }
316 int64_t result = ~operand.value(); 317 int64_t result = ~operand.value();
317 return Integer::New(result); 318 return Integer::New(result);
318 } 319 }
319 320
320 321
322 DEFINE_NATIVE_ENTRY(Mint_shlFromInt, 2) {
323 // Use the preallocated out of memory exception to avoid calling
324 // into dart code or allocating any code.
325 const Instance& exception =
326 Instance::Handle(isolate->object_store()->out_of_memory());
327 Exceptions::Throw(exception);
328 UNREACHABLE();
329 return 0;
330 }
331
332
321 // Bigint natives. 333 // Bigint natives.
322 334
323 DEFINE_NATIVE_ENTRY(Bigint_bitNegate, 1) { 335 DEFINE_NATIVE_ENTRY(Bigint_bitNegate, 1) {
324 const Bigint& value = Bigint::CheckedHandle(arguments->NativeArgAt(0)); 336 const Bigint& value = Bigint::CheckedHandle(arguments->NativeArgAt(0));
325 const Bigint& result = Bigint::Handle(BigintOperations::BitNot(value)); 337 const Bigint& result = Bigint::Handle(BigintOperations::BitNot(value));
326 ASSERT(CheckInteger(value)); 338 ASSERT(CheckInteger(value));
327 ASSERT(CheckInteger(result)); 339 ASSERT(CheckInteger(result));
328 return result.AsValidInteger(); 340 return result.AsValidInteger();
329 } 341 }
330 342
343
344 DEFINE_NATIVE_ENTRY(Bigint_shlFromInt, 2) {
345 // Use the preallocated out of memory exception to avoid calling
346 // into dart code or allocating any code.
347 const Instance& exception =
348 Instance::Handle(isolate->object_store()->out_of_memory());
349 Exceptions::Throw(exception);
350 UNREACHABLE();
351 return 0;
352 }
353
331 } // namespace dart 354 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698