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 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2426 } | 2426 } |
2427 intptr_t usage_counter() const { | 2427 intptr_t usage_counter() const { |
2428 return raw_ptr()->usage_counter_; | 2428 return raw_ptr()->usage_counter_; |
2429 } | 2429 } |
2430 void set_usage_counter(intptr_t value) const { | 2430 void set_usage_counter(intptr_t value) const { |
2431 // TODO(Srdjan): Assert that this is thread-safe, i.e., only | 2431 // TODO(Srdjan): Assert that this is thread-safe, i.e., only |
2432 // set from mutator-thread or while at a safepoint (e.g., during marking). | 2432 // set from mutator-thread or while at a safepoint (e.g., during marking). |
2433 StoreNonPointer(&raw_ptr()->usage_counter_, value); | 2433 StoreNonPointer(&raw_ptr()->usage_counter_, value); |
2434 } | 2434 } |
2435 | 2435 |
2436 int16_t deoptimization_counter() const { | 2436 int8_t deoptimization_counter() const { |
2437 return raw_ptr()->deoptimization_counter_; | 2437 return raw_ptr()->deoptimization_counter_; |
2438 } | 2438 } |
2439 void set_deoptimization_counter(int16_t value) const { | 2439 void set_deoptimization_counter(int8_t value) const { |
| 2440 ASSERT(value >= 0); |
2440 StoreNonPointer(&raw_ptr()->deoptimization_counter_, value); | 2441 StoreNonPointer(&raw_ptr()->deoptimization_counter_, value); |
2441 } | 2442 } |
2442 | 2443 |
2443 static const intptr_t kMaxInstructionCount = (1 << 16) - 1; | 2444 static const intptr_t kMaxInstructionCount = (1 << 16) - 1; |
2444 intptr_t optimized_instruction_count() const { | 2445 intptr_t optimized_instruction_count() const { |
2445 return raw_ptr()->optimized_instruction_count_; | 2446 return raw_ptr()->optimized_instruction_count_; |
2446 } | 2447 } |
2447 void set_optimized_instruction_count(intptr_t value) const { | 2448 void set_optimized_instruction_count(intptr_t value) const { |
2448 ASSERT(value >= 0); | 2449 ASSERT(value >= 0); |
2449 if (value > kMaxInstructionCount) { | 2450 if (value > kMaxInstructionCount) { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2711 bool clone_ic_data) const; | 2712 bool clone_ic_data) const; |
2712 | 2713 |
2713 RawArray* ic_data_array() const; | 2714 RawArray* ic_data_array() const; |
2714 void ClearICDataArray() const; | 2715 void ClearICDataArray() const; |
2715 | 2716 |
2716 // Sets deopt reason in all ICData-s with given deopt_id. | 2717 // Sets deopt reason in all ICData-s with given deopt_id. |
2717 void SetDeoptReasonForAll(intptr_t deopt_id, ICData::DeoptReasonId reason); | 2718 void SetDeoptReasonForAll(intptr_t deopt_id, ICData::DeoptReasonId reason); |
2718 | 2719 |
2719 void set_modifier(RawFunction::AsyncModifier value) const; | 2720 void set_modifier(RawFunction::AsyncModifier value) const; |
2720 | 2721 |
| 2722 // 'was_compiled' is true if the function was compiled once in this |
| 2723 // VM instantiation. It independent from presence of type feedback |
| 2724 // (ic_data_array) and code, whihc may be loaded from a snapshot. |
| 2725 void set_was_compiled(bool value) const { |
| 2726 StoreNonPointer(&raw_ptr()->was_compiled_, value ? 1 : 0); |
| 2727 } |
| 2728 bool was_compiled() const { return raw_ptr()->was_compiled_ == 1; } |
| 2729 |
| 2730 |
2721 // static: Considered during class-side or top-level resolution rather than | 2731 // static: Considered during class-side or top-level resolution rather than |
2722 // instance-side resolution. | 2732 // instance-side resolution. |
2723 // const: Valid target of a const constructor call. | 2733 // const: Valid target of a const constructor call. |
2724 // abstract: Skipped during instance-side resolution. | 2734 // abstract: Skipped during instance-side resolution. |
2725 // reflectable: Enumerated by mirrors, invocable by mirrors. False for private | 2735 // reflectable: Enumerated by mirrors, invocable by mirrors. False for private |
2726 // functions of dart: libraries. | 2736 // functions of dart: libraries. |
2727 // debuggable: Valid location of a breakpoint. Synthetic code is not | 2737 // debuggable: Valid location of a breakpoint. Synthetic code is not |
2728 // debuggable. | 2738 // debuggable. |
2729 // visible: Frame is included in stack traces. Synthetic code such as | 2739 // visible: Frame is included in stack traces. Synthetic code such as |
2730 // dispatchers is not visible. Synthetic code that can trigger | 2740 // dispatchers is not visible. Synthetic code that can trigger |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2817 void set_kind(RawFunction::Kind value) const; | 2827 void set_kind(RawFunction::Kind value) const; |
2818 void set_parent_function(const Function& value) const; | 2828 void set_parent_function(const Function& value) const; |
2819 void set_owner(const Object& value) const; | 2829 void set_owner(const Object& value) const; |
2820 RawFunction* implicit_closure_function() const; | 2830 RawFunction* implicit_closure_function() const; |
2821 void set_implicit_closure_function(const Function& value) const; | 2831 void set_implicit_closure_function(const Function& value) const; |
2822 RawInstance* implicit_static_closure() const; | 2832 RawInstance* implicit_static_closure() const; |
2823 void set_implicit_static_closure(const Instance& closure) const; | 2833 void set_implicit_static_closure(const Instance& closure) const; |
2824 RawScript* eval_script() const; | 2834 RawScript* eval_script() const; |
2825 void set_eval_script(const Script& value) const; | 2835 void set_eval_script(const Script& value) const; |
2826 void set_num_optional_parameters(intptr_t value) const; // Encoded value. | 2836 void set_num_optional_parameters(intptr_t value) const; // Encoded value. |
2827 void set_kind_tag(intptr_t value) const; | 2837 void set_kind_tag(uint32_t value) const; |
2828 void set_data(const Object& value) const; | 2838 void set_data(const Object& value) const; |
2829 | 2839 |
2830 static RawFunction* New(); | 2840 static RawFunction* New(); |
2831 | 2841 |
2832 RawString* QualifiedName(NameVisibility name_visibility) const; | 2842 RawString* QualifiedName(NameVisibility name_visibility) const; |
2833 | 2843 |
2834 void BuildSignatureParameters( | 2844 void BuildSignatureParameters( |
2835 bool instantiate, | 2845 bool instantiate, |
2836 NameVisibility name_visibility, | 2846 NameVisibility name_visibility, |
2837 const TypeArguments& instantiator, | 2847 const TypeArguments& instantiator, |
(...skipping 5586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8424 | 8434 |
8425 | 8435 |
8426 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8436 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8427 intptr_t index) { | 8437 intptr_t index) { |
8428 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8438 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8429 } | 8439 } |
8430 | 8440 |
8431 } // namespace dart | 8441 } // namespace dart |
8432 | 8442 |
8433 #endif // VM_OBJECT_H_ | 8443 #endif // VM_OBJECT_H_ |
OLD | NEW |