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

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

Issue 1900863002: Reapply "- Use a hash table to canonicalize instances/arrays to avoid having to iterate over a line… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/class_finalizer.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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 GET_NATIVE_ARGUMENT(Integer, default_value, arguments->NativeArgAt(2)); 237 GET_NATIVE_ARGUMENT(Integer, default_value, arguments->NativeArgAt(2));
238 // Call the embedder to supply us with the environment. 238 // Call the embedder to supply us with the environment.
239 const String& env_value = 239 const String& env_value =
240 String::Handle(Api::GetEnvironmentValue(thread, name)); 240 String::Handle(Api::GetEnvironmentValue(thread, name));
241 if (!env_value.IsNull()) { 241 if (!env_value.IsNull()) {
242 const Integer& result = Integer::Handle(ParseInteger(env_value)); 242 const Integer& result = Integer::Handle(ParseInteger(env_value));
243 if (!result.IsNull()) { 243 if (!result.IsNull()) {
244 if (result.IsSmi()) { 244 if (result.IsSmi()) {
245 return result.raw(); 245 return result.raw();
246 } 246 }
247 return result.CheckAndCanonicalize(NULL); 247 return result.CheckAndCanonicalize(thread, NULL);
248 } 248 }
249 } 249 }
250 return default_value.raw(); 250 return default_value.raw();
251 } 251 }
252 252
253 253
254 static RawInteger* ShiftOperationHelper(Token::Kind kind, 254 static RawInteger* ShiftOperationHelper(Token::Kind kind,
255 const Integer& value, 255 const Integer& value,
256 const Smi& amount) { 256 const Smi& amount) {
257 if (amount.Value() < 0) { 257 if (amount.Value() < 0) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/vm/class_finalizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698