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

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

Issue 1156143003: Refactor Isolate -> Thread in NativeArguments and exception handler jump. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix comment; remove unused accessor. Created 5 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
« no previous file with comments | « no previous file | runtime/lib/isolate.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 "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 const Integer& value = Integer::CheckedHandle(arguments->NativeArgAt(0)); 294 const Integer& value = Integer::CheckedHandle(arguments->NativeArgAt(0));
295 GET_NON_NULL_NATIVE_ARGUMENT(Integer, shift_count, arguments->NativeArgAt(1)); 295 GET_NON_NULL_NATIVE_ARGUMENT(Integer, shift_count, arguments->NativeArgAt(1));
296 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(2)); 296 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(2));
297 ASSERT(CheckInteger(value)); 297 ASSERT(CheckInteger(value));
298 ASSERT(CheckInteger(shift_count)); 298 ASSERT(CheckInteger(shift_count));
299 ASSERT(CheckInteger(mask)); 299 ASSERT(CheckInteger(mask));
300 if (!shift_count.IsSmi()) { 300 if (!shift_count.IsSmi()) {
301 // Shift count is too large.. 301 // Shift count is too large..
302 const Instance& exception = 302 const Instance& exception =
303 Instance::Handle(isolate->object_store()->out_of_memory()); 303 Instance::Handle(isolate->object_store()->out_of_memory());
304 Exceptions::Throw(isolate, exception); 304 Exceptions::Throw(thread, exception);
305 } 305 }
306 const Smi& smi_shift_count = Smi::Cast(shift_count); 306 const Smi& smi_shift_count = Smi::Cast(shift_count);
307 const Integer& shift_result = Integer::Handle( 307 const Integer& shift_result = Integer::Handle(
308 ShiftOperationHelper(Token::kSHL, value, smi_shift_count, true)); 308 ShiftOperationHelper(Token::kSHL, value, smi_shift_count, true));
309 const Integer& result = 309 const Integer& result =
310 Integer::Handle(shift_result.BitOp(Token::kBIT_AND, mask)); 310 Integer::Handle(shift_result.BitOp(Token::kBIT_AND, mask));
311 return result.AsValidInteger(); 311 return result.AsValidInteger();
312 } 312 }
313 313
314 314
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 ASSERT(Smi::IsValid(result)); 388 ASSERT(Smi::IsValid(result));
389 return Smi::New(result); 389 return Smi::New(result);
390 } 390 }
391 391
392 392
393 DEFINE_NATIVE_ENTRY(Mint_shlFromInt, 2) { 393 DEFINE_NATIVE_ENTRY(Mint_shlFromInt, 2) {
394 // Use the preallocated out of memory exception to avoid calling 394 // Use the preallocated out of memory exception to avoid calling
395 // into dart code or allocating any code. 395 // into dart code or allocating any code.
396 const Instance& exception = 396 const Instance& exception =
397 Instance::Handle(isolate->object_store()->out_of_memory()); 397 Instance::Handle(isolate->object_store()->out_of_memory());
398 Exceptions::Throw(isolate, exception); 398 Exceptions::Throw(thread, exception);
399 UNREACHABLE(); 399 UNREACHABLE();
400 return 0; 400 return 0;
401 } 401 }
402 402
403 403
404 // Bigint natives. 404 // Bigint natives.
405 405
406 DEFINE_NATIVE_ENTRY(Bigint_getNeg, 1) { 406 DEFINE_NATIVE_ENTRY(Bigint_getNeg, 1) {
407 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); 407 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0));
408 return bigint.neg(); 408 return bigint.neg();
(...skipping 15 matching lines...) Expand all
424 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { 424 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) {
425 // First arg is null type arguments, since class Bigint is not parameterized. 425 // First arg is null type arguments, since class Bigint is not parameterized.
426 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); 426 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1));
427 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); 427 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2));
428 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); 428 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3));
429 ASSERT(!digits.IsNull()); 429 ASSERT(!digits.IsNull());
430 return Bigint::New(neg.value(), used.Value(), digits); 430 return Bigint::New(neg.value(), used.Value(), digits);
431 } 431 }
432 432
433 } // namespace dart 433 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698