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

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

Issue 9536016: Implement BigintOperations::ToDecimalCString. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and deal better with overflows. Created 8 years, 9 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 6537 matching lines...) Expand 10 before | Expand all | Expand 10 after
6548 } 6548 }
6549 6549
6550 6550
6551 static uword ZoneAllocator(intptr_t size) { 6551 static uword ZoneAllocator(intptr_t size) {
6552 Zone* zone = Isolate::Current()->current_zone(); 6552 Zone* zone = Isolate::Current()->current_zone();
6553 return zone->Allocate(size); 6553 return zone->Allocate(size);
6554 } 6554 }
6555 6555
6556 6556
6557 const char* Bigint::ToCString() const { 6557 const char* Bigint::ToCString() const {
6558 // TODO(florian): Add a BigintOperations::ToDecCString method and use that 6558 return BigintOperations::ToDecimalCString(*this, &ZoneAllocator);
6559 // here.
6560 return BigintOperations::ToHexCString(*this, &ZoneAllocator);
6561 } 6559 }
6562 6560
6563 6561
6564 class StringHasher : ValueObject { 6562 class StringHasher : ValueObject {
6565 public: 6563 public:
6566 StringHasher() : hash_(0) {} 6564 StringHasher() : hash_(0) {}
6567 void Add(int32_t ch) { 6565 void Add(int32_t ch) {
6568 hash_ += ch; 6566 hash_ += ch;
6569 hash_ += hash_ << 10; 6567 hash_ += hash_ << 10;
6570 hash_ ^= hash_ >> 6; 6568 hash_ ^= hash_ >> 6;
(...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after
8524 result.set_num_args_tested(num_args_tested); 8522 result.set_num_args_tested(num_args_tested);
8525 // Number of array elements in one test entry (num_args_tested + 1) 8523 // Number of array elements in one test entry (num_args_tested + 1)
8526 intptr_t len = result.TestEntryLength(); 8524 intptr_t len = result.TestEntryLength();
8527 // IC data array must be null terminated (sentinel entry). 8525 // IC data array must be null terminated (sentinel entry).
8528 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); 8526 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld));
8529 result.set_ic_data(ic_data); 8527 result.set_ic_data(ic_data);
8530 return result.raw(); 8528 return result.raw();
8531 } 8529 }
8532 8530
8533 } // namespace dart 8531 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698