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 13447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13458 index * TestEntryLength() + CountIndexFor(NumArgsTested()); | 13458 index * TestEntryLength() + CountIndexFor(NumArgsTested()); |
13459 data.SetAt(data_pos, Smi::Handle(Smi::New(value))); | 13459 data.SetAt(data_pos, Smi::Handle(Smi::New(value))); |
13460 } | 13460 } |
13461 | 13461 |
13462 | 13462 |
13463 intptr_t ICData::GetCountAt(intptr_t index) const { | 13463 intptr_t ICData::GetCountAt(intptr_t index) const { |
13464 ASSERT(Isolate::Current()->compilation_allowed()); | 13464 ASSERT(Isolate::Current()->compilation_allowed()); |
13465 const Array& data = Array::Handle(ic_data()); | 13465 const Array& data = Array::Handle(ic_data()); |
13466 const intptr_t data_pos = | 13466 const intptr_t data_pos = |
13467 index * TestEntryLength() + CountIndexFor(NumArgsTested()); | 13467 index * TestEntryLength() + CountIndexFor(NumArgsTested()); |
13468 if (data_pos < 0) { | |
regis
2017/01/24 18:27:21
Can you explain with a comment how this is possibl
| |
13469 // Overflow. | |
13470 SetCountAt(index, 0); | |
13471 return 0; | |
13472 } | |
13468 return Smi::Value(Smi::RawCast(data.At(data_pos))); | 13473 return Smi::Value(Smi::RawCast(data.At(data_pos))); |
13469 } | 13474 } |
13470 | 13475 |
13471 | 13476 |
13472 intptr_t ICData::AggregateCount() const { | 13477 intptr_t ICData::AggregateCount() const { |
13473 if (IsNull()) return 0; | 13478 if (IsNull()) return 0; |
13474 const intptr_t len = NumberOfChecks(); | 13479 const intptr_t len = NumberOfChecks(); |
13475 intptr_t count = 0; | 13480 intptr_t count = 0; |
13476 for (intptr_t i = 0; i < len; i++) { | 13481 for (intptr_t i = 0; i < len; i++) { |
13477 count += GetCountAt(i); | 13482 count += GetCountAt(i); |
(...skipping 9539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
23017 return UserTag::null(); | 23022 return UserTag::null(); |
23018 } | 23023 } |
23019 | 23024 |
23020 | 23025 |
23021 const char* UserTag::ToCString() const { | 23026 const char* UserTag::ToCString() const { |
23022 const String& tag_label = String::Handle(label()); | 23027 const String& tag_label = String::Handle(label()); |
23023 return tag_label.ToCString(); | 23028 return tag_label.ToCString(); |
23024 } | 23029 } |
23025 | 23030 |
23026 } // namespace dart | 23031 } // namespace dart |
OLD | NEW |