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

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

Issue 2416963009: Minor cleanup: use handle when setting instructions in code object. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | runtime/vm/object.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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 4927 matching lines...) Expand 10 before | Expand all | Expand 10 after
4938 bool IsFunctionCode() const; 4938 bool IsFunctionCode() const;
4939 4939
4940 void DisableDartCode() const; 4940 void DisableDartCode() const;
4941 4941
4942 void DisableStubCode() const; 4942 void DisableStubCode() const;
4943 4943
4944 void Enable() const { 4944 void Enable() const {
4945 if (!IsDisabled()) return; 4945 if (!IsDisabled()) return;
4946 ASSERT(Thread::Current()->IsMutatorThread()); 4946 ASSERT(Thread::Current()->IsMutatorThread());
4947 ASSERT(instructions() != active_instructions()); 4947 ASSERT(instructions() != active_instructions());
4948 SetActiveInstructions(instructions()); 4948 SetActiveInstructions(Instructions::Handle(instructions()));
4949 } 4949 }
4950 4950
4951 bool IsDisabled() const { 4951 bool IsDisabled() const {
4952 return instructions() != active_instructions(); 4952 return instructions() != active_instructions();
4953 } 4953 }
4954 4954
4955 private: 4955 private:
4956 void set_state_bits(intptr_t bits) const; 4956 void set_state_bits(intptr_t bits) const;
4957 4957
4958 void set_object_pool(RawObjectPool* object_pool) const { 4958 void set_object_pool(RawObjectPool* object_pool) const {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
4994 static const intptr_t kEntrySize = sizeof(int32_t); // NOLINT 4994 static const intptr_t kEntrySize = sizeof(int32_t); // NOLINT
4995 4995
4996 void set_compile_timestamp(int64_t timestamp) const { 4996 void set_compile_timestamp(int64_t timestamp) const {
4997 #if defined(DART_PRECOMPILED_RUNTIME) 4997 #if defined(DART_PRECOMPILED_RUNTIME)
4998 UNREACHABLE(); 4998 UNREACHABLE();
4999 #else 4999 #else
5000 StoreNonPointer(&raw_ptr()->compile_timestamp_, timestamp); 5000 StoreNonPointer(&raw_ptr()->compile_timestamp_, timestamp);
5001 #endif 5001 #endif
5002 } 5002 }
5003 5003
5004 void SetActiveInstructions(RawInstructions* instructions) const; 5004 void SetActiveInstructions(const Instructions& instructions) const;
5005 5005
5006 void set_instructions(RawInstructions* instructions) const { 5006 void set_instructions(const Instructions& instructions) const {
5007 ASSERT(Thread::Current()->IsMutatorThread() || !is_alive()); 5007 ASSERT(Thread::Current()->IsMutatorThread() || !is_alive());
5008 StorePointer(&raw_ptr()->instructions_, instructions); 5008 StorePointer(&raw_ptr()->instructions_, instructions.raw());
5009 } 5009 }
5010 5010
5011 void set_pointer_offsets_length(intptr_t value) { 5011 void set_pointer_offsets_length(intptr_t value) {
5012 // The number of fixups is limited to 1-billion. 5012 // The number of fixups is limited to 1-billion.
5013 ASSERT(Utils::IsUint(30, value)); 5013 ASSERT(Utils::IsUint(30, value));
5014 set_state_bits(PtrOffBits::update(value, raw_ptr()->state_bits_)); 5014 set_state_bits(PtrOffBits::update(value, raw_ptr()->state_bits_));
5015 } 5015 }
5016 int32_t* PointerOffsetAddrAt(int index) const { 5016 int32_t* PointerOffsetAddrAt(int index) const {
5017 ASSERT(index >= 0); 5017 ASSERT(index >= 0);
5018 ASSERT(index < pointer_offsets_length()); 5018 ASSERT(index < pointer_offsets_length());
(...skipping 3959 matching lines...) Expand 10 before | Expand all | Expand 10 after
8978 8978
8979 inline void TypeArguments::SetHash(intptr_t value) const { 8979 inline void TypeArguments::SetHash(intptr_t value) const {
8980 // This is only safe because we create a new Smi, which does not cause 8980 // This is only safe because we create a new Smi, which does not cause
8981 // heap allocation. 8981 // heap allocation.
8982 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8982 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8983 } 8983 }
8984 8984
8985 } // namespace dart 8985 } // namespace dart
8986 8986
8987 #endif // VM_OBJECT_H_ 8987 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698