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

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

Issue 2984883002: Remove fields from Isolate in Product mode (Closed)
Patch Set: Address comments Created 3 years, 4 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/metrics.cc ('k') | runtime/vm/pages.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/become.h" 10 #include "vm/become.h"
(...skipping 7769 matching lines...) Expand 10 before | Expand all | Expand 10 after
7780 result.set_owner(owner); 7780 result.set_owner(owner);
7781 result.set_token_pos(token_pos); 7781 result.set_token_pos(token_pos);
7782 result.set_has_initializer(false); 7782 result.set_has_initializer(false);
7783 result.set_is_unboxing_candidate(true); 7783 result.set_is_unboxing_candidate(true);
7784 result.set_kernel_offset(0); 7784 result.set_kernel_offset(0);
7785 Isolate* isolate = Isolate::Current(); 7785 Isolate* isolate = Isolate::Current();
7786 7786
7787 // Use field guards if they are enabled and the isolate has never reloaded. 7787 // Use field guards if they are enabled and the isolate has never reloaded.
7788 // TODO(johnmccutchan): The reload case assumes the worst case (everything is 7788 // TODO(johnmccutchan): The reload case assumes the worst case (everything is
7789 // dynamic and possibly null). Attempt to relax this later. 7789 // dynamic and possibly null). Attempt to relax this later.
7790 #if defined(PRODUCT)
7791 const bool use_guarded_cid =
7792 FLAG_precompiled_mode || isolate->use_field_guards();
7793 #else
7790 const bool use_guarded_cid = 7794 const bool use_guarded_cid =
7791 FLAG_precompiled_mode || 7795 FLAG_precompiled_mode ||
7792 (isolate->use_field_guards() && !isolate->HasAttemptedReload()); 7796 (isolate->use_field_guards() && !isolate->HasAttemptedReload());
7797 #endif // !defined(PRODUCT)
7793 result.set_guarded_cid(use_guarded_cid ? kIllegalCid : kDynamicCid); 7798 result.set_guarded_cid(use_guarded_cid ? kIllegalCid : kDynamicCid);
7794 result.set_is_nullable(use_guarded_cid ? false : true); 7799 result.set_is_nullable(use_guarded_cid ? false : true);
7795 result.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); 7800 result.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset);
7796 // Presently, we only attempt to remember the list length for final fields. 7801 // Presently, we only attempt to remember the list length for final fields.
7797 if (is_final && use_guarded_cid) { 7802 if (is_final && use_guarded_cid) {
7798 result.set_guarded_list_length(Field::kUnknownFixedLength); 7803 result.set_guarded_list_length(Field::kUnknownFixedLength);
7799 } else { 7804 } else {
7800 result.set_guarded_list_length(Field::kNoFixedLength); 7805 result.set_guarded_list_length(Field::kNoFixedLength);
7801 } 7806 }
7802 } 7807 }
(...skipping 3222 matching lines...) Expand 10 before | Expand all | Expand 10 after
11025 } 11030 }
11026 11031
11027 // Create a private key for this library. It is based on the hash of the 11032 // Create a private key for this library. It is based on the hash of the
11028 // library URI and the sequence number of the library to guarantee unique 11033 // library URI and the sequence number of the library to guarantee unique
11029 // private keys without having to verify. 11034 // private keys without having to verify.
11030 void Library::AllocatePrivateKey() const { 11035 void Library::AllocatePrivateKey() const {
11031 Thread* thread = Thread::Current(); 11036 Thread* thread = Thread::Current();
11032 Zone* zone = thread->zone(); 11037 Zone* zone = thread->zone();
11033 Isolate* isolate = thread->isolate(); 11038 Isolate* isolate = thread->isolate();
11034 11039
11040 #if !defined(PRODUCT)
11035 if (FLAG_support_reload && isolate->IsReloading()) { 11041 if (FLAG_support_reload && isolate->IsReloading()) {
11036 // When reloading, we need to make sure we use the original private key 11042 // When reloading, we need to make sure we use the original private key
11037 // if this library previously existed. 11043 // if this library previously existed.
11038 IsolateReloadContext* reload_context = isolate->reload_context(); 11044 IsolateReloadContext* reload_context = isolate->reload_context();
11039 const String& original_key = 11045 const String& original_key =
11040 String::Handle(reload_context->FindLibraryPrivateKey(*this)); 11046 String::Handle(reload_context->FindLibraryPrivateKey(*this));
11041 if (!original_key.IsNull()) { 11047 if (!original_key.IsNull()) {
11042 StorePointer(&raw_ptr()->private_key_, original_key.raw()); 11048 StorePointer(&raw_ptr()->private_key_, original_key.raw());
11043 return; 11049 return;
11044 } 11050 }
11045 } 11051 }
11052 #endif // !defined(PRODUCT)
11046 11053
11047 // Format of the private key is: "@<sequence number><6 digits of hash> 11054 // Format of the private key is: "@<sequence number><6 digits of hash>
11048 const intptr_t hash_mask = 0x7FFFF; 11055 const intptr_t hash_mask = 0x7FFFF;
11049 11056
11050 const String& url = String::Handle(zone, this->url()); 11057 const String& url = String::Handle(zone, this->url());
11051 intptr_t hash_value = url.Hash() & hash_mask; 11058 intptr_t hash_value = url.Hash() & hash_mask;
11052 11059
11053 const GrowableObjectArray& libs = 11060 const GrowableObjectArray& libs =
11054 GrowableObjectArray::Handle(zone, isolate->object_store()->libraries()); 11061 GrowableObjectArray::Handle(zone, isolate->object_store()->libraries());
11055 intptr_t sequence_value = libs.Length(); 11062 intptr_t sequence_value = libs.Length();
(...skipping 11470 matching lines...) Expand 10 before | Expand all | Expand 10 after
22526 } 22533 }
22527 return UserTag::null(); 22534 return UserTag::null();
22528 } 22535 }
22529 22536
22530 const char* UserTag::ToCString() const { 22537 const char* UserTag::ToCString() const {
22531 const String& tag_label = String::Handle(label()); 22538 const String& tag_label = String::Handle(label());
22532 return tag_label.ToCString(); 22539 return tag_label.ToCString();
22533 } 22540 }
22534 22541
22535 } // namespace dart 22542 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/metrics.cc ('k') | runtime/vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698