| Index: runtime/vm/object.h
|
| diff --git a/runtime/vm/object.h b/runtime/vm/object.h
|
| index 711320c264b0af8372580e176087ab48c961dc62..e82140a6670082a5bacaf957622e863a901bb45c 100644
|
| --- a/runtime/vm/object.h
|
| +++ b/runtime/vm/object.h
|
| @@ -2570,101 +2570,39 @@ class Function : public Object {
|
|
|
| intptr_t NumImplicitParameters() const;
|
|
|
| - static intptr_t usage_counter_offset() {
|
| #if defined(DART_PRECOMPILED_RUNTIME)
|
| - UNREACHABLE();
|
| - return 0;
|
| -#else
|
| - return OFFSET_OF(RawFunction, usage_counter_);
|
| -#endif
|
| - }
|
| - intptr_t usage_counter() const {
|
| -#if defined(DART_PRECOMPILED_RUNTIME)
|
| - return 0;
|
| +#define DEFINE_GETTERS_AND_SETTERS(return_type, type, name) \
|
| + static intptr_t name##_offset() { \
|
| + UNREACHABLE(); \
|
| + return 0; \
|
| + } \
|
| + return_type name() const { return 0; } \
|
| + \
|
| + void set_##name(type value) const { UNREACHABLE(); }
|
| #else
|
| - return raw_ptr()->usage_counter_;
|
| -#endif
|
| +#define DEFINE_GETTERS_AND_SETTERS(return_type, type, name) \
|
| + static intptr_t name##_offset() { return OFFSET_OF(RawFunction, name##_); } \
|
| + return_type name() const { return raw_ptr()->name##_; } \
|
| + \
|
| + void set_##name(type value) const { \
|
| + StoreNonPointer(&raw_ptr()->name##_, value); \
|
| }
|
| - void set_usage_counter(intptr_t value) const {
|
| -#if defined(DART_PRECOMPILED_RUNTIME)
|
| - UNREACHABLE();
|
| -#else
|
| - // TODO(Srdjan): Assert that this is thread-safe, i.e., only
|
| - // set from mutator-thread or while at a safepoint (e.g., during marking).
|
| - StoreNonPointer(&raw_ptr()->usage_counter_, value);
|
| #endif
|
| - }
|
|
|
| - int8_t deoptimization_counter() const {
|
| -#if defined(DART_PRECOMPILED_RUNTIME)
|
| - return 0;
|
| -#else
|
| - return raw_ptr()->deoptimization_counter_;
|
| -#endif
|
| - }
|
| - void set_deoptimization_counter(int8_t value) const {
|
| -#if defined(DART_PRECOMPILED_RUNTIME)
|
| - UNREACHABLE();
|
| -#else
|
| - ASSERT(value >= 0);
|
| - StoreNonPointer(&raw_ptr()->deoptimization_counter_, value);
|
| -#endif
|
| - }
|
| + JIT_FUNCTION_COUNTERS(DEFINE_GETTERS_AND_SETTERS)
|
|
|
| - static const intptr_t kMaxInstructionCount = (1 << 16) - 1;
|
| - intptr_t optimized_instruction_count() const {
|
| -#if defined(DART_PRECOMPILED_RUNTIME)
|
| - UNREACHABLE();
|
| - return 0;
|
| -#else
|
| - return raw_ptr()->optimized_instruction_count_;
|
| -#endif
|
| - }
|
| - void set_optimized_instruction_count(intptr_t value) const {
|
| -#if defined(DART_PRECOMPILED_RUNTIME)
|
| - UNREACHABLE();
|
| -#else
|
| - ASSERT(value >= 0);
|
| - if (value > kMaxInstructionCount) {
|
| - value = kMaxInstructionCount;
|
| - }
|
| - StoreNonPointer(&raw_ptr()->optimized_instruction_count_,
|
| - static_cast<uint16_t>(value));
|
| -#endif
|
| - }
|
| +#undef DEFINE_GETTERS_AND_SETTERS
|
|
|
| - intptr_t optimized_call_site_count() const {
|
| -#if defined(DART_PRECOMPILED_RUNTIME)
|
| - return 0;
|
| -#else
|
| - return raw_ptr()->optimized_call_site_count_;
|
| -#endif
|
| - }
|
| - void set_optimized_call_site_count(intptr_t value) const {
|
| -#if defined(DART_PRECOMPILED_RUNTIME)
|
| - UNREACHABLE();
|
| -#else
|
| - ASSERT(value >= 0);
|
| - if (value > kMaxInstructionCount) {
|
| - value = kMaxInstructionCount;
|
| - }
|
| - StoreNonPointer(&raw_ptr()->optimized_call_site_count_,
|
| - static_cast<uint16_t>(value));
|
| -#endif
|
| - }
|
| + static const intptr_t kMaxInstructionCount = (1 << 16) - 1;
|
|
|
| - intptr_t kernel_offset() const {
|
| -#if defined(DART_PRECOMPILED_RUNTIME)
|
| - return 0;
|
| -#else
|
| - return raw_ptr()->kernel_offset_;
|
| -#endif
|
| + void SetOptimizedInstructionCountClamped(uintptr_t value) const {
|
| + if (value > kMaxInstructionCount) value = kMaxInstructionCount;
|
| + set_optimized_instruction_count(value);
|
| }
|
|
|
| - void set_kernel_offset(intptr_t kernel_offset) const {
|
| -#if !defined(DART_PRECOMPILED_RUNTIME)
|
| - StoreNonPointer(&raw_ptr()->kernel_offset_, kernel_offset);
|
| -#endif
|
| + void SetOptimizedCallSiteCountClamped(uintptr_t value) const {
|
| + if (value > kMaxInstructionCount) value = kMaxInstructionCount;
|
| + set_optimized_call_site_count(value);
|
| }
|
|
|
| RawTypedData* kernel_data() const { return raw_ptr()->kernel_data_; }
|
| @@ -2951,25 +2889,15 @@ class Function : public Object {
|
|
|
| void set_modifier(RawFunction::AsyncModifier value) const;
|
|
|
| - // 'was_compiled' is true if the function was compiled once in this
|
| + // 'WasCompiled' is true if the function was compiled once in this
|
| // VM instantiation. It is independent from presence of type feedback
|
| // (ic_data_array) and code, which may be loaded from a snapshot.
|
| - void set_was_compiled(bool value) const {
|
| -#if defined(DART_PRECOMPILED_RUNTIME)
|
| - UNREACHABLE();
|
| -#else
|
| - StoreNonPointer(&raw_ptr()->was_compiled_, value ? 1 : 0);
|
| -#endif
|
| - }
|
| - bool was_compiled() const {
|
| -#if defined(DART_PRECOMPILED_RUNTIME)
|
| - UNREACHABLE();
|
| - return true;
|
| -#else
|
| - return raw_ptr()->was_compiled_ == 1;
|
| -#endif
|
| + void SetWasCompiled(bool value) const {
|
| + set_was_compiled_numeric(value ? 1 : 0);
|
| }
|
|
|
| + bool WasCompiled() const { return was_compiled_numeric() != 0; }
|
| +
|
| // static: Considered during class-side or top-level resolution rather than
|
| // instance-side resolution.
|
| // const: Valid target of a const constructor call.
|
|
|