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

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

Issue 1316123004: Improve display of simd vector types and stack traces in Observatory. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
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 "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 20357 matching lines...) Expand 10 before | Expand all | Expand 10 after
20368 float _w = w(); 20368 float _w = w();
20369 // Calculate the size of the string. 20369 // Calculate the size of the string.
20370 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; 20370 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1;
20371 char* chars = Thread::Current()->zone()->Alloc<char>(len); 20371 char* chars = Thread::Current()->zone()->Alloc<char>(len);
20372 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); 20372 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w);
20373 return chars; 20373 return chars;
20374 } 20374 }
20375 20375
20376 20376
20377 void Float32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { 20377 void Float32x4::PrintJSONImpl(JSONStream* stream, bool ref) const {
20378 Instance::PrintJSONImpl(stream, ref); 20378 JSONObject jsobj(stream);
20379 PrintSharedInstanceJSON(&jsobj, ref);
20380 jsobj.AddProperty("kind", "Float32x4");
20381 jsobj.AddServiceId(*this);
20382 jsobj.AddProperty("valueAsString", ToCString());
20379 } 20383 }
20380 20384
20381 20385
20382 RawInt32x4* Int32x4::New(int32_t v0, int32_t v1, int32_t v2, int32_t v3, 20386 RawInt32x4* Int32x4::New(int32_t v0, int32_t v1, int32_t v2, int32_t v3,
20383 Heap::Space space) { 20387 Heap::Space space) {
20384 ASSERT(Isolate::Current()->object_store()->int32x4_class() != 20388 ASSERT(Isolate::Current()->object_store()->int32x4_class() !=
20385 Class::null()); 20389 Class::null());
20386 Int32x4& result = Int32x4::Handle(); 20390 Int32x4& result = Int32x4::Handle();
20387 { 20391 {
20388 RawObject* raw = Object::Allocate(Int32x4::kClassId, 20392 RawObject* raw = Object::Allocate(Int32x4::kClassId,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
20473 int32_t _w = w(); 20477 int32_t _w = w();
20474 // Calculate the size of the string. 20478 // Calculate the size of the string.
20475 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; 20479 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1;
20476 char* chars = Thread::Current()->zone()->Alloc<char>(len); 20480 char* chars = Thread::Current()->zone()->Alloc<char>(len);
20477 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); 20481 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w);
20478 return chars; 20482 return chars;
20479 } 20483 }
20480 20484
20481 20485
20482 void Int32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { 20486 void Int32x4::PrintJSONImpl(JSONStream* stream, bool ref) const {
20483 Instance::PrintJSONImpl(stream, ref); 20487 JSONObject jsobj(stream);
20488 PrintSharedInstanceJSON(&jsobj, ref);
20489 jsobj.AddProperty("kind", "Int32x4");
20490 jsobj.AddServiceId(*this);
20491 jsobj.AddProperty("valueAsString", ToCString());
20484 } 20492 }
20485 20493
20486 20494
20487 RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) { 20495 RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) {
20488 ASSERT(Isolate::Current()->object_store()->float64x2_class() != 20496 ASSERT(Isolate::Current()->object_store()->float64x2_class() !=
20489 Class::null()); 20497 Class::null());
20490 Float64x2& result = Float64x2::Handle(); 20498 Float64x2& result = Float64x2::Handle();
20491 { 20499 {
20492 RawObject* raw = Object::Allocate(Float64x2::kClassId, 20500 RawObject* raw = Object::Allocate(Float64x2::kClassId,
20493 Float64x2::InstanceSize(), 20501 Float64x2::InstanceSize(),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
20553 double _y = y(); 20561 double _y = y();
20554 // Calculate the size of the string. 20562 // Calculate the size of the string.
20555 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y) + 1; 20563 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y) + 1;
20556 char* chars = Thread::Current()->zone()->Alloc<char>(len); 20564 char* chars = Thread::Current()->zone()->Alloc<char>(len);
20557 OS::SNPrint(chars, len, kFormat, _x, _y); 20565 OS::SNPrint(chars, len, kFormat, _x, _y);
20558 return chars; 20566 return chars;
20559 } 20567 }
20560 20568
20561 20569
20562 void Float64x2::PrintJSONImpl(JSONStream* stream, bool ref) const { 20570 void Float64x2::PrintJSONImpl(JSONStream* stream, bool ref) const {
20563 Instance::PrintJSONImpl(stream, ref); 20571 JSONObject jsobj(stream);
20572 PrintSharedInstanceJSON(&jsobj, ref);
20573 jsobj.AddProperty("kind", "Float64x2");
20574 jsobj.AddServiceId(*this);
20575 jsobj.AddProperty("valueAsString", ToCString());
20564 } 20576 }
20565 20577
20566 20578
20567 const intptr_t TypedData::element_size_table[TypedData::kNumElementSizes] = { 20579 const intptr_t TypedData::element_size_table[TypedData::kNumElementSizes] = {
20568 1, // kTypedDataInt8ArrayCid. 20580 1, // kTypedDataInt8ArrayCid.
20569 1, // kTypedDataUint8ArrayCid. 20581 1, // kTypedDataUint8ArrayCid.
20570 1, // kTypedDataUint8ClampedArrayCid. 20582 1, // kTypedDataUint8ClampedArrayCid.
20571 2, // kTypedDataInt16ArrayCid. 20583 2, // kTypedDataInt16ArrayCid.
20572 2, // kTypedDataUint16ArrayCid. 20584 2, // kTypedDataUint16ArrayCid.
20573 4, // kTypedDataInt32ArrayCid. 20585 4, // kTypedDataInt32ArrayCid.
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
20915 NoSafepointScope no_safepoint; 20927 NoSafepointScope no_safepoint;
20916 result ^= raw; 20928 result ^= raw;
20917 } 20929 }
20918 result.set_code_array(code_array); 20930 result.set_code_array(code_array);
20919 result.set_pc_offset_array(pc_offset_array); 20931 result.set_pc_offset_array(pc_offset_array);
20920 result.set_expand_inlined(true); // default. 20932 result.set_expand_inlined(true); // default.
20921 return result.raw(); 20933 return result.raw();
20922 } 20934 }
20923 20935
20924 20936
20925 RawString* Stacktrace::FullStacktrace() const {
20926 intptr_t idx = 0;
20927 return String::New(ToCStringInternal(&idx));
20928 }
20929
20930
20931 const char* Stacktrace::ToCString() const { 20937 const char* Stacktrace::ToCString() const {
20932 const String& trace = String::Handle(FullStacktrace()); 20938 intptr_t idx = 0;
20933 return trace.ToCString(); 20939 return ToCStringInternal(&idx);
20934 } 20940 }
20935 20941
20936 20942
20937 void Stacktrace::PrintJSONImpl(JSONStream* stream, bool ref) const { 20943 void Stacktrace::PrintJSONImpl(JSONStream* stream, bool ref) const {
20938 Instance::PrintJSONImpl(stream, ref); 20944 JSONObject jsobj(stream);
20945 PrintSharedInstanceJSON(&jsobj, ref);
20946 jsobj.AddProperty("kind", "StackTrace");
20947 jsobj.AddServiceId(*this);
20948 intptr_t idx = 0;
20949 jsobj.AddProperty("valueAsString", ToCStringInternal(&idx));
20939 } 20950 }
20940 20951
20941 20952
20942 static intptr_t PrintOneStacktrace(Zone* zone, 20953 static intptr_t PrintOneStacktrace(Zone* zone,
20943 GrowableArray<char*>* frame_strings, 20954 GrowableArray<char*>* frame_strings,
20944 uword pc, 20955 uword pc,
20945 const Function& function, 20956 const Function& function,
20946 const Code& code, 20957 const Code& code,
20947 intptr_t frame_index) { 20958 intptr_t frame_index) {
20948 const char* kFormatWithCol = "#%-6d %s (%s:%d:%d)\n"; 20959 const char* kFormatWithCol = "#%-6d %s (%s:%d:%d)\n";
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
21421 return tag_label.ToCString(); 21432 return tag_label.ToCString();
21422 } 21433 }
21423 21434
21424 21435
21425 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21436 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21426 Instance::PrintJSONImpl(stream, ref); 21437 Instance::PrintJSONImpl(stream, ref);
21427 } 21438 }
21428 21439
21429 21440
21430 } // namespace dart 21441 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698