| OLD | NEW |
| 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 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2200 static intptr_t InstanceSize() { | 2200 static intptr_t InstanceSize() { |
| 2201 ASSERT(sizeof(RawCode) == OFFSET_OF(RawCode, data_)); | 2201 ASSERT(sizeof(RawCode) == OFFSET_OF(RawCode, data_)); |
| 2202 return 0; | 2202 return 0; |
| 2203 } | 2203 } |
| 2204 static intptr_t InstanceSize(intptr_t pointer_offsets_length) { | 2204 static intptr_t InstanceSize(intptr_t pointer_offsets_length) { |
| 2205 return RoundedAllocationSize( | 2205 return RoundedAllocationSize( |
| 2206 sizeof(RawCode) + (pointer_offsets_length * kEntrySize)); | 2206 sizeof(RawCode) + (pointer_offsets_length * kEntrySize)); |
| 2207 } | 2207 } |
| 2208 static RawCode* FinalizeCode(const Function& function, Assembler* assembler); | 2208 static RawCode* FinalizeCode(const Function& function, Assembler* assembler); |
| 2209 static RawCode* FinalizeStubCode(const char* name, Assembler* assembler); | 2209 static RawCode* FinalizeStubCode(const char* name, Assembler* assembler); |
| 2210 static RawCode* LookupCode(uword pc); |
| 2210 | 2211 |
| 2211 int32_t GetPointerOffsetAt(int index) const { | 2212 int32_t GetPointerOffsetAt(int index) const { |
| 2212 return *PointerOffsetAddrAt(index); | 2213 return *PointerOffsetAddrAt(index); |
| 2213 } | 2214 } |
| 2214 intptr_t GetTokenIndexOfPC(uword pc) const; | 2215 intptr_t GetTokenIndexOfPC(uword pc) const; |
| 2215 | 2216 |
| 2216 // Find pc of patch code buffer. Return 0 if not found. | 2217 // Find pc of patch code buffer. Return 0 if not found. |
| 2217 uword GetPatchCodePc() const; | 2218 uword GetPatchCodePc() const; |
| 2218 | 2219 |
| 2219 uword GetDeoptPcAtNodeId(intptr_t node_id) const; | 2220 uword GetDeoptPcAtNodeId(intptr_t node_id) const; |
| 2220 uword GetTypeTestAtNodeId(intptr_t node_id) const; | 2221 uword GetTypeTestAtNodeId(intptr_t node_id) const; |
| 2221 | 2222 |
| 2222 // Returns true if there is an object in the code between 'start_offset' | 2223 // Returns true if there is an object in the code between 'start_offset' |
| 2223 // (inclusive) and 'end_offset' (exclusive). | 2224 // (inclusive) and 'end_offset' (exclusive). |
| 2224 bool ObjectExistInArea(intptr_t start_offest, intptr_t end_offset) const; | 2225 bool ObjectExistInArea(intptr_t start_offest, intptr_t end_offset) const; |
| 2225 | 2226 |
| 2226 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n]. | 2227 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n]. |
| 2227 // Returns the maximum id found. | 2228 // Returns the maximum id found. |
| 2228 intptr_t ExtractIcDataArraysAtCalls( | 2229 intptr_t ExtractIcDataArraysAtCalls( |
| 2229 GrowableArray<intptr_t>* node_ids, | 2230 GrowableArray<intptr_t>* node_ids, |
| 2230 const GrowableObjectArray& ic_data_objs) const; | 2231 const GrowableObjectArray& ic_data_objs) const; |
| 2231 | 2232 |
| 2232 private: | 2233 private: |
| 2234 // An object finder visitor interface. |
| 2235 class FindRawCodeVisitor : public FindObjectVisitor { |
| 2236 public: |
| 2237 explicit FindRawCodeVisitor(uword pc) : pc_(pc) { } |
| 2238 virtual ~FindRawCodeVisitor() { } |
| 2239 |
| 2240 // Check if object matches find condition. |
| 2241 virtual bool FindObject(RawObject* obj); |
| 2242 |
| 2243 private: |
| 2244 const uword pc_; |
| 2245 |
| 2246 DISALLOW_COPY_AND_ASSIGN(FindRawCodeVisitor); |
| 2247 }; |
| 2248 |
| 2233 static const intptr_t kEntrySize = sizeof(int32_t); // NOLINT | 2249 static const intptr_t kEntrySize = sizeof(int32_t); // NOLINT |
| 2234 | 2250 |
| 2235 void set_instructions(RawInstructions* instructions) { | 2251 void set_instructions(RawInstructions* instructions) { |
| 2236 raw_ptr()->instructions_ = instructions; | 2252 raw_ptr()->instructions_ = instructions; |
| 2237 } | 2253 } |
| 2238 void set_pointer_offsets_length(intptr_t value) { | 2254 void set_pointer_offsets_length(intptr_t value) { |
| 2239 ASSERT(value >= 0); | 2255 ASSERT(value >= 0); |
| 2240 raw_ptr()->pointer_offsets_length_ = value; | 2256 raw_ptr()->pointer_offsets_length_ = value; |
| 2241 } | 2257 } |
| 2242 int32_t* PointerOffsetAddrAt(int index) const { | 2258 int32_t* PointerOffsetAddrAt(int index) const { |
| (...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4893 } | 4909 } |
| 4894 | 4910 |
| 4895 | 4911 |
| 4896 intptr_t Stackmap::SizeInBits() const { | 4912 intptr_t Stackmap::SizeInBits() const { |
| 4897 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); | 4913 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); |
| 4898 } | 4914 } |
| 4899 | 4915 |
| 4900 } // namespace dart | 4916 } // namespace dart |
| 4901 | 4917 |
| 4902 #endif // VM_OBJECT_H_ | 4918 #endif // VM_OBJECT_H_ |
| OLD | NEW |