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

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

Issue 2912863006: Inline instance object hash code into object header on 64 bit. (Closed)
Patch Set: Created 3 years, 6 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/heap.cc ('k') | runtime/vm/raw_object.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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 cls.set_is_finalized(); 904 cls.set_is_finalized();
905 cls.set_is_type_finalized(); 905 cls.set_is_type_finalized();
906 cls.set_is_cycle_free(); 906 cls.set_is_cycle_free();
907 907
908 cls = dynamic_class_; 908 cls = dynamic_class_;
909 *dynamic_type_ = Type::NewNonParameterizedType(cls); 909 *dynamic_type_ = Type::NewNonParameterizedType(cls);
910 910
911 cls = void_class_; 911 cls = void_class_;
912 *void_type_ = Type::NewNonParameterizedType(cls); 912 *void_type_ = Type::NewNonParameterizedType(cls);
913 913
914 #if defined(HASH_IN_OBJECT_HEADER)
Vyacheslav Egorov (Google) 2017/05/30 15:25:00 How do we make sure that this list is exhaustive?
erikcorry 2017/06/02 15:34:04 Good point that does not work. Instead, the new v
915 // These need to be set now because they can end up in read-only memory where
916 // they can't be overwritten. Some of them actually have hashCode methods,
917 // so the value won't be used once the VM is fully booted.
918 Object::SetCachedHash(sentinel_->raw(), 1);
919 Object::SetCachedHash(transition_sentinel_->raw(), 2);
920 Object::SetCachedHash(unknown_constant_->raw(), 3);
921 Object::SetCachedHash(non_constant_->raw(), 4);
922 Object::SetCachedHash(empty_array_->raw(), 256);
923 Object::SetCachedHash(zero_array_->raw(), 257);
924 Object::SetCachedHash(dynamic_type_->raw(), 103);
925 Object::SetCachedHash(void_type_->raw(), 104);
926 Object::SetCachedHash(null_instance_->raw(), 42);
927 #endif
928
914 // Allocate and initialize singleton true and false boolean objects. 929 // Allocate and initialize singleton true and false boolean objects.
915 cls = Class::New<Bool>(); 930 cls = Class::New<Bool>();
916 isolate->object_store()->set_bool_class(cls); 931 isolate->object_store()->set_bool_class(cls);
917 *bool_true_ = Bool::New(true); 932 *bool_true_ = Bool::New(true);
918 *bool_false_ = Bool::New(false); 933 *bool_false_ = Bool::New(false);
919 934
920 *smi_illegal_cid_ = Smi::New(kIllegalCid); 935 *smi_illegal_cid_ = Smi::New(kIllegalCid);
921 936
922 String& error_str = String::Handle(); 937 String& error_str = String::Handle();
923 error_str = String::New("SnapshotWriter Error", Heap::kOld); 938 error_str = String::New("SnapshotWriter Error", Heap::kOld);
(...skipping 22429 matching lines...) Expand 10 before | Expand all | Expand 10 after
23353 return UserTag::null(); 23368 return UserTag::null();
23354 } 23369 }
23355 23370
23356 23371
23357 const char* UserTag::ToCString() const { 23372 const char* UserTag::ToCString() const {
23358 const String& tag_label = String::Handle(label()); 23373 const String& tag_label = String::Handle(label());
23359 return tag_label.ToCString(); 23374 return tag_label.ToCString();
23360 } 23375 }
23361 23376
23362 } // namespace dart 23377 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/heap.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698