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

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

Issue 8505026: Update tests, fix printing of doubles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « no previous file | tests/co19/co19-runtime.status » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 5244 matching lines...) Expand 10 before | Expand all | Expand 10 after
5255 } 5255 }
5256 if (isinf(value())) { 5256 if (isinf(value())) {
5257 return value() < 0 ? "-Infinity" : "Infinity"; 5257 return value() < 0 ? "-Infinity" : "Infinity";
5258 } 5258 }
5259 const char* kFormat = "%f"; 5259 const char* kFormat = "%f";
5260 // Calculate the size of the string. 5260 // Calculate the size of the string.
5261 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1; 5261 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1;
5262 char* chars = reinterpret_cast<char*>( 5262 char* chars = reinterpret_cast<char*>(
5263 Isolate::Current()->current_zone()->Allocate(len)); 5263 Isolate::Current()->current_zone()->Allocate(len));
5264 OS::SNPrint(chars, len, kFormat, value()); 5264 OS::SNPrint(chars, len, kFormat, value());
5265 // Eliminate trailing 0s, but leave one digit after '.'.
hausner 2011/11/09 19:32:01 Doesn't the %f format specifier suppress trailing
srdjan 2011/11/09 21:48:55 Unfortunately it doesn't.
5266 // 'chars' is null terminated.
5267 for (intptr_t i = len - 2; i >= 1; i--) {
5268 if ((chars[i] == '0') && (chars[i - 1] != '.')) {
5269 chars[i] = '\0';
5270 } else {
5271 break;
5272 }
5273 }
5265 return chars; 5274 return chars;
5266 } 5275 }
5267 5276
5268 5277
5269 bool Bigint::Equals(const Instance& other) const { 5278 bool Bigint::Equals(const Instance& other) const {
5270 if (this->raw() == other.raw()) { 5279 if (this->raw() == other.raw()) {
5271 // Both handles point to the same raw instance. 5280 // Both handles point to the same raw instance.
5272 return true; 5281 return true;
5273 } 5282 }
5274 5283
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
6944 const String& str = String::Handle(pattern()); 6953 const String& str = String::Handle(pattern());
6945 const char* format = "JSRegExp: pattern=%s flags=%s"; 6954 const char* format = "JSRegExp: pattern=%s flags=%s";
6946 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 6955 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
6947 char* chars = reinterpret_cast<char*>( 6956 char* chars = reinterpret_cast<char*>(
6948 Isolate::Current()->current_zone()->Allocate(len + 1)); 6957 Isolate::Current()->current_zone()->Allocate(len + 1));
6949 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 6958 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
6950 return chars; 6959 return chars;
6951 } 6960 }
6952 6961
6953 } // namespace dart 6962 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698