| 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 14717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14728 } | 14728 } |
| 14729 } | 14729 } |
| 14730 | 14730 |
| 14731 | 14731 |
| 14732 void MegamorphicCache::Insert(const Smi& class_id, | 14732 void MegamorphicCache::Insert(const Smi& class_id, |
| 14733 const Function& target) const { | 14733 const Function& target) const { |
| 14734 ASSERT(static_cast<double>(filled_entry_count() + 1) <= | 14734 ASSERT(static_cast<double>(filled_entry_count() + 1) <= |
| 14735 (kLoadFactor * static_cast<double>(mask() + 1))); | 14735 (kLoadFactor * static_cast<double>(mask() + 1))); |
| 14736 const Array& backing_array = Array::Handle(buckets()); | 14736 const Array& backing_array = Array::Handle(buckets()); |
| 14737 intptr_t id_mask = mask(); | 14737 intptr_t id_mask = mask(); |
| 14738 intptr_t index = class_id.Value() & id_mask; | 14738 intptr_t index = (class_id.Value() * kSpreadFactor) & id_mask; |
| 14739 intptr_t i = index; | 14739 intptr_t i = index; |
| 14740 do { | 14740 do { |
| 14741 if (Smi::Value(Smi::RawCast(GetClassId(backing_array, i))) == kIllegalCid) { | 14741 if (Smi::Value(Smi::RawCast(GetClassId(backing_array, i))) == kIllegalCid) { |
| 14742 SetEntry(backing_array, i, class_id, target); | 14742 SetEntry(backing_array, i, class_id, target); |
| 14743 set_filled_entry_count(filled_entry_count() + 1); | 14743 set_filled_entry_count(filled_entry_count() + 1); |
| 14744 return; | 14744 return; |
| 14745 } | 14745 } |
| 14746 i = (i + 1) & id_mask; | 14746 i = (i + 1) & id_mask; |
| 14747 } while (i != index); | 14747 } while (i != index); |
| 14748 UNREACHABLE(); | 14748 UNREACHABLE(); |
| (...skipping 7861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22610 return UserTag::null(); | 22610 return UserTag::null(); |
| 22611 } | 22611 } |
| 22612 | 22612 |
| 22613 | 22613 |
| 22614 const char* UserTag::ToCString() const { | 22614 const char* UserTag::ToCString() const { |
| 22615 const String& tag_label = String::Handle(label()); | 22615 const String& tag_label = String::Handle(label()); |
| 22616 return tag_label.ToCString(); | 22616 return tag_label.ToCString(); |
| 22617 } | 22617 } |
| 22618 | 22618 |
| 22619 } // namespace dart | 22619 } // namespace dart |
| OLD | NEW |