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

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

Issue 1410573006: Cache initial (empty) ic_data arrays so that they are not repeatedly allocated. Factor out descript… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: address comment Created 5 years, 1 month 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.cc ('k') | runtime/vm/snapshot_ids.h » ('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/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 return isolate()->class_table()->At(class_id); // get singleton class. 1326 return isolate()->class_table()->At(class_id); // get singleton class.
1327 } 1327 }
1328 1328
1329 // Check if it is a singleton Argument descriptor object. 1329 // Check if it is a singleton Argument descriptor object.
1330 for (intptr_t i = 0; i < ArgumentsDescriptor::kCachedDescriptorCount; i++) { 1330 for (intptr_t i = 0; i < ArgumentsDescriptor::kCachedDescriptorCount; i++) {
1331 if (object_id == (kCachedArgumentsDescriptor0 + i)) { 1331 if (object_id == (kCachedArgumentsDescriptor0 + i)) {
1332 return ArgumentsDescriptor::cached_args_descriptors_[i]; 1332 return ArgumentsDescriptor::cached_args_descriptors_[i];
1333 } 1333 }
1334 } 1334 }
1335 1335
1336 // Check if it is a singleton ICData array object.
1337 for (intptr_t i = 0; i < ICData::kCachedICDataArrayCount; i++) {
1338 if (object_id == (kCachedICDataArray0 + i)) {
1339 return ICData::cached_icdata_arrays_[i];
1340 }
1341 }
1342
1336 ASSERT(Symbols::IsVMSymbolId(object_id)); 1343 ASSERT(Symbols::IsVMSymbolId(object_id));
1337 return Symbols::GetVMSymbol(object_id); // return VM symbol. 1344 return Symbols::GetVMSymbol(object_id); // return VM symbol.
1338 } 1345 }
1339 1346
1340 1347
1341 RawObject* SnapshotReader::ReadIndexedObject(intptr_t object_id, 1348 RawObject* SnapshotReader::ReadIndexedObject(intptr_t object_id,
1342 intptr_t patch_object_id, 1349 intptr_t patch_object_id,
1343 intptr_t patch_offset) { 1350 intptr_t patch_offset) {
1344 intptr_t class_id = ClassIdFromObjectId(object_id); 1351 intptr_t class_id = ClassIdFromObjectId(object_id);
1345 if (IsObjectStoreClassId(class_id)) { 1352 if (IsObjectStoreClassId(class_id)) {
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 } 1675 }
1669 1676
1670 // Check if it is a singleton Argument descriptor object. 1677 // Check if it is a singleton Argument descriptor object.
1671 for (intptr_t i = 0; i < ArgumentsDescriptor::kCachedDescriptorCount; i++) { 1678 for (intptr_t i = 0; i < ArgumentsDescriptor::kCachedDescriptorCount; i++) {
1672 if (rawobj == ArgumentsDescriptor::cached_args_descriptors_[i]) { 1679 if (rawobj == ArgumentsDescriptor::cached_args_descriptors_[i]) {
1673 WriteVMIsolateObject(kCachedArgumentsDescriptor0 + i); 1680 WriteVMIsolateObject(kCachedArgumentsDescriptor0 + i);
1674 return true; 1681 return true;
1675 } 1682 }
1676 } 1683 }
1677 1684
1685 // Check if it is a singleton ICData array object.
1686 for (intptr_t i = 0; i < ICData::kCachedICDataArrayCount; i++) {
1687 if (rawobj == ICData::cached_icdata_arrays_[i]) {
1688 WriteVMIsolateObject(kCachedICDataArray0 + i);
1689 return true;
1690 }
1691 }
1692
1678 if (kind() == Snapshot::kFull) { 1693 if (kind() == Snapshot::kFull) {
1679 // Check it is a predefined symbol in the VM isolate. 1694 // Check it is a predefined symbol in the VM isolate.
1680 id = Symbols::LookupVMSymbol(rawobj); 1695 id = Symbols::LookupVMSymbol(rawobj);
1681 if (id != kInvalidIndex) { 1696 if (id != kInvalidIndex) {
1682 WriteVMIsolateObject(id); 1697 WriteVMIsolateObject(id);
1683 return true; 1698 return true;
1684 } 1699 }
1685 1700
1686 // Check if it is an object from the vm isolate snapshot object table. 1701 // Check if it is an object from the vm isolate snapshot object table.
1687 id = FindVmSnapshotObject(rawobj); 1702 id = FindVmSnapshotObject(rawobj);
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2555 if (setjmp(*jump.Set()) == 0) { 2570 if (setjmp(*jump.Set()) == 0) {
2556 NoSafepointScope no_safepoint; 2571 NoSafepointScope no_safepoint;
2557 WriteObject(obj.raw()); 2572 WriteObject(obj.raw());
2558 } else { 2573 } else {
2559 ThrowException(exception_type(), exception_msg()); 2574 ThrowException(exception_type(), exception_msg());
2560 } 2575 }
2561 } 2576 }
2562 2577
2563 2578
2564 } // namespace dart 2579 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/snapshot_ids.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698