OLD | NEW |
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 20394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20405 float _w = w(); | 20405 float _w = w(); |
20406 // Calculate the size of the string. | 20406 // Calculate the size of the string. |
20407 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; | 20407 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; |
20408 char* chars = Thread::Current()->zone()->Alloc<char>(len); | 20408 char* chars = Thread::Current()->zone()->Alloc<char>(len); |
20409 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); | 20409 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); |
20410 return chars; | 20410 return chars; |
20411 } | 20411 } |
20412 | 20412 |
20413 | 20413 |
20414 void Float32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20414 void Float32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20415 Instance::PrintJSONImpl(stream, ref); | 20415 JSONObject jsobj(stream); |
| 20416 PrintSharedInstanceJSON(&jsobj, ref); |
| 20417 jsobj.AddProperty("kind", "Float32x4"); |
| 20418 jsobj.AddServiceId(*this); |
| 20419 jsobj.AddProperty("valueAsString", ToCString()); |
20416 } | 20420 } |
20417 | 20421 |
20418 | 20422 |
20419 RawInt32x4* Int32x4::New(int32_t v0, int32_t v1, int32_t v2, int32_t v3, | 20423 RawInt32x4* Int32x4::New(int32_t v0, int32_t v1, int32_t v2, int32_t v3, |
20420 Heap::Space space) { | 20424 Heap::Space space) { |
20421 ASSERT(Isolate::Current()->object_store()->int32x4_class() != | 20425 ASSERT(Isolate::Current()->object_store()->int32x4_class() != |
20422 Class::null()); | 20426 Class::null()); |
20423 Int32x4& result = Int32x4::Handle(); | 20427 Int32x4& result = Int32x4::Handle(); |
20424 { | 20428 { |
20425 RawObject* raw = Object::Allocate(Int32x4::kClassId, | 20429 RawObject* raw = Object::Allocate(Int32x4::kClassId, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20510 int32_t _w = w(); | 20514 int32_t _w = w(); |
20511 // Calculate the size of the string. | 20515 // Calculate the size of the string. |
20512 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; | 20516 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; |
20513 char* chars = Thread::Current()->zone()->Alloc<char>(len); | 20517 char* chars = Thread::Current()->zone()->Alloc<char>(len); |
20514 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); | 20518 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); |
20515 return chars; | 20519 return chars; |
20516 } | 20520 } |
20517 | 20521 |
20518 | 20522 |
20519 void Int32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20523 void Int32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20520 Instance::PrintJSONImpl(stream, ref); | 20524 JSONObject jsobj(stream); |
| 20525 PrintSharedInstanceJSON(&jsobj, ref); |
| 20526 jsobj.AddProperty("kind", "Int32x4"); |
| 20527 jsobj.AddServiceId(*this); |
| 20528 jsobj.AddProperty("valueAsString", ToCString()); |
20521 } | 20529 } |
20522 | 20530 |
20523 | 20531 |
20524 RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) { | 20532 RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) { |
20525 ASSERT(Isolate::Current()->object_store()->float64x2_class() != | 20533 ASSERT(Isolate::Current()->object_store()->float64x2_class() != |
20526 Class::null()); | 20534 Class::null()); |
20527 Float64x2& result = Float64x2::Handle(); | 20535 Float64x2& result = Float64x2::Handle(); |
20528 { | 20536 { |
20529 RawObject* raw = Object::Allocate(Float64x2::kClassId, | 20537 RawObject* raw = Object::Allocate(Float64x2::kClassId, |
20530 Float64x2::InstanceSize(), | 20538 Float64x2::InstanceSize(), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20590 double _y = y(); | 20598 double _y = y(); |
20591 // Calculate the size of the string. | 20599 // Calculate the size of the string. |
20592 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y) + 1; | 20600 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y) + 1; |
20593 char* chars = Thread::Current()->zone()->Alloc<char>(len); | 20601 char* chars = Thread::Current()->zone()->Alloc<char>(len); |
20594 OS::SNPrint(chars, len, kFormat, _x, _y); | 20602 OS::SNPrint(chars, len, kFormat, _x, _y); |
20595 return chars; | 20603 return chars; |
20596 } | 20604 } |
20597 | 20605 |
20598 | 20606 |
20599 void Float64x2::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20607 void Float64x2::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20600 Instance::PrintJSONImpl(stream, ref); | 20608 JSONObject jsobj(stream); |
| 20609 PrintSharedInstanceJSON(&jsobj, ref); |
| 20610 jsobj.AddProperty("kind", "Float64x2"); |
| 20611 jsobj.AddServiceId(*this); |
| 20612 jsobj.AddProperty("valueAsString", ToCString()); |
20601 } | 20613 } |
20602 | 20614 |
20603 | 20615 |
20604 const intptr_t TypedData::element_size_table[TypedData::kNumElementSizes] = { | 20616 const intptr_t TypedData::element_size_table[TypedData::kNumElementSizes] = { |
20605 1, // kTypedDataInt8ArrayCid. | 20617 1, // kTypedDataInt8ArrayCid. |
20606 1, // kTypedDataUint8ArrayCid. | 20618 1, // kTypedDataUint8ArrayCid. |
20607 1, // kTypedDataUint8ClampedArrayCid. | 20619 1, // kTypedDataUint8ClampedArrayCid. |
20608 2, // kTypedDataInt16ArrayCid. | 20620 2, // kTypedDataInt16ArrayCid. |
20609 2, // kTypedDataUint16ArrayCid. | 20621 2, // kTypedDataUint16ArrayCid. |
20610 4, // kTypedDataInt32ArrayCid. | 20622 4, // kTypedDataInt32ArrayCid. |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20952 NoSafepointScope no_safepoint; | 20964 NoSafepointScope no_safepoint; |
20953 result ^= raw; | 20965 result ^= raw; |
20954 } | 20966 } |
20955 result.set_code_array(code_array); | 20967 result.set_code_array(code_array); |
20956 result.set_pc_offset_array(pc_offset_array); | 20968 result.set_pc_offset_array(pc_offset_array); |
20957 result.set_expand_inlined(true); // default. | 20969 result.set_expand_inlined(true); // default. |
20958 return result.raw(); | 20970 return result.raw(); |
20959 } | 20971 } |
20960 | 20972 |
20961 | 20973 |
20962 RawString* Stacktrace::FullStacktrace() const { | |
20963 intptr_t idx = 0; | |
20964 return String::New(ToCStringInternal(&idx)); | |
20965 } | |
20966 | |
20967 | |
20968 const char* Stacktrace::ToCString() const { | 20974 const char* Stacktrace::ToCString() const { |
20969 const String& trace = String::Handle(FullStacktrace()); | 20975 intptr_t idx = 0; |
20970 return trace.ToCString(); | 20976 return ToCStringInternal(&idx); |
20971 } | 20977 } |
20972 | 20978 |
20973 | 20979 |
20974 void Stacktrace::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20980 void Stacktrace::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20975 Instance::PrintJSONImpl(stream, ref); | 20981 JSONObject jsobj(stream); |
| 20982 PrintSharedInstanceJSON(&jsobj, ref); |
| 20983 jsobj.AddProperty("kind", "StackTrace"); |
| 20984 jsobj.AddServiceId(*this); |
| 20985 intptr_t idx = 0; |
| 20986 jsobj.AddProperty("valueAsString", ToCStringInternal(&idx)); |
20976 } | 20987 } |
20977 | 20988 |
20978 | 20989 |
20979 static intptr_t PrintOneStacktrace(Zone* zone, | 20990 static intptr_t PrintOneStacktrace(Zone* zone, |
20980 GrowableArray<char*>* frame_strings, | 20991 GrowableArray<char*>* frame_strings, |
20981 uword pc, | 20992 uword pc, |
20982 const Function& function, | 20993 const Function& function, |
20983 const Code& code, | 20994 const Code& code, |
20984 intptr_t frame_index) { | 20995 intptr_t frame_index) { |
20985 const char* kFormatWithCol = "#%-6d %s (%s:%d:%d)\n"; | 20996 const char* kFormatWithCol = "#%-6d %s (%s:%d:%d)\n"; |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21458 return tag_label.ToCString(); | 21469 return tag_label.ToCString(); |
21459 } | 21470 } |
21460 | 21471 |
21461 | 21472 |
21462 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21473 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21463 Instance::PrintJSONImpl(stream, ref); | 21474 Instance::PrintJSONImpl(stream, ref); |
21464 } | 21475 } |
21465 | 21476 |
21466 | 21477 |
21467 } // namespace dart | 21478 } // namespace dart |
OLD | NEW |