Improve display of simd vector types and stack traces in Observatory.

Associated protocol changes.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1316123004 .
This commit is contained in:
Todd Turnidge 2015-08-31 10:35:01 -07:00
parent dd5410209f
commit 7ac3150ee3
6 changed files with 70 additions and 20 deletions

View file

@ -12,6 +12,16 @@
font: 400 14px 'Montserrat', sans-serif;
line-height: 150%;
}
.stackTraceBox {
margin-left: 1.5em;
background-color: #f5f5f5;
border: 1px solid #ccc;
padding: 10px;
font-family: consolas, courier, monospace;
font-size: 12px;
white-space: pre;
overflow-x: auto;
}
</style>
<span>
<template if="{{ ref.isSentinel }}">
@ -19,10 +29,18 @@
</template>
<template if="{{ ref.isBool || ref.isInt ||
ref.isDouble || ref.isNull }}">
ref.isDouble || ref.isSimdValue ||
ref.isNull }}">
<a on-click="{{ goto }}" _href="{{ url }}">{{ ref.valueAsString }}</a>
</template>
<template if="{{ ref.isStackTrace }}">
<a on-click="{{ goto }}" _href="{{ url }}"><em>{{ ref.clazz.name }}</em></a>
<curly-block expandKey="{{ expandKey }}">
<div class="stackTraceBox">{{ ref.valueAsString }}</div>
</curly-block>
</template>
<template if="{{ ref.isString }}">
<a on-click="{{ goto }}" _href="{{ url }}">{{ asStringLiteral(ref.valueAsString, ref.valueAsStringIsTruncated) }}</a>
</template>

View file

@ -136,6 +136,8 @@ abstract class ServiceObject extends Observable {
bool get isMirrorReference => false;
bool get isWeakProperty => false;
bool get isClosure => false;
bool get isStackTrace => false;
bool get isSimdValue => false;
bool get isPlainInstance => false;
/// Has this object been fully loaded?
@ -2223,10 +2225,16 @@ class Instance extends HeapObject {
|| kind == 'Float32x4List'
|| kind == 'Float64x2List';
}
bool get isSimdValue {
return kind == 'Float32x4'
|| kind == 'Float64x2'
|| kind == 'Int32x4';
}
bool get isRegExp => kind == 'RegExp';
bool get isMirrorReference => kind == 'MirrorReference';
bool get isWeakProperty => kind == 'WeakProperty';
bool get isClosure => kind == 'Closure';
bool get isStackTrace => kind == 'StackTrace';
// TODO(turnidge): Is this properly backwards compatible when new
// instance kinds are added?

View file

@ -125,7 +125,10 @@ class Node {
mixedType = "2";
mixedType = false;
array = [1, 2, 3];
array = new List(3);
array[0] = 1;
array[1] = 2;
array[2] = 3;
bigint = 1 << 65;
blockClean = genCleanBlock();
blockCopying = genCopyingBlock();
@ -135,12 +138,12 @@ class Node {
counter = new Counter("CounterName", "Counter description");
expando = new Expando("expando-name");
expando[array] = 'The weakly associated value';
float32x4 = new Float32x4.zero();
float32x4 = new Float32x4(0.0, -1.0, 3.14, 2e28);
float64 = 3.14;
float64x2 = new Float64x2.zero();
gauge = new Gauge("GuageName", "Guage description", 0.0, 100.0);
float64x2 = new Float64x2(0.0, 3.14);
gauge = new Gauge("GaugeName", "Gauge description", 0.0, 100.0);
growableList = new List();
int32x4 = new Int32x4(0,0,0,0);
int32x4 = new Int32x4(0,1,10,11);
map = { "x-key": "x-value", "y-key": "y-value", "removed-key": "removed-value" };
map.remove("removed-key");
mint = 1 << 32;

View file

@ -20412,7 +20412,11 @@ const char* Float32x4::ToCString() const {
void Float32x4::PrintJSONImpl(JSONStream* stream, bool ref) const {
Instance::PrintJSONImpl(stream, ref);
JSONObject jsobj(stream);
PrintSharedInstanceJSON(&jsobj, ref);
jsobj.AddProperty("kind", "Float32x4");
jsobj.AddServiceId(*this);
jsobj.AddProperty("valueAsString", ToCString());
}
@ -20517,7 +20521,11 @@ const char* Int32x4::ToCString() const {
void Int32x4::PrintJSONImpl(JSONStream* stream, bool ref) const {
Instance::PrintJSONImpl(stream, ref);
JSONObject jsobj(stream);
PrintSharedInstanceJSON(&jsobj, ref);
jsobj.AddProperty("kind", "Int32x4");
jsobj.AddServiceId(*this);
jsobj.AddProperty("valueAsString", ToCString());
}
@ -20597,7 +20605,11 @@ const char* Float64x2::ToCString() const {
void Float64x2::PrintJSONImpl(JSONStream* stream, bool ref) const {
Instance::PrintJSONImpl(stream, ref);
JSONObject jsobj(stream);
PrintSharedInstanceJSON(&jsobj, ref);
jsobj.AddProperty("kind", "Float64x2");
jsobj.AddServiceId(*this);
jsobj.AddProperty("valueAsString", ToCString());
}
@ -20959,20 +20971,19 @@ RawStacktrace* Stacktrace::New(const Array& code_array,
}
RawString* Stacktrace::FullStacktrace() const {
intptr_t idx = 0;
return String::New(ToCStringInternal(&idx));
}
const char* Stacktrace::ToCString() const {
const String& trace = String::Handle(FullStacktrace());
return trace.ToCString();
intptr_t idx = 0;
return ToCStringInternal(&idx);
}
void Stacktrace::PrintJSONImpl(JSONStream* stream, bool ref) const {
Instance::PrintJSONImpl(stream, ref);
JSONObject jsobj(stream);
PrintSharedInstanceJSON(&jsobj, ref);
jsobj.AddProperty("kind", "StackTrace");
jsobj.AddServiceId(*this);
intptr_t idx = 0;
jsobj.AddProperty("valueAsString", ToCStringInternal(&idx));
}

View file

@ -7644,8 +7644,6 @@ class Stacktrace : public Instance {
const Array& pc_offset_array,
Heap::Space space = Heap::kNew);
RawString* FullStacktrace() const;
// The argument 'max_frames' limits the number of printed frames.
const char* ToCStringInternal(intptr_t* frame_index,
intptr_t max_frames = kMaxInt32) const;

View file

@ -1241,6 +1241,10 @@ class @Instance extends @Object {
// Double (suitable for passing to Double.parse())
// Int (suitable for passing to int.parse())
// String (value may be truncated)
// Float32x4
// Float64x2
// Int32x4
// StackTrace
string valueAsString [optional];
// The valueAsString for String references may be truncated. If so,
@ -1507,6 +1511,11 @@ enum InstanceKind {
// Maps will be PlainInstance.
Map,
// Vector instance kinds.
Float32x4,
Float64x2,
Int32x4
// An instance of the built-in VM TypedData implementations. User-defined
// TypedDatas will be PlainInstance.
Uint8ClampedList,
@ -1524,6 +1533,9 @@ enum InstanceKind {
Float32x4List,
Float64x2List,
// An instance of the Dart class StackTrace.
StackTrace,
// An instance of the built-in VM Closure implementation. User-defined
// Closures will be PlainInstance.
Closure,