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 void set_was_compiled(bool value) const { |
| 2723 StoreNonPointer(&raw_ptr()->was_compiled_, value ? 1 : 0); |
| 2724 } |
| 2725 bool was_compiled() const { return raw_ptr()->was_compiled_ == 1; } |
| 2726 |
| 2727 |
2721 // static: Considered during class-side or top-level resolution rather than | 2728 // static: Considered during class-side or top-level resolution rather than |
2722 // instance-side resolution. | 2729 // instance-side resolution. |
2723 // const: Valid target of a const constructor call. | 2730 // const: Valid target of a const constructor call. |
2724 // abstract: Skipped during instance-side resolution. | 2731 // abstract: Skipped during instance-side resolution. |
2725 // reflectable: Enumerated by mirrors, invocable by mirrors. False for private | 2732 // reflectable: Enumerated by mirrors, invocable by mirrors. False for private |
2726 // functions of dart: libraries. | 2733 // functions of dart: libraries. |
2727 // debuggable: Valid location of a breakpoint. Synthetic code is not | 2734 // debuggable: Valid location of a breakpoint. Synthetic code is not |
2728 // debuggable. | 2735 // debuggable. |
2729 // visible: Frame is included in stack traces. Synthetic code such as | 2736 // visible: Frame is included in stack traces. Synthetic code such as |
2730 // dispatchers is not visible. Synthetic code that can trigger | 2737 // 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; | 2824 void set_kind(RawFunction::Kind value) const; |
2818 void set_parent_function(const Function& value) const; | 2825 void set_parent_function(const Function& value) const; |
2819 void set_owner(const Object& value) const; | 2826 void set_owner(const Object& value) const; |
2820 RawFunction* implicit_closure_function() const; | 2827 RawFunction* implicit_closure_function() const; |
2821 void set_implicit_closure_function(const Function& value) const; | 2828 void set_implicit_closure_function(const Function& value) const; |
2822 RawInstance* implicit_static_closure() const; | 2829 RawInstance* implicit_static_closure() const; |
2823 void set_implicit_static_closure(const Instance& closure) const; | 2830 void set_implicit_static_closure(const Instance& closure) const; |
2824 RawScript* eval_script() const; | 2831 RawScript* eval_script() const; |
2825 void set_eval_script(const Script& value) const; | 2832 void set_eval_script(const Script& value) const; |
2826 void set_num_optional_parameters(intptr_t value) const; // Encoded value. | 2833 void set_num_optional_parameters(intptr_t value) const; // Encoded value. |
2827 void set_kind_tag(intptr_t value) const; | 2834 void set_kind_tag(uint32_t value) const; |
2828 void set_data(const Object& value) const; | 2835 void set_data(const Object& value) const; |
2829 | 2836 |
2830 static RawFunction* New(); | 2837 static RawFunction* New(); |
2831 | 2838 |
2832 RawString* QualifiedName(NameVisibility name_visibility) const; | 2839 RawString* QualifiedName(NameVisibility name_visibility) const; |
2833 | 2840 |
2834 void BuildSignatureParameters( | 2841 void BuildSignatureParameters( |
2835 bool instantiate, | 2842 bool instantiate, |
2836 NameVisibility name_visibility, | 2843 NameVisibility name_visibility, |
2837 const TypeArguments& instantiator, | 2844 const TypeArguments& instantiator, |
(...skipping 5586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8424 | 8431 |
8425 | 8432 |
8426 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8433 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8427 intptr_t index) { | 8434 intptr_t index) { |
8428 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8435 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8429 } | 8436 } |
8430 | 8437 |
8431 } // namespace dart | 8438 } // namespace dart |
8432 | 8439 |
8433 #endif // VM_OBJECT_H_ | 8440 #endif // VM_OBJECT_H_ |
OLD | NEW |