| 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2634 static RawCode* LookupCode(uword pc); | 2635 static RawCode* LookupCode(uword pc); |
| 2635 | 2636 |
| 2636 int32_t GetPointerOffsetAt(int index) const { | 2637 int32_t GetPointerOffsetAt(int index) const { |
| 2637 return *PointerOffsetAddrAt(index); | 2638 return *PointerOffsetAddrAt(index); |
| 2638 } | 2639 } |
| 2639 intptr_t GetTokenIndexOfPC(uword pc) const; | 2640 intptr_t GetTokenIndexOfPC(uword pc) const; |
| 2640 | 2641 |
| 2641 // Find pc of patch code buffer. Return 0 if not found. | 2642 // Find pc of patch code buffer. Return 0 if not found. |
| 2642 uword GetPatchCodePc() const; | 2643 uword GetPatchCodePc() const; |
| 2643 | 2644 |
| 2644 uword GetDeoptPcAtDeoptId(intptr_t deopt_id) const; | 2645 uword GetDeoptBeforePcAtDeoptId(intptr_t deopt_id) const; |
| 2646 uword GetDeoptAfterPcAtDeoptId(intptr_t deopt_id) const; |
| 2645 | 2647 |
| 2646 // Returns true if there is an object in the code between 'start_offset' | 2648 // Returns true if there is an object in the code between 'start_offset' |
| 2647 // (inclusive) and 'end_offset' (exclusive). | 2649 // (inclusive) and 'end_offset' (exclusive). |
| 2648 bool ObjectExistsInArea(intptr_t start_offest, intptr_t end_offset) const; | 2650 bool ObjectExistsInArea(intptr_t start_offest, intptr_t end_offset) const; |
| 2649 | 2651 |
| 2650 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n]. | 2652 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n]. |
| 2651 // Returns the maximum id found. | 2653 // Returns the maximum id found. |
| 2652 intptr_t ExtractIcDataArraysAtCalls( | 2654 intptr_t ExtractIcDataArraysAtCalls( |
| 2653 GrowableArray<intptr_t>* node_ids, | 2655 GrowableArray<intptr_t>* node_ids, |
| 2654 const GrowableObjectArray& ic_data_objs) const; | 2656 const GrowableObjectArray& ic_data_objs) const; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2682 int32_t* PointerOffsetAddrAt(int index) const { | 2684 int32_t* PointerOffsetAddrAt(int index) const { |
| 2683 ASSERT(index >= 0); | 2685 ASSERT(index >= 0); |
| 2684 ASSERT(index < pointer_offsets_length()); | 2686 ASSERT(index < pointer_offsets_length()); |
| 2685 // TODO(iposva): Unit test is missing for this functionality. | 2687 // TODO(iposva): Unit test is missing for this functionality. |
| 2686 return &raw_ptr()->data_[index]; | 2688 return &raw_ptr()->data_[index]; |
| 2687 } | 2689 } |
| 2688 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { | 2690 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { |
| 2689 *PointerOffsetAddrAt(index) = offset_in_instructions; | 2691 *PointerOffsetAddrAt(index) = offset_in_instructions; |
| 2690 } | 2692 } |
| 2691 | 2693 |
| 2694 uword GetPcForDeoptId(intptr_t deopt_id, PcDescriptors::Kind kind) const; |
| 2695 |
| 2692 // New is a private method as RawInstruction and RawCode objects should | 2696 // New is a private method as RawInstruction and RawCode objects should |
| 2693 // only be created using the Code::FinalizeCode method. This method creates | 2697 // only be created using the Code::FinalizeCode method. This method creates |
| 2694 // the RawInstruction and RawCode objects, sets up the pointer offsets | 2698 // the RawInstruction and RawCode objects, sets up the pointer offsets |
| 2695 // and links the two in a GC safe manner. | 2699 // and links the two in a GC safe manner. |
| 2696 static RawCode* New(intptr_t pointer_offsets_length); | 2700 static RawCode* New(intptr_t pointer_offsets_length); |
| 2697 | 2701 |
| 2698 HEAP_OBJECT_IMPLEMENTATION(Code, Object); | 2702 HEAP_OBJECT_IMPLEMENTATION(Code, Object); |
| 2699 friend class Class; | 2703 friend class Class; |
| 2700 }; | 2704 }; |
| 2701 | 2705 |
| (...skipping 2843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5545 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5549 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5546 return false; | 5550 return false; |
| 5547 } | 5551 } |
| 5548 } | 5552 } |
| 5549 return true; | 5553 return true; |
| 5550 } | 5554 } |
| 5551 | 5555 |
| 5552 } // namespace dart | 5556 } // namespace dart |
| 5553 | 5557 |
| 5554 #endif // VM_OBJECT_H_ | 5558 #endif // VM_OBJECT_H_ |
| OLD | NEW |