| 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/become.h" | 10 #include "vm/become.h" |
| (...skipping 13467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13478 index * TestEntryLength() + CountIndexFor(NumArgsTested()); | 13478 index * TestEntryLength() + CountIndexFor(NumArgsTested()); |
| 13479 data.SetAt(data_pos, Smi::Handle(Smi::New(value))); | 13479 data.SetAt(data_pos, Smi::Handle(Smi::New(value))); |
| 13480 } | 13480 } |
| 13481 | 13481 |
| 13482 | 13482 |
| 13483 intptr_t ICData::GetCountAt(intptr_t index) const { | 13483 intptr_t ICData::GetCountAt(intptr_t index) const { |
| 13484 ASSERT(Isolate::Current()->compilation_allowed()); | 13484 ASSERT(Isolate::Current()->compilation_allowed()); |
| 13485 const Array& data = Array::Handle(ic_data()); | 13485 const Array& data = Array::Handle(ic_data()); |
| 13486 const intptr_t data_pos = | 13486 const intptr_t data_pos = |
| 13487 index * TestEntryLength() + CountIndexFor(NumArgsTested()); | 13487 index * TestEntryLength() + CountIndexFor(NumArgsTested()); |
| 13488 return Smi::Value(Smi::RawCast(data.At(data_pos))); | 13488 intptr_t value = Smi::Value(Smi::RawCast(data.At(data_pos))); |
| 13489 if (value >= 0) return value; |
| 13490 |
| 13491 // The counter very rarely overflows to a negative value, but if it does, we |
| 13492 // would rather just reset it to zero. |
| 13493 SetCountAt(index, 0); |
| 13494 return 0; |
| 13489 } | 13495 } |
| 13490 | 13496 |
| 13491 | 13497 |
| 13492 intptr_t ICData::AggregateCount() const { | 13498 intptr_t ICData::AggregateCount() const { |
| 13493 if (IsNull()) return 0; | 13499 if (IsNull()) return 0; |
| 13494 const intptr_t len = NumberOfChecks(); | 13500 const intptr_t len = NumberOfChecks(); |
| 13495 intptr_t count = 0; | 13501 intptr_t count = 0; |
| 13496 for (intptr_t i = 0; i < len; i++) { | 13502 for (intptr_t i = 0; i < len; i++) { |
| 13497 count += GetCountAt(i); | 13503 count += GetCountAt(i); |
| 13498 } | 13504 } |
| (...skipping 9547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23046 return UserTag::null(); | 23052 return UserTag::null(); |
| 23047 } | 23053 } |
| 23048 | 23054 |
| 23049 | 23055 |
| 23050 const char* UserTag::ToCString() const { | 23056 const char* UserTag::ToCString() const { |
| 23051 const String& tag_label = String::Handle(label()); | 23057 const String& tag_label = String::Handle(label()); |
| 23052 return tag_label.ToCString(); | 23058 return tag_label.ToCString(); |
| 23053 } | 23059 } |
| 23054 | 23060 |
| 23055 } // namespace dart | 23061 } // namespace dart |
| OLD | NEW |