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

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

Issue 2809583002: Use off-heap data for type feedback in PolymorphicInstanceCallInstr (Closed)
Patch Set: Created 3 years, 8 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
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/become.h" 10 #include "vm/become.h"
(...skipping 4482 matching lines...) Expand 10 before | Expand all | Expand 10 after
4493 } 4493 }
4494 4494
4495 4495
4496 void Class::InsertCanonicalNumber(Zone* zone, 4496 void Class::InsertCanonicalNumber(Zone* zone,
4497 intptr_t index, 4497 intptr_t index,
4498 const Number& constant) const { 4498 const Number& constant) const {
4499 // The constant needs to be added to the list. Grow the list if it is full. 4499 // The constant needs to be added to the list. Grow the list if it is full.
4500 Array& canonical_list = Array::Handle(zone, constants()); 4500 Array& canonical_list = Array::Handle(zone, constants());
4501 const intptr_t list_len = canonical_list.Length(); 4501 const intptr_t list_len = canonical_list.Length();
4502 if (index >= list_len) { 4502 if (index >= list_len) {
4503 const intptr_t new_length = (list_len == 0) ? 4 : list_len + 4; 4503 const intptr_t new_length = list_len + 4 + (list_len >> 2);
Vyacheslav Egorov (Google) 2017/04/10 10:59:28 This CL contains seemingly unrelated changes in th
erikcorry 2017/04/19 15:06:41 Done.
4504 canonical_list ^= Array::Grow(canonical_list, new_length, Heap::kOld); 4504 canonical_list ^= Array::Grow(canonical_list, new_length, Heap::kOld);
4505 set_constants(canonical_list); 4505 set_constants(canonical_list);
4506 } 4506 }
4507 canonical_list.SetAt(index, constant); 4507 canonical_list.SetAt(index, constant);
4508 } 4508 }
4509 4509
4510 4510
4511 void Class::RehashConstants(Zone* zone) const { 4511 void Class::RehashConstants(Zone* zone) const {
4512 intptr_t cid = id(); 4512 intptr_t cid = id();
4513 if ((cid == kMintCid) || (cid == kBigintCid) || (cid == kDoubleCid)) { 4513 if ((cid == kMintCid) || (cid == kBigintCid) || (cid == kDoubleCid)) {
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
5043 // Instantiation did not result in bound error. Canonicalize type arguments. 5043 // Instantiation did not result in bound error. Canonicalize type arguments.
5044 result = result.Canonicalize(); 5044 result = result.Canonicalize();
5045 // InstantiateAndCanonicalizeFrom is not reentrant. It cannot have been called 5045 // InstantiateAndCanonicalizeFrom is not reentrant. It cannot have been called
5046 // indirectly, so the prior_instantiations array cannot have grown. 5046 // indirectly, so the prior_instantiations array cannot have grown.
5047 ASSERT(prior_instantiations.raw() == instantiations()); 5047 ASSERT(prior_instantiations.raw() == instantiations());
5048 // Add instantiator and result to instantiations array. 5048 // Add instantiator and result to instantiations array.
5049 intptr_t length = prior_instantiations.Length(); 5049 intptr_t length = prior_instantiations.Length();
5050 if ((index + 2) >= length) { 5050 if ((index + 2) >= length) {
5051 // Grow the instantiations array. 5051 // Grow the instantiations array.
5052 // The initial array is Object::zero_array() of length 1. 5052 // The initial array is Object::zero_array() of length 1.
5053 length = (length > 64) ? (length + 64) 5053 length = length + 2 + (length >> 2);
5054 : ((length == 1) ? 3 : ((length - 1) * 2 + 1));
5055 prior_instantiations = 5054 prior_instantiations =
5056 Array::Grow(prior_instantiations, length, Heap::kOld); 5055 Array::Grow(prior_instantiations, length, Heap::kOld);
5057 set_instantiations(prior_instantiations); 5056 set_instantiations(prior_instantiations);
5058 ASSERT((index + 2) < length); 5057 ASSERT((index + 2) < length);
5059 } 5058 }
5060 prior_instantiations.SetAt(index, instantiator_type_arguments); 5059 prior_instantiations.SetAt(index, instantiator_type_arguments);
5061 prior_instantiations.SetAt(index + 1, result); 5060 prior_instantiations.SetAt(index + 1, result);
5062 prior_instantiations.SetAt(index + 2, 5061 prior_instantiations.SetAt(index + 2,
5063 Smi::Handle(Smi::New(StubCode::kNoInstantiator))); 5062 Smi::Handle(Smi::New(StubCode::kNoInstantiator)));
5064 return result.raw(); 5063 return result.raw();
(...skipping 5672 matching lines...) Expand 10 before | Expand all | Expand 10 after
10737 StorePointer(&raw_ptr()->imports_, Object::empty_array().raw()); 10736 StorePointer(&raw_ptr()->imports_, Object::empty_array().raw());
10738 StorePointer(&raw_ptr()->exports_, Object::empty_array().raw()); 10737 StorePointer(&raw_ptr()->exports_, Object::empty_array().raw());
10739 StoreNonPointer(&raw_ptr()->num_imports_, 0); 10738 StoreNonPointer(&raw_ptr()->num_imports_, 0);
10740 } 10739 }
10741 10740
10742 10741
10743 void Library::AddImport(const Namespace& ns) const { 10742 void Library::AddImport(const Namespace& ns) const {
10744 Array& imports = Array::Handle(this->imports()); 10743 Array& imports = Array::Handle(this->imports());
10745 intptr_t capacity = imports.Length(); 10744 intptr_t capacity = imports.Length();
10746 if (num_imports() == capacity) { 10745 if (num_imports() == capacity) {
10747 capacity = capacity + kImportsCapacityIncrement; 10746 capacity = capacity + kImportsCapacityIncrement + (capacity >> 2);
10748 imports = Array::Grow(imports, capacity); 10747 imports = Array::Grow(imports, capacity);
10749 StorePointer(&raw_ptr()->imports_, imports.raw()); 10748 StorePointer(&raw_ptr()->imports_, imports.raw());
10750 } 10749 }
10751 intptr_t index = num_imports(); 10750 intptr_t index = num_imports();
10752 imports.SetAt(index, ns); 10751 imports.SetAt(index, ns);
10753 set_num_imports(index + 1); 10752 set_num_imports(index + 1);
10754 } 10753 }
10755 10754
10756 10755
10757 // Convenience function to determine whether the export list is 10756 // Convenience function to determine whether the export list is
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
11297 intptr_t num_current_imports = num_imports(); 11296 intptr_t num_current_imports = num_imports();
11298 11297
11299 // Prefixes with deferred libraries can only contain one library. 11298 // Prefixes with deferred libraries can only contain one library.
11300 ASSERT((num_current_imports == 0) || !is_deferred_load()); 11299 ASSERT((num_current_imports == 0) || !is_deferred_load());
11301 11300
11302 // The library needs to be added to the list. 11301 // The library needs to be added to the list.
11303 Array& imports = Array::Handle(this->imports()); 11302 Array& imports = Array::Handle(this->imports());
11304 const intptr_t length = (imports.IsNull()) ? 0 : imports.Length(); 11303 const intptr_t length = (imports.IsNull()) ? 0 : imports.Length();
11305 // Grow the list if it is full. 11304 // Grow the list if it is full.
11306 if (num_current_imports >= length) { 11305 if (num_current_imports >= length) {
11307 const intptr_t new_length = length + kIncrementSize; 11306 const intptr_t new_length = length + kIncrementSize + (length >> 2);
11308 imports = Array::Grow(imports, new_length, Heap::kOld); 11307 imports = Array::Grow(imports, new_length, Heap::kOld);
11309 set_imports(imports); 11308 set_imports(imports);
11310 } 11309 }
11311 imports.SetAt(num_current_imports, import); 11310 imports.SetAt(num_current_imports, import);
11312 set_num_imports(num_current_imports + 1); 11311 set_num_imports(num_current_imports + 1);
11313 } 11312 }
11314 11313
11315 11314
11316 RawObject* LibraryPrefix::LookupObject(const String& name) const { 11315 RawObject* LibraryPrefix::LookupObject(const String& name) const {
11317 if (!is_loaded() && !FLAG_load_deferred_eagerly) { 11316 if (!is_loaded() && !FLAG_load_deferred_eagerly) {
(...skipping 2428 matching lines...) Expand 10 before | Expand all | Expand 10 after
13746 const intptr_t len = NumberOfChecks(); 13745 const intptr_t len = NumberOfChecks();
13747 for (intptr_t i = 1; i < len; i++) { 13746 for (intptr_t i = 1; i < len; i++) {
13748 if (IsUsedAt(i) && (GetTargetAt(i) != first_target.raw())) { 13747 if (IsUsedAt(i) && (GetTargetAt(i) != first_target.raw())) {
13749 return false; 13748 return false;
13750 } 13749 }
13751 } 13750 }
13752 return true; 13751 return true;
13753 } 13752 }
13754 13753
13755 13754
13756 bool ICData::HasOnlyDispatcherOrImplicitAccessorTargets() const {
13757 const intptr_t len = NumberOfChecks();
13758 Function& target = Function::Handle();
13759 for (intptr_t i = 0; i < len; i++) {
13760 target = GetTargetAt(i);
13761 if (!target.IsDispatcherOrImplicitAccessor()) {
13762 return false;
13763 }
13764 }
13765 return true;
13766 }
13767
13768
13769 void ICData::GetUsedCidsForTwoArgs(GrowableArray<intptr_t>* first, 13755 void ICData::GetUsedCidsForTwoArgs(GrowableArray<intptr_t>* first,
13770 GrowableArray<intptr_t>* second) const { 13756 GrowableArray<intptr_t>* second) const {
13771 ASSERT(NumArgsTested() == 2); 13757 ASSERT(NumArgsTested() == 2);
13772 first->Clear(); 13758 first->Clear();
13773 second->Clear(); 13759 second->Clear();
13774 GrowableArray<intptr_t> class_ids; 13760 GrowableArray<intptr_t> class_ids;
13775 const intptr_t len = NumberOfChecks(); 13761 const intptr_t len = NumberOfChecks();
13776 for (intptr_t i = 0; i < len; i++) { 13762 for (intptr_t i = 0; i < len; i++) {
13777 if (GetCountAt(i) > 0) { 13763 if (GetCountAt(i) > 0) {
13778 GetClassIdsAt(i, &class_ids); 13764 GetClassIdsAt(i, &class_ids);
(...skipping 9300 matching lines...) Expand 10 before | Expand all | Expand 10 after
23079 return UserTag::null(); 23065 return UserTag::null();
23080 } 23066 }
23081 23067
23082 23068
23083 const char* UserTag::ToCString() const { 23069 const char* UserTag::ToCString() const {
23084 const String& tag_label = String::Handle(label()); 23070 const String& tag_label = String::Handle(label());
23085 return tag_label.ToCString(); 23071 return tag_label.ToCString();
23086 } 23072 }
23087 23073
23088 } // namespace dart 23074 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698