| 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 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2254 kDeoptReasonEntry = 3, // DeoptReasonId. | 2254 kDeoptReasonEntry = 3, // DeoptReasonId. |
| 2255 kTryIndexEntry = 4, // Try block index. | 2255 kTryIndexEntry = 4, // Try block index. |
| 2256 kDeoptIndexEntry = 4, // Deoptimization array index. | 2256 kDeoptIndexEntry = 4, // Deoptimization array index. |
| 2257 // We would potentially be adding other objects here like | 2257 // We would potentially be adding other objects here like |
| 2258 // pointer maps for optimized functions, local variables information etc. | 2258 // pointer maps for optimized functions, local variables information etc. |
| 2259 kNumberOfEntries = 5, | 2259 kNumberOfEntries = 5, |
| 2260 }; | 2260 }; |
| 2261 | 2261 |
| 2262 public: | 2262 public: |
| 2263 enum Kind { | 2263 enum Kind { |
| 2264 kDeopt = 0, // Deoptimization continuation point. | 2264 kDeoptBefore = 0, // Deoptimization continuation point before instruction. |
| 2265 kDeoptIndex, // Index into deopt info array. | 2265 kDeoptAfter, // Deoptimization continuation point after instruction. |
| 2266 kPatchCode, // Buffer for patching code entry. | 2266 kDeoptIndex, // Index into deopt info array. |
| 2267 kIcCall, // IC call. | 2267 kPatchCode, // Buffer for patching code entry. |
| 2268 kFuncCall, // Call to known target, e.g. static call, closure call. | 2268 kIcCall, // IC call. |
| 2269 kReturn, // Return from function. | 2269 kFuncCall, // Call to known target, e.g. static call, closure call. |
| 2270 kReturn, // Return from function. |
| 2270 kOther | 2271 kOther |
| 2271 }; | 2272 }; |
| 2272 | 2273 |
| 2273 intptr_t Length() const; | 2274 intptr_t Length() const; |
| 2274 | 2275 |
| 2275 uword PC(intptr_t index) const; | 2276 uword PC(intptr_t index) const; |
| 2276 PcDescriptors::Kind DescriptorKind(intptr_t index) const; | 2277 PcDescriptors::Kind DescriptorKind(intptr_t index) const; |
| 2277 const char* KindAsStr(intptr_t index) const; | 2278 const char* KindAsStr(intptr_t index) const; |
| 2278 intptr_t DeoptId(intptr_t index) const; | 2279 intptr_t DeoptId(intptr_t index) const; |
| 2279 intptr_t TokenPos(intptr_t index) const; | 2280 intptr_t TokenPos(intptr_t index) const; |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2627 static RawCode* LookupCode(uword pc); | 2628 static RawCode* LookupCode(uword pc); |
| 2628 | 2629 |
| 2629 int32_t GetPointerOffsetAt(int index) const { | 2630 int32_t GetPointerOffsetAt(int index) const { |
| 2630 return *PointerOffsetAddrAt(index); | 2631 return *PointerOffsetAddrAt(index); |
| 2631 } | 2632 } |
| 2632 intptr_t GetTokenIndexOfPC(uword pc) const; | 2633 intptr_t GetTokenIndexOfPC(uword pc) const; |
| 2633 | 2634 |
| 2634 // Find pc of patch code buffer. Return 0 if not found. | 2635 // Find pc of patch code buffer. Return 0 if not found. |
| 2635 uword GetPatchCodePc() const; | 2636 uword GetPatchCodePc() const; |
| 2636 | 2637 |
| 2637 uword GetDeoptPcAtDeoptId(intptr_t deopt_id) const; | 2638 uword GetDeoptBeforePcAtDeoptId(intptr_t deopt_id) const; |
| 2639 uword GetDeoptAfterPcAtDeoptId(intptr_t deopt_id) const; |
| 2638 | 2640 |
| 2639 // Returns true if there is an object in the code between 'start_offset' | 2641 // Returns true if there is an object in the code between 'start_offset' |
| 2640 // (inclusive) and 'end_offset' (exclusive). | 2642 // (inclusive) and 'end_offset' (exclusive). |
| 2641 bool ObjectExistsInArea(intptr_t start_offest, intptr_t end_offset) const; | 2643 bool ObjectExistsInArea(intptr_t start_offest, intptr_t end_offset) const; |
| 2642 | 2644 |
| 2643 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n]. | 2645 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n]. |
| 2644 // Returns the maximum id found. | 2646 // Returns the maximum id found. |
| 2645 intptr_t ExtractIcDataArraysAtCalls( | 2647 intptr_t ExtractIcDataArraysAtCalls( |
| 2646 GrowableArray<intptr_t>* node_ids, | 2648 GrowableArray<intptr_t>* node_ids, |
| 2647 const GrowableObjectArray& ic_data_objs) const; | 2649 const GrowableObjectArray& ic_data_objs) const; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2675 int32_t* PointerOffsetAddrAt(int index) const { | 2677 int32_t* PointerOffsetAddrAt(int index) const { |
| 2676 ASSERT(index >= 0); | 2678 ASSERT(index >= 0); |
| 2677 ASSERT(index < pointer_offsets_length()); | 2679 ASSERT(index < pointer_offsets_length()); |
| 2678 // TODO(iposva): Unit test is missing for this functionality. | 2680 // TODO(iposva): Unit test is missing for this functionality. |
| 2679 return &raw_ptr()->data_[index]; | 2681 return &raw_ptr()->data_[index]; |
| 2680 } | 2682 } |
| 2681 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { | 2683 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { |
| 2682 *PointerOffsetAddrAt(index) = offset_in_instructions; | 2684 *PointerOffsetAddrAt(index) = offset_in_instructions; |
| 2683 } | 2685 } |
| 2684 | 2686 |
| 2687 uword GetPcForDeoptId(intptr_t deopt_id, PcDescriptors::Kind kind) const; |
| 2688 |
| 2685 // New is a private method as RawInstruction and RawCode objects should | 2689 // New is a private method as RawInstruction and RawCode objects should |
| 2686 // only be created using the Code::FinalizeCode method. This method creates | 2690 // only be created using the Code::FinalizeCode method. This method creates |
| 2687 // the RawInstruction and RawCode objects, sets up the pointer offsets | 2691 // the RawInstruction and RawCode objects, sets up the pointer offsets |
| 2688 // and links the two in a GC safe manner. | 2692 // and links the two in a GC safe manner. |
| 2689 static RawCode* New(intptr_t pointer_offsets_length); | 2693 static RawCode* New(intptr_t pointer_offsets_length); |
| 2690 | 2694 |
| 2691 HEAP_OBJECT_IMPLEMENTATION(Code, Object); | 2695 HEAP_OBJECT_IMPLEMENTATION(Code, Object); |
| 2692 friend class Class; | 2696 friend class Class; |
| 2693 }; | 2697 }; |
| 2694 | 2698 |
| (...skipping 2843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5538 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5542 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5539 return false; | 5543 return false; |
| 5540 } | 5544 } |
| 5541 } | 5545 } |
| 5542 return true; | 5546 return true; |
| 5543 } | 5547 } |
| 5544 | 5548 |
| 5545 } // namespace dart | 5549 } // namespace dart |
| 5546 | 5550 |
| 5547 #endif // VM_OBJECT_H_ | 5551 #endif // VM_OBJECT_H_ |
| OLD | NEW |