Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: runtime/vm/object.cc

Issue 1998263002: Include multiplication in the megamorphic cache hash to avoid cid ranges overlapping modulo table s… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698