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

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

Issue 2300873002: VM: Compute static guarded cid for final instance fields. (Closed)
Patch Set: address comments Created 4 years, 3 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/hash_map.h ('k') | runtime/vm/precompiler.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/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 7458 matching lines...) Expand 10 before | Expand all | Expand 10 after
7469 result.set_is_double_initialized(false); 7469 result.set_is_double_initialized(false);
7470 result.set_owner(owner); 7470 result.set_owner(owner);
7471 result.set_token_pos(token_pos); 7471 result.set_token_pos(token_pos);
7472 result.set_has_initializer(false); 7472 result.set_has_initializer(false);
7473 result.set_is_unboxing_candidate(true); 7473 result.set_is_unboxing_candidate(true);
7474 Isolate* isolate = Isolate::Current(); 7474 Isolate* isolate = Isolate::Current();
7475 7475
7476 // Use field guards if they are enabled and the isolate has never reloaded. 7476 // Use field guards if they are enabled and the isolate has never reloaded.
7477 // TODO(johnmccutchan): The reload case assumes the worst case (everything is 7477 // TODO(johnmccutchan): The reload case assumes the worst case (everything is
7478 // dynamic and possibly null). Attempt to relax this later. 7478 // dynamic and possibly null). Attempt to relax this later.
7479 const bool use_field_guards = 7479 const bool use_guarded_cid =
7480 FLAG_use_field_guards && !isolate->HasAttemptedReload(); 7480 FLAG_precompiled_mode ||
7481 result.set_guarded_cid(use_field_guards ? kIllegalCid : kDynamicCid); 7481 (FLAG_use_field_guards && !isolate->HasAttemptedReload());
7482 result.set_is_nullable(use_field_guards ? false : true); 7482 result.set_guarded_cid(use_guarded_cid ? kIllegalCid : kDynamicCid);
7483 result.set_is_nullable(use_guarded_cid ? false : true);
7483 result.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); 7484 result.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset);
7484 // Presently, we only attempt to remember the list length for final fields. 7485 // Presently, we only attempt to remember the list length for final fields.
7485 if (is_final && use_field_guards) { 7486 if (is_final && use_guarded_cid) {
7486 result.set_guarded_list_length(Field::kUnknownFixedLength); 7487 result.set_guarded_list_length(Field::kUnknownFixedLength);
7487 } else { 7488 } else {
7488 result.set_guarded_list_length(Field::kNoFixedLength); 7489 result.set_guarded_list_length(Field::kNoFixedLength);
7489 } 7490 }
7490 } 7491 }
7491 7492
7492 7493
7493 RawField* Field::New(const String& name, 7494 RawField* Field::New(const String& name,
7494 bool is_static, 7495 bool is_static,
7495 bool is_final, 7496 bool is_final,
(...skipping 6692 matching lines...) Expand 10 before | Expand all | Expand 10 after
14188 return Thread::kNoDeoptId; 14189 return Thread::kNoDeoptId;
14189 } 14190 }
14190 14191
14191 14192
14192 const char* Code::ToCString() const { 14193 const char* Code::ToCString() const {
14193 Zone* zone = Thread::Current()->zone(); 14194 Zone* zone = Thread::Current()->zone();
14194 if (IsStubCode()) { 14195 if (IsStubCode()) {
14195 const char* name = StubCode::NameOfStub(UncheckedEntryPoint()); 14196 const char* name = StubCode::NameOfStub(UncheckedEntryPoint());
14196 return zone->PrintToString("[stub: %s]", name); 14197 return zone->PrintToString("[stub: %s]", name);
14197 } else { 14198 } else {
14198 return zone->PrintToString("Code entry:%" Px, UncheckedEntryPoint()); 14199 return zone->PrintToString("Code entry: 0x%" Px, UncheckedEntryPoint());
14199 } 14200 }
14200 } 14201 }
14201 14202
14202 14203
14203 RawString* Code::Name() const { 14204 RawString* Code::Name() const {
14204 const Object& obj = Object::Handle(owner()); 14205 const Object& obj = Object::Handle(owner());
14205 if (obj.IsNull()) { 14206 if (obj.IsNull()) {
14206 // Regular stub. 14207 // Regular stub.
14207 Thread* thread = Thread::Current(); 14208 Thread* thread = Thread::Current();
14208 Zone* zone = thread->zone(); 14209 Zone* zone = thread->zone();
(...skipping 8556 matching lines...) Expand 10 before | Expand all | Expand 10 after
22765 return UserTag::null(); 22766 return UserTag::null();
22766 } 22767 }
22767 22768
22768 22769
22769 const char* UserTag::ToCString() const { 22770 const char* UserTag::ToCString() const {
22770 const String& tag_label = String::Handle(label()); 22771 const String& tag_label = String::Handle(label());
22771 return tag_label.ToCString(); 22772 return tag_label.ToCString();
22772 } 22773 }
22773 22774
22774 } // namespace dart 22775 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/hash_map.h ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698