| Index: runtime/vm/json_stream.cc
|
| diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc
|
| index f25add71d282187f1f66be75c881ed6fe3293c13..b5da5ddc01066981ab98411afdcf64be1c487cf2 100644
|
| --- a/runtime/vm/json_stream.cc
|
| +++ b/runtime/vm/json_stream.cc
|
| @@ -292,23 +292,27 @@ void JSONStream::PrintValueBool(bool b) {
|
|
|
|
|
| void JSONStream::PrintValue(intptr_t i) {
|
| + EnsureIntegerIsRepresentableInJavaScript(static_cast<int64_t>(i));
|
| PrintCommaIfNeeded();
|
| buffer_.Printf("%" Pd "", i);
|
| }
|
|
|
|
|
| void JSONStream::PrintValue64(int64_t i) {
|
| + EnsureIntegerIsRepresentableInJavaScript(i);
|
| PrintCommaIfNeeded();
|
| buffer_.Printf("%" Pd64 "", i);
|
| }
|
|
|
|
|
| void JSONStream::PrintValueTimeMillis(int64_t millis) {
|
| - PrintValue(static_cast<double>(millis));
|
| + EnsureIntegerIsRepresentableInJavaScript(millis);
|
| + PrintValue64(millis);
|
| }
|
|
|
|
|
| void JSONStream::PrintValueTimeMicros(int64_t micros) {
|
| + EnsureIntegerIsRepresentableInJavaScript(micros);
|
| PrintValue64(micros);
|
| }
|
|
|
| @@ -452,21 +456,19 @@ void JSONStream::PrintPropertyBool(const char* name, bool b) {
|
|
|
|
|
| void JSONStream::PrintProperty(const char* name, intptr_t i) {
|
| - ASSERT(Utils::IsJavascriptInt(i));
|
| PrintPropertyName(name);
|
| PrintValue(i);
|
| }
|
|
|
|
|
| void JSONStream::PrintProperty64(const char* name, int64_t i) {
|
| - ASSERT(Utils::IsJavascriptInt64(i));
|
| PrintPropertyName(name);
|
| PrintValue64(i);
|
| }
|
|
|
|
|
| void JSONStream::PrintPropertyTimeMillis(const char* name, int64_t millis) {
|
| - PrintProperty(name, static_cast<double>(millis));
|
| + PrintProperty64(name, millis);
|
| }
|
|
|
|
|
| @@ -620,6 +622,17 @@ bool JSONStream::NeedComma() {
|
| }
|
|
|
|
|
| +void JSONStream::EnsureIntegerIsRepresentableInJavaScript(int64_t i) {
|
| +#ifdef DEBUG
|
| + if (!Utils::IsJavascriptInt(i)) {
|
| + OS::Print("JSONStream::EnsureIntegerIsRepresentableInJavaScript failed on "
|
| + "%" Pd64 "\n", i);
|
| + UNREACHABLE();
|
| + }
|
| +#endif
|
| +}
|
| +
|
| +
|
| void JSONStream::AddEscapedUTF8String(const char* s) {
|
| if (s == NULL) {
|
| return;
|
|
|