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

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

Issue 1925153003: Undo "Don't include an object header for instructions in the text section." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/isolate.cc ('k') | 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 3943 matching lines...) Expand 10 before | Expand all | Expand 10 after
3954 3954
3955 // New is a private method as RawInstruction and RawCode objects should 3955 // New is a private method as RawInstruction and RawCode objects should
3956 // only be created using the Code::FinalizeCode method. This method creates 3956 // only be created using the Code::FinalizeCode method. This method creates
3957 // the RawInstruction and RawCode objects, sets up the pointer offsets 3957 // the RawInstruction and RawCode objects, sets up the pointer offsets
3958 // and links the two in a GC safe manner. 3958 // and links the two in a GC safe manner.
3959 static RawInstructions* New(intptr_t size); 3959 static RawInstructions* New(intptr_t size);
3960 3960
3961 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object); 3961 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object);
3962 friend class Class; 3962 friend class Class;
3963 friend class Code; 3963 friend class Code;
3964 friend class InstructionsWriter; 3964 friend class AssemblyInstructionsWriter;
3965 friend class BlobInstructionsWriter;
3965 }; 3966 };
3966 3967
3967 3968
3968 class LocalVarDescriptors : public Object { 3969 class LocalVarDescriptors : public Object {
3969 public: 3970 public:
3970 intptr_t Length() const; 3971 intptr_t Length() const;
3971 3972
3972 RawString* GetName(intptr_t var_index) const; 3973 RawString* GetName(intptr_t var_index) const;
3973 3974
3974 void SetVar(intptr_t var_index, 3975 void SetVar(intptr_t var_index,
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
4367 private: 4368 private:
4368 static void UnpackInto(const Array& table, 4369 static void UnpackInto(const Array& table,
4369 const TypedData& packed, 4370 const TypedData& packed,
4370 GrowableArray<DeoptInstr*>* instructions, 4371 GrowableArray<DeoptInstr*>* instructions,
4371 intptr_t length); 4372 intptr_t length);
4372 }; 4373 };
4373 4374
4374 4375
4375 class Code : public Object { 4376 class Code : public Object {
4376 public: 4377 public:
4377 uword active_entry_point() const { return raw_ptr()->entry_point_; } 4378 RawInstructions* active_instructions() const {
4379 return raw_ptr()->active_instructions_;
4380 }
4378 4381
4379 RawInstructions* instructions() const { return raw_ptr()->instructions_; } 4382 RawInstructions* instructions() const { return raw_ptr()->instructions_; }
4380 4383
4381 static intptr_t saved_instructions_offset() { 4384 static intptr_t saved_instructions_offset() {
4382 return OFFSET_OF(RawCode, instructions_); 4385 return OFFSET_OF(RawCode, instructions_);
4383 } 4386 }
4384 4387
4385 static intptr_t entry_point_offset() { 4388 static intptr_t entry_point_offset() {
4386 return OFFSET_OF(RawCode, entry_point_); 4389 return OFFSET_OF(RawCode, entry_point_);
4387 } 4390 }
4388 4391
4389 RawObjectPool* object_pool() const { return raw_ptr()->object_pool_; } 4392 RawObjectPool* object_pool() const { return raw_ptr()->object_pool_; }
4390 static intptr_t object_pool_offset() { 4393 static intptr_t object_pool_offset() {
4391 return OFFSET_OF(RawCode, object_pool_); 4394 return OFFSET_OF(RawCode, object_pool_);
4392 } 4395 }
4393 4396
4394 intptr_t pointer_offsets_length() const { 4397 intptr_t pointer_offsets_length() const {
4395 return PtrOffBits::decode(raw_ptr()->state_bits_); 4398 return PtrOffBits::decode(raw_ptr()->state_bits_);
4396 } 4399 }
4397 4400
4398 bool is_optimized() const { 4401 bool is_optimized() const {
4399 return OptimizedBit::decode(raw_ptr()->state_bits_); 4402 return OptimizedBit::decode(raw_ptr()->state_bits_);
4400 } 4403 }
4401 void set_is_optimized(bool value) const; 4404 void set_is_optimized(bool value) const;
4402 bool is_alive() const { 4405 bool is_alive() const {
4403 return AliveBit::decode(raw_ptr()->state_bits_); 4406 return AliveBit::decode(raw_ptr()->state_bits_);
4404 } 4407 }
4405 void set_is_alive(bool value) const; 4408 void set_is_alive(bool value) const;
4406 4409
4407 uword EntryPoint() const; 4410 uword EntryPoint() const {
4408 intptr_t Size() const; 4411 return Instructions::Handle(instructions()).EntryPoint();
4409 4412 }
4413 intptr_t Size() const {
4414 const Instructions& instr = Instructions::Handle(instructions());
4415 return instr.size();
4416 }
4410 RawObjectPool* GetObjectPool() const { 4417 RawObjectPool* GetObjectPool() const {
4411 return object_pool(); 4418 return object_pool();
4412 } 4419 }
4413 bool ContainsInstructionAt(uword addr) const { 4420 bool ContainsInstructionAt(uword addr) const {
4414 const uword offset = addr - EntryPoint(); 4421 const Instructions& instr = Instructions::Handle(instructions());
4415 return offset < static_cast<uword>(Size()); 4422 const uword offset = addr - instr.EntryPoint();
4423 return offset < static_cast<uword>(instr.size());
4416 } 4424 }
4417 4425
4418 // Returns true if there is a debugger breakpoint set in this code object. 4426 // Returns true if there is a debugger breakpoint set in this code object.
4419 bool HasBreakpoint() const; 4427 bool HasBreakpoint() const;
4420 4428
4421 RawPcDescriptors* pc_descriptors() const { 4429 RawPcDescriptors* pc_descriptors() const {
4422 return raw_ptr()->pc_descriptors_; 4430 return raw_ptr()->pc_descriptors_;
4423 } 4431 }
4424 void set_pc_descriptors(const PcDescriptors& descriptors) const { 4432 void set_pc_descriptors(const PcDescriptors& descriptors) const {
4425 ASSERT(descriptors.IsOld()); 4433 ASSERT(descriptors.IsOld());
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
4644 bool IsStubCode() const; 4652 bool IsStubCode() const;
4645 bool IsFunctionCode() const; 4653 bool IsFunctionCode() const;
4646 4654
4647 void DisableDartCode() const; 4655 void DisableDartCode() const;
4648 4656
4649 void DisableStubCode() const; 4657 void DisableStubCode() const;
4650 4658
4651 void Enable() const { 4659 void Enable() const {
4652 if (!IsDisabled()) return; 4660 if (!IsDisabled()) return;
4653 ASSERT(Thread::Current()->IsMutatorThread()); 4661 ASSERT(Thread::Current()->IsMutatorThread());
4662 ASSERT(instructions() != active_instructions());
4654 SetActiveInstructions(instructions()); 4663 SetActiveInstructions(instructions());
4655 } 4664 }
4656 4665
4657 bool IsDisabled() const { 4666 bool IsDisabled() const {
4658 return active_entry_point() != EntryPoint(); 4667 return instructions() != active_instructions();
4659 } 4668 }
4660 4669
4661 private: 4670 private:
4662 void set_state_bits(intptr_t bits) const; 4671 void set_state_bits(intptr_t bits) const;
4663 4672
4664 void set_object_pool(RawObjectPool* object_pool) const { 4673 void set_object_pool(RawObjectPool* object_pool) const {
4665 StorePointer(&raw_ptr()->object_pool_, object_pool); 4674 StorePointer(&raw_ptr()->object_pool_, object_pool);
4666 } 4675 }
4667 4676
4668 friend class RawObject; // For RawObject::SizeFromClass(). 4677 friend class RawObject; // For RawObject::SizeFromClass().
(...skipping 3838 matching lines...) Expand 10 before | Expand all | Expand 10 after
8507 8516
8508 8517
8509 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8518 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8510 intptr_t index) { 8519 intptr_t index) {
8511 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8520 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8512 } 8521 }
8513 8522
8514 } // namespace dart 8523 } // namespace dart
8515 8524
8516 #endif // VM_OBJECT_H_ 8525 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698