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

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

Issue 12260026: Add support for object pool (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/native_entry_test.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 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 private: 2217 private:
2218 static RawNamespace* New(); 2218 static RawNamespace* New();
2219 2219
2220 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); 2220 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object);
2221 friend class Class; 2221 friend class Class;
2222 }; 2222 };
2223 2223
2224 2224
2225 class Instructions : public Object { 2225 class Instructions : public Object {
2226 public: 2226 public:
2227 intptr_t size() const { return raw_ptr()->size_; } 2227 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize().
2228 RawCode* code() const { return raw_ptr()->code_; } 2228 RawCode* code() const { return raw_ptr()->code_; }
2229 RawArray* object_pool() const { return raw_ptr()->object_pool_; }
2229 2230
2230 uword EntryPoint() const { 2231 uword EntryPoint() const {
2231 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); 2232 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize();
2232 } 2233 }
2233 2234
2234 static const intptr_t kMaxElements = (kIntptrMax - 2235 static const intptr_t kMaxElements = (kIntptrMax -
2235 (sizeof(RawInstructions) + 2236 (sizeof(RawInstructions) +
2236 sizeof(RawObject) + 2237 sizeof(RawObject) +
2237 (2 * OS::kMaxPreferredCodeAlignment))); 2238 (2 * OS::kMaxPreferredCodeAlignment)));
2238 2239
(...skipping 17 matching lines...) Expand all
2256 2257
2257 static RawInstructions* FromEntryPoint(uword entry_point) { 2258 static RawInstructions* FromEntryPoint(uword entry_point) {
2258 return reinterpret_cast<RawInstructions*>( 2259 return reinterpret_cast<RawInstructions*>(
2259 entry_point - HeaderSize() + kHeapObjectTag); 2260 entry_point - HeaderSize() + kHeapObjectTag);
2260 } 2261 }
2261 2262
2262 private: 2263 private:
2263 void set_size(intptr_t size) const { 2264 void set_size(intptr_t size) const {
2264 raw_ptr()->size_ = size; 2265 raw_ptr()->size_ = size;
2265 } 2266 }
2266 void set_code(RawCode* code) { 2267 void set_code(RawCode* code) const {
2267 raw_ptr()->code_ = code; 2268 raw_ptr()->code_ = code;
2268 } 2269 }
2270 void set_object_pool(RawArray* object_pool) const {
2271 raw_ptr()->object_pool_ = object_pool;
2272 }
2269 2273
2270 // New is a private method as RawInstruction and RawCode objects should 2274 // New is a private method as RawInstruction and RawCode objects should
2271 // only be created using the Code::FinalizeCode method. This method creates 2275 // only be created using the Code::FinalizeCode method. This method creates
2272 // the RawInstruction and RawCode objects, sets up the pointer offsets 2276 // the RawInstruction and RawCode objects, sets up the pointer offsets
2273 // and links the two in a GC safe manner. 2277 // and links the two in a GC safe manner.
2274 static RawInstructions* New(intptr_t size); 2278 static RawInstructions* New(intptr_t size);
2275 2279
2276 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object); 2280 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object);
2277 friend class Class; 2281 friend class Class;
2278 friend class Code; 2282 friend class Code;
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 } 2605 }
2602 2606
2603 uword EntryPoint() const { 2607 uword EntryPoint() const {
2604 const Instructions& instr = Instructions::Handle(instructions()); 2608 const Instructions& instr = Instructions::Handle(instructions());
2605 return instr.EntryPoint(); 2609 return instr.EntryPoint();
2606 } 2610 }
2607 intptr_t Size() const { 2611 intptr_t Size() const {
2608 const Instructions& instr = Instructions::Handle(instructions()); 2612 const Instructions& instr = Instructions::Handle(instructions());
2609 return instr.size(); 2613 return instr.size();
2610 } 2614 }
2615 bool ContainsInstructionAt(uword addr) const {
2616 const Instructions& instr = Instructions::Handle(instructions());
2617 const uword offset = addr - instr.EntryPoint();
2618 return offset < static_cast<uword>(instr.size());
2619 }
2611 2620
2612 RawPcDescriptors* pc_descriptors() const { 2621 RawPcDescriptors* pc_descriptors() const {
2613 return raw_ptr()->pc_descriptors_; 2622 return raw_ptr()->pc_descriptors_;
2614 } 2623 }
2615 void set_pc_descriptors(const PcDescriptors& descriptors) const { 2624 void set_pc_descriptors(const PcDescriptors& descriptors) const {
2616 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw()); 2625 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw());
2617 } 2626 }
2618 2627
2619 // Array of DeoptInfo objects. 2628 // Array of DeoptInfo objects.
2620 RawArray* deopt_info_array() const { 2629 RawArray* deopt_info_array() const {
(...skipping 3729 matching lines...) Expand 10 before | Expand all | Expand 10 after
6350 6359
6351 6360
6352 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6361 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6353 intptr_t index) { 6362 intptr_t index) {
6354 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6363 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6355 } 6364 }
6356 6365
6357 } // namespace dart 6366 } // namespace dart
6358 6367
6359 #endif // VM_OBJECT_H_ 6368 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/native_entry_test.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698