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

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

Issue 1435533003: Make profiler work without Instructions -> Code pointer (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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.h ('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 3735 matching lines...) Expand 10 before | Expand all | Expand 10 after
3746 friend class Class; 3746 friend class Class;
3747 friend class Object; 3747 friend class Object;
3748 friend class RawObjectPool; 3748 friend class RawObjectPool;
3749 }; 3749 };
3750 3750
3751 3751
3752 class Instructions : public Object { 3752 class Instructions : public Object {
3753 public: 3753 public:
3754 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). 3754 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize().
3755 3755
3756 RawCode* code() const {
3757 // This should only be accessed when jitting.
3758 // TODO(johnmccutchan): Remove code back pointer.
3759 ASSERT(!Dart::IsRunningPrecompiledCode());
3760 return raw_ptr()->code_;
3761 }
3762
3763 uword EntryPoint() const { 3756 uword EntryPoint() const {
3764 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); 3757 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize();
3765 } 3758 }
3766 3759
3767 static const intptr_t kMaxElements = (kMaxInt32 - 3760 static const intptr_t kMaxElements = (kMaxInt32 -
3768 (sizeof(RawInstructions) + 3761 (sizeof(RawInstructions) +
3769 sizeof(RawObject) + 3762 sizeof(RawObject) +
3770 (2 * OS::kMaxPreferredCodeAlignment))); 3763 (2 * OS::kMaxPreferredCodeAlignment)));
3771 3764
3772 static intptr_t InstanceSize() { 3765 static intptr_t InstanceSize() {
(...skipping 18 matching lines...) Expand all
3791 static RawInstructions* FromEntryPoint(uword entry_point) { 3784 static RawInstructions* FromEntryPoint(uword entry_point) {
3792 return reinterpret_cast<RawInstructions*>( 3785 return reinterpret_cast<RawInstructions*>(
3793 entry_point - HeaderSize() + kHeapObjectTag); 3786 entry_point - HeaderSize() + kHeapObjectTag);
3794 } 3787 }
3795 3788
3796 private: 3789 private:
3797 void set_size(intptr_t size) const { 3790 void set_size(intptr_t size) const {
3798 StoreNonPointer(&raw_ptr()->size_, size); 3791 StoreNonPointer(&raw_ptr()->size_, size);
3799 } 3792 }
3800 3793
3801 void set_code(RawCode* code) const {
3802 StorePointer(&raw_ptr()->code_, code);
3803 }
3804
3805 // New is a private method as RawInstruction and RawCode objects should 3794 // New is a private method as RawInstruction and RawCode objects should
3806 // only be created using the Code::FinalizeCode method. This method creates 3795 // only be created using the Code::FinalizeCode method. This method creates
3807 // the RawInstruction and RawCode objects, sets up the pointer offsets 3796 // the RawInstruction and RawCode objects, sets up the pointer offsets
3808 // and links the two in a GC safe manner. 3797 // and links the two in a GC safe manner.
3809 static RawInstructions* New(intptr_t size); 3798 static RawInstructions* New(intptr_t size);
3810 3799
3811 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object); 3800 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object);
3812 friend class Class; 3801 friend class Class;
3813 friend class Code; 3802 friend class Code;
3814 friend class InstructionsWriter; 3803 friend class InstructionsWriter;
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
4427 kOptimizedBit = 0, 4416 kOptimizedBit = 0,
4428 kAliveBit = 1, 4417 kAliveBit = 1,
4429 kPtrOffBit = 2, 4418 kPtrOffBit = 2,
4430 kPtrOffSize = 30, 4419 kPtrOffSize = 30,
4431 }; 4420 };
4432 4421
4433 class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {}; 4422 class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {};
4434 class AliveBit : public BitField<bool, kAliveBit, 1> {}; 4423 class AliveBit : public BitField<bool, kAliveBit, 1> {};
4435 class PtrOffBits : public BitField<intptr_t, kPtrOffBit, kPtrOffSize> {}; 4424 class PtrOffBits : public BitField<intptr_t, kPtrOffBit, kPtrOffSize> {};
4436 4425
4437 // An object finder visitor interface.
4438 class FindRawCodeVisitor : public FindObjectVisitor {
4439 public:
4440 explicit FindRawCodeVisitor(uword pc)
4441 : FindObjectVisitor(Isolate::Current()), pc_(pc) { }
4442 virtual ~FindRawCodeVisitor() { }
4443
4444 // Check if object matches find condition.
4445 virtual bool FindObject(RawObject* obj) const;
4446
4447 private:
4448 const uword pc_;
4449
4450 DISALLOW_COPY_AND_ASSIGN(FindRawCodeVisitor);
4451 };
4452
4453 class SlowFindRawCodeVisitor : public FindObjectVisitor { 4426 class SlowFindRawCodeVisitor : public FindObjectVisitor {
4454 public: 4427 public:
4455 explicit SlowFindRawCodeVisitor(uword pc) 4428 explicit SlowFindRawCodeVisitor(uword pc)
4456 : FindObjectVisitor(Isolate::Current()), pc_(pc) { } 4429 : FindObjectVisitor(Isolate::Current()), pc_(pc) { }
4457 virtual ~SlowFindRawCodeVisitor() { } 4430 virtual ~SlowFindRawCodeVisitor() { }
4458 4431
4459 // Check if object matches find condition. 4432 // Check if object matches find condition.
4460 virtual bool FindObject(RawObject* obj) const; 4433 virtual bool FindObject(RawObject* obj) const;
4461 4434
4462 private: 4435 private:
(...skipping 3773 matching lines...) Expand 10 before | Expand all | Expand 10 after
8236 8209
8237 8210
8238 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8211 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8239 intptr_t index) { 8212 intptr_t index) {
8240 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8213 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8241 } 8214 }
8242 8215
8243 } // namespace dart 8216 } // namespace dart
8244 8217
8245 #endif // VM_OBJECT_H_ 8218 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698