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 10223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10234 RawPcDescriptors* PcDescriptors::New(intptr_t num_descriptors, | 10234 RawPcDescriptors* PcDescriptors::New(intptr_t num_descriptors, |
10235 bool has_try_index) { | 10235 bool has_try_index) { |
10236 ASSERT(Object::pc_descriptors_class() != Class::null()); | 10236 ASSERT(Object::pc_descriptors_class() != Class::null()); |
10237 if (num_descriptors < 0 || num_descriptors > kMaxElements) { | 10237 if (num_descriptors < 0 || num_descriptors > kMaxElements) { |
10238 // This should be caught before we reach here. | 10238 // This should be caught before we reach here. |
10239 FATAL1("Fatal error in PcDescriptors::New: " | 10239 FATAL1("Fatal error in PcDescriptors::New: " |
10240 "invalid num_descriptors %" Pd "\n", num_descriptors); | 10240 "invalid num_descriptors %" Pd "\n", num_descriptors); |
10241 } | 10241 } |
10242 PcDescriptors& result = PcDescriptors::Handle(); | 10242 PcDescriptors& result = PcDescriptors::Handle(); |
10243 { | 10243 { |
10244 uword size = PcDescriptors::InstanceSize(num_descriptors, | 10244 const intptr_t rec_size = RawPcDescriptors::RecordSize(has_try_index); |
10245 has_try_index ? RawPcDescriptors::kFullRecSize | 10245 uword size = PcDescriptors::InstanceSize(num_descriptors, rec_size); |
10246 : RawPcDescriptors::kCompressedRecSize); | |
10247 RawObject* raw = Object::Allocate(PcDescriptors::kClassId, | 10246 RawObject* raw = Object::Allocate(PcDescriptors::kClassId, |
10248 size, | 10247 size, |
10249 Heap::kOld); | 10248 Heap::kOld); |
10250 NoGCScope no_gc; | 10249 NoGCScope no_gc; |
10251 result ^= raw; | 10250 result ^= raw; |
10252 result.SetLength(num_descriptors); | 10251 result.SetLength(num_descriptors); |
10253 if (has_try_index) { | 10252 result.SetRecordSizeInBytes(rec_size); |
10254 result.SetRecordSizeInBytes(RawPcDescriptors::kFullRecSize); | |
10255 } else { | |
10256 result.SetRecordSizeInBytes(RawPcDescriptors::kCompressedRecSize); | |
10257 } | |
10258 } | 10253 } |
10259 return result.raw(); | 10254 return result.raw(); |
10260 } | 10255 } |
10261 | 10256 |
10262 | 10257 |
10263 const char* PcDescriptors::KindAsStr(RawPcDescriptors::Kind kind) { | 10258 const char* PcDescriptors::KindAsStr(RawPcDescriptors::Kind kind) { |
10264 switch (kind) { | 10259 switch (kind) { |
10265 case RawPcDescriptors::kDeopt: return "deopt "; | 10260 case RawPcDescriptors::kDeopt: return "deopt "; |
10266 case RawPcDescriptors::kIcCall: return "ic-call "; | 10261 case RawPcDescriptors::kIcCall: return "ic-call "; |
10267 case RawPcDescriptors::kOptStaticCall: return "opt-call "; | 10262 case RawPcDescriptors::kOptStaticCall: return "opt-call "; |
(...skipping 8833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19101 return tag_label.ToCString(); | 19096 return tag_label.ToCString(); |
19102 } | 19097 } |
19103 | 19098 |
19104 | 19099 |
19105 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19100 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
19106 Instance::PrintJSONImpl(stream, ref); | 19101 Instance::PrintJSONImpl(stream, ref); |
19107 } | 19102 } |
19108 | 19103 |
19109 | 19104 |
19110 } // namespace dart | 19105 } // namespace dart |
OLD | NEW |