| 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 11386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11397 } | 11397 } |
| 11398 | 11398 |
| 11399 | 11399 |
| 11400 // Verify assumptions (in debug mode only). | 11400 // Verify assumptions (in debug mode only). |
| 11401 // - No two deopt descriptors have the same deoptimization id. | 11401 // - No two deopt descriptors have the same deoptimization id. |
| 11402 // - No two ic-call descriptors have the same deoptimization id (type feedback). | 11402 // - No two ic-call descriptors have the same deoptimization id (type feedback). |
| 11403 // A function without unique ids is marked as non-optimizable (e.g., because of | 11403 // A function without unique ids is marked as non-optimizable (e.g., because of |
| 11404 // finally blocks). | 11404 // finally blocks). |
| 11405 void PcDescriptors::Verify(const Function& function) const { | 11405 void PcDescriptors::Verify(const Function& function) const { |
| 11406 #if defined(DEBUG) | 11406 #if defined(DEBUG) |
| 11407 // TODO(srdjan): Implement a more efficient way to check, currently drop | |
| 11408 // the check for too large number of descriptors. | |
| 11409 if (Length() > 3000) { | |
| 11410 if (FLAG_trace_compiler) { | |
| 11411 OS::Print("Not checking pc decriptors, length %" Pd "\n", Length()); | |
| 11412 } | |
| 11413 return; | |
| 11414 } | |
| 11415 // Only check ids for unoptimized code that is optimizable. | 11407 // Only check ids for unoptimized code that is optimizable. |
| 11416 if (!function.IsOptimizable()) { | 11408 if (!function.IsOptimizable()) { |
| 11417 return; | 11409 return; |
| 11418 } | 11410 } |
| 11411 intptr_t max_deopt_id = 0; |
| 11412 Iterator max_iter(*this, |
| 11413 RawPcDescriptors::kDeopt | RawPcDescriptors::kIcCall); |
| 11414 while (max_iter.MoveNext()) { |
| 11415 if (max_iter.DeoptId() > max_deopt_id) { |
| 11416 max_deopt_id = max_iter.DeoptId(); |
| 11417 } |
| 11418 } |
| 11419 |
| 11420 Zone* zone = Thread::Current()->zone(); |
| 11421 BitVector* deopt_ids = new(zone) BitVector(zone, max_deopt_id + 1); |
| 11422 BitVector* iccall_ids = new(zone) BitVector(zone, max_deopt_id + 1); |
| 11419 Iterator iter(*this, RawPcDescriptors::kDeopt | RawPcDescriptors::kIcCall); | 11423 Iterator iter(*this, RawPcDescriptors::kDeopt | RawPcDescriptors::kIcCall); |
| 11420 while (iter.MoveNext()) { | 11424 while (iter.MoveNext()) { |
| 11421 // 'deopt_id' is set for kDeopt and kIcCall and must be unique for one kind. | 11425 // 'deopt_id' is set for kDeopt and kIcCall and must be unique for one kind. |
| 11422 if (Thread::IsDeoptAfter(iter.DeoptId())) { | 11426 if (Thread::IsDeoptAfter(iter.DeoptId())) { |
| 11423 // TODO(vegorov): some instructions contain multiple calls and have | 11427 // TODO(vegorov): some instructions contain multiple calls and have |
| 11424 // multiple "after" targets recorded. Right now it is benign but might | 11428 // multiple "after" targets recorded. Right now it is benign but might |
| 11425 // lead to issues in the future. Fix that and enable verification. | 11429 // lead to issues in the future. Fix that and enable verification. |
| 11426 continue; | 11430 continue; |
| 11427 } | 11431 } |
| 11428 | 11432 if (iter.Kind() == RawPcDescriptors::kDeopt) { |
| 11429 Iterator nested(iter); | 11433 ASSERT(!deopt_ids->Contains(iter.DeoptId())); |
| 11430 while (nested.MoveNext()) { | 11434 deopt_ids->Add(iter.DeoptId()); |
| 11431 if (iter.Kind() == nested.Kind()) { | 11435 } else { |
| 11432 ASSERT(nested.DeoptId() != iter.DeoptId()); | 11436 ASSERT(!iccall_ids->Contains(iter.DeoptId())); |
| 11433 } | 11437 iccall_ids->Add(iter.DeoptId()); |
| 11434 } | 11438 } |
| 11435 } | 11439 } |
| 11436 #endif // DEBUG | 11440 #endif // DEBUG |
| 11437 } | 11441 } |
| 11438 | 11442 |
| 11439 | 11443 |
| 11440 bool Stackmap::GetBit(intptr_t bit_index) const { | 11444 bool Stackmap::GetBit(intptr_t bit_index) const { |
| 11441 ASSERT(InRange(bit_index)); | 11445 ASSERT(InRange(bit_index)); |
| 11442 int byte_index = bit_index >> kBitsPerByteLog2; | 11446 int byte_index = bit_index >> kBitsPerByteLog2; |
| 11443 int bit_remainder = bit_index & (kBitsPerByte - 1); | 11447 int bit_remainder = bit_index & (kBitsPerByte - 1); |
| (...skipping 10263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21707 return tag_label.ToCString(); | 21711 return tag_label.ToCString(); |
| 21708 } | 21712 } |
| 21709 | 21713 |
| 21710 | 21714 |
| 21711 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21715 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21712 Instance::PrintJSONImpl(stream, ref); | 21716 Instance::PrintJSONImpl(stream, ref); |
| 21713 } | 21717 } |
| 21714 | 21718 |
| 21715 | 21719 |
| 21716 } // namespace dart | 21720 } // namespace dart |
| OLD | NEW |