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

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

Issue 23691008: Compress memory usage. Imprive speed of finding exception handlers: if a code does not have any han… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
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 2925 matching lines...) Expand 10 before | Expand all | Expand 10 after
2936 2936
2937 class Code : public Object { 2937 class Code : public Object {
2938 public: 2938 public:
2939 RawInstructions* instructions() const { return raw_ptr()->instructions_; } 2939 RawInstructions* instructions() const { return raw_ptr()->instructions_; }
2940 static intptr_t instructions_offset() { 2940 static intptr_t instructions_offset() {
2941 return OFFSET_OF(RawCode, instructions_); 2941 return OFFSET_OF(RawCode, instructions_);
2942 } 2942 }
2943 intptr_t pointer_offsets_length() const { 2943 intptr_t pointer_offsets_length() const {
2944 return raw_ptr()->pointer_offsets_length_; 2944 return raw_ptr()->pointer_offsets_length_;
2945 } 2945 }
2946
2947 void set_state_bits(intptr_t bits) const;
siva 2013/08/29 16:29:20 Does this have to be a public method?
srdjan 2013/08/29 16:38:13 Made private.
2948
2946 bool is_optimized() const { 2949 bool is_optimized() const {
2947 return (raw_ptr()->is_optimized_ == 1); 2950 return OptimizedBit::decode(raw_ptr()->state_bits_);
2948 } 2951 }
2949 void set_is_optimized(bool value) const { 2952 void set_is_optimized(bool value) const;
2950 raw_ptr()->is_optimized_ = value ? 1 : 0; 2953 bool is_alive() const {
2954 return AliveBit::decode(raw_ptr()->state_bits_);
2951 } 2955 }
2952 bool is_alive() const { 2956 void set_is_alive(bool value) const;
2953 return (raw_ptr()->is_alive_ == 1);
2954 }
2955 void set_is_alive(bool value) const {
2956 raw_ptr()->is_alive_ = value ? 1 : 0;
2957 }
2958 2957
2959 uword EntryPoint() const { 2958 uword EntryPoint() const {
2960 const Instructions& instr = Instructions::Handle(instructions()); 2959 const Instructions& instr = Instructions::Handle(instructions());
2961 return instr.EntryPoint(); 2960 return instr.EntryPoint();
2962 } 2961 }
2963 intptr_t Size() const { 2962 intptr_t Size() const {
2964 const Instructions& instr = Instructions::Handle(instructions()); 2963 const Instructions& instr = Instructions::Handle(instructions());
2965 return instr.size(); 2964 return instr.size();
2966 } 2965 }
2967 RawArray* ObjectPool() const { 2966 RawArray* ObjectPool() const {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
3119 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n]. 3118 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n].
3120 // Returns the maximum id found. 3119 // Returns the maximum id found.
3121 intptr_t ExtractIcDataArraysAtCalls( 3120 intptr_t ExtractIcDataArraysAtCalls(
3122 GrowableArray<intptr_t>* node_ids, 3121 GrowableArray<intptr_t>* node_ids,
3123 const GrowableObjectArray& ic_data_objs) const; 3122 const GrowableObjectArray& ic_data_objs) const;
3124 3123
3125 // Returns an array indexed by deopt id, containing the extracted ICData. 3124 // Returns an array indexed by deopt id, containing the extracted ICData.
3126 RawArray* ExtractTypeFeedbackArray() const; 3125 RawArray* ExtractTypeFeedbackArray() const;
3127 3126
3128 private: 3127 private:
3128 friend class RawCode;
3129 enum {
3130 kOptimizedBit = 0,
3131 kAliveBit = 1,
3132 };
3133
3134 class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {};
3135 class AliveBit : public BitField<bool, kAliveBit, 1> {};
3136
3129 // An object finder visitor interface. 3137 // An object finder visitor interface.
3130 class FindRawCodeVisitor : public FindObjectVisitor { 3138 class FindRawCodeVisitor : public FindObjectVisitor {
3131 public: 3139 public:
3132 explicit FindRawCodeVisitor(uword pc) 3140 explicit FindRawCodeVisitor(uword pc)
3133 : FindObjectVisitor(Isolate::Current()), pc_(pc) { } 3141 : FindObjectVisitor(Isolate::Current()), pc_(pc) { }
3134 virtual ~FindRawCodeVisitor() { } 3142 virtual ~FindRawCodeVisitor() { }
3135 3143
3136 // Check if object matches find condition. 3144 // Check if object matches find condition.
3137 virtual bool FindObject(RawObject* obj); 3145 virtual bool FindObject(RawObject* obj);
3138 3146
(...skipping 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after
6134 6142
6135 6143
6136 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6144 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6137 intptr_t index) { 6145 intptr_t index) {
6138 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6146 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6139 } 6147 }
6140 6148
6141 } // namespace dart 6149 } // namespace dart
6142 6150
6143 #endif // VM_OBJECT_H_ 6151 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698