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

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

Issue 11348259: Canonicalize all integer constants taht we create by parsing a string. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 // Slow path for Mints and Bigints. 1344 // Slow path for Mints and Bigints.
1345 DARTSCOPE_NOCHECKS(isolate); 1345 DARTSCOPE_NOCHECKS(isolate);
1346 return Api::NewHandle(isolate, Integer::New(value)); 1346 return Api::NewHandle(isolate, Integer::New(value));
1347 } 1347 }
1348 1348
1349 1349
1350 DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* str) { 1350 DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* str) {
1351 Isolate* isolate = Isolate::Current(); 1351 Isolate* isolate = Isolate::Current();
1352 DARTSCOPE(isolate); 1352 DARTSCOPE(isolate);
1353 const String& str_obj = String::Handle(isolate, String::New(str)); 1353 const String& str_obj = String::Handle(isolate, String::New(str));
1354 return Api::NewHandle(isolate, Integer::New(str_obj)); 1354 return Api::NewHandle(isolate, Integer::NewCanonical(str_obj));
srdjan 2012/11/27 23:32:07 ditto
siva 2012/11/28 00:22:56 Done.
1355 } 1355 }
1356 1356
1357 1357
1358 DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer, 1358 DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer,
1359 int64_t* value) { 1359 int64_t* value) {
1360 // Fast path for Smis. 1360 // Fast path for Smis.
1361 Isolate* isolate = Isolate::Current(); 1361 Isolate* isolate = Isolate::Current();
1362 CHECK_ISOLATE(isolate); 1362 CHECK_ISOLATE(isolate);
1363 if (Api::IsSmi(integer)) { 1363 if (Api::IsSmi(integer)) {
1364 *value = Api::SmiValue(integer); 1364 *value = Api::SmiValue(integer);
(...skipping 3134 matching lines...) Expand 10 before | Expand all | Expand 10 after
4499 } 4499 }
4500 { 4500 {
4501 NoGCScope no_gc; 4501 NoGCScope no_gc;
4502 RawObject* raw_obj = obj.raw(); 4502 RawObject* raw_obj = obj.raw();
4503 isolate->heap()->SetPeer(raw_obj, peer); 4503 isolate->heap()->SetPeer(raw_obj, peer);
4504 } 4504 }
4505 return Api::Success(isolate); 4505 return Api::Success(isolate);
4506 } 4506 }
4507 4507
4508 } // namespace dart 4508 } // namespace dart
OLDNEW
« runtime/lib/integers.cc ('K') | « runtime/lib/integers.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698