| 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 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 // Return the most recently compiled and installed code for this function. | 2135 // Return the most recently compiled and installed code for this function. |
| 2136 // It is not the only Code object that points to this function. | 2136 // It is not the only Code object that points to this function. |
| 2137 RawCode* CurrentCode() const { | 2137 RawCode* CurrentCode() const { |
| 2138 return raw_ptr()->instructions_->ptr()->code_; | 2138 return raw_ptr()->instructions_->ptr()->code_; |
| 2139 } | 2139 } |
| 2140 | 2140 |
| 2141 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } | 2141 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } |
| 2142 void set_unoptimized_code(const Code& value) const; | 2142 void set_unoptimized_code(const Code& value) const; |
| 2143 bool HasCode() const; | 2143 bool HasCode() const; |
| 2144 | 2144 |
| 2145 static intptr_t instructions_offset() { | 2145 static intptr_t entry_point_offset() { |
| 2146 return OFFSET_OF(RawFunction, instructions_); | 2146 return OFFSET_OF(RawFunction, entry_point_); |
| 2147 } | 2147 } |
| 2148 | 2148 |
| 2149 // Returns true if there is at least one debugger breakpoint | 2149 // Returns true if there is at least one debugger breakpoint |
| 2150 // set in this function. | 2150 // set in this function. |
| 2151 bool HasBreakpoint() const; | 2151 bool HasBreakpoint() const; |
| 2152 | 2152 |
| 2153 RawContextScope* context_scope() const; | 2153 RawContextScope* context_scope() const; |
| 2154 void set_context_scope(const ContextScope& value) const; | 2154 void set_context_scope(const ContextScope& value) const; |
| 2155 | 2155 |
| 2156 // Enclosing function of this local function. | 2156 // Enclosing function of this local function. |
| (...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4022 static void UnpackInto(const Array& table, | 4022 static void UnpackInto(const Array& table, |
| 4023 const TypedData& packed, | 4023 const TypedData& packed, |
| 4024 GrowableArray<DeoptInstr*>* instructions, | 4024 GrowableArray<DeoptInstr*>* instructions, |
| 4025 intptr_t length); | 4025 intptr_t length); |
| 4026 }; | 4026 }; |
| 4027 | 4027 |
| 4028 | 4028 |
| 4029 class Code : public Object { | 4029 class Code : public Object { |
| 4030 public: | 4030 public: |
| 4031 RawInstructions* instructions() const { return raw_ptr()->instructions_; } | 4031 RawInstructions* instructions() const { return raw_ptr()->instructions_; } |
| 4032 static intptr_t instructions_offset() { | 4032 |
| 4033 return OFFSET_OF(RawCode, instructions_); | 4033 static intptr_t entry_point_offset() { |
| 4034 return OFFSET_OF(RawCode, entry_point_); |
| 4034 } | 4035 } |
| 4036 |
| 4035 intptr_t pointer_offsets_length() const { | 4037 intptr_t pointer_offsets_length() const { |
| 4036 return PtrOffBits::decode(raw_ptr()->state_bits_); | 4038 return PtrOffBits::decode(raw_ptr()->state_bits_); |
| 4037 } | 4039 } |
| 4038 | 4040 |
| 4039 bool is_optimized() const { | 4041 bool is_optimized() const { |
| 4040 return OptimizedBit::decode(raw_ptr()->state_bits_); | 4042 return OptimizedBit::decode(raw_ptr()->state_bits_); |
| 4041 } | 4043 } |
| 4042 void set_is_optimized(bool value) const; | 4044 void set_is_optimized(bool value) const; |
| 4043 bool is_alive() const { | 4045 bool is_alive() const { |
| 4044 return AliveBit::decode(raw_ptr()->state_bits_); | 4046 return AliveBit::decode(raw_ptr()->state_bits_); |
| 4045 } | 4047 } |
| 4046 void set_is_alive(bool value) const; | 4048 void set_is_alive(bool value) const; |
| 4047 | 4049 |
| 4048 uword EntryPoint() const { | 4050 uword EntryPoint() const { |
| 4049 const Instructions& instr = Instructions::Handle(instructions()); | 4051 ASSERT(raw_ptr()->entry_point_ == |
| 4050 return instr.EntryPoint(); | 4052 Instructions::Handle(instructions()).EntryPoint()); |
| 4053 return raw_ptr()->entry_point_; |
| 4051 } | 4054 } |
| 4052 intptr_t Size() const { | 4055 intptr_t Size() const { |
| 4053 const Instructions& instr = Instructions::Handle(instructions()); | 4056 const Instructions& instr = Instructions::Handle(instructions()); |
| 4054 return instr.size(); | 4057 return instr.size(); |
| 4055 } | 4058 } |
| 4056 RawObjectPool* GetObjectPool() const { | 4059 RawObjectPool* GetObjectPool() const { |
| 4057 const Instructions& instr = Instructions::Handle(instructions()); | 4060 const Instructions& instr = Instructions::Handle(instructions()); |
| 4058 return instr.object_pool(); | 4061 return instr.object_pool(); |
| 4059 } | 4062 } |
| 4060 bool ContainsInstructionAt(uword addr) const { | 4063 bool ContainsInstructionAt(uword addr) const { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4331 static const intptr_t kEntrySize = sizeof(int32_t); // NOLINT | 4334 static const intptr_t kEntrySize = sizeof(int32_t); // NOLINT |
| 4332 | 4335 |
| 4333 void set_compile_timestamp(int64_t timestamp) const { | 4336 void set_compile_timestamp(int64_t timestamp) const { |
| 4334 StoreNonPointer(&raw_ptr()->compile_timestamp_, timestamp); | 4337 StoreNonPointer(&raw_ptr()->compile_timestamp_, timestamp); |
| 4335 } | 4338 } |
| 4336 | 4339 |
| 4337 void set_instructions(RawInstructions* instructions) { | 4340 void set_instructions(RawInstructions* instructions) { |
| 4338 // RawInstructions are never allocated in New space and hence a | 4341 // RawInstructions are never allocated in New space and hence a |
| 4339 // store buffer update is not needed here. | 4342 // store buffer update is not needed here. |
| 4340 StorePointer(&raw_ptr()->instructions_, instructions); | 4343 StorePointer(&raw_ptr()->instructions_, instructions); |
| 4344 uword entry_point = reinterpret_cast<uword>(instructions->ptr()) + |
| 4345 Instructions::HeaderSize(); |
| 4346 StoreNonPointer(&raw_ptr()->entry_point_, entry_point); |
| 4341 } | 4347 } |
| 4342 | 4348 |
| 4343 void set_pointer_offsets_length(intptr_t value) { | 4349 void set_pointer_offsets_length(intptr_t value) { |
| 4344 // The number of fixups is limited to 1-billion. | 4350 // The number of fixups is limited to 1-billion. |
| 4345 ASSERT(Utils::IsUint(30, value)); | 4351 ASSERT(Utils::IsUint(30, value)); |
| 4346 set_state_bits(PtrOffBits::update(value, raw_ptr()->state_bits_)); | 4352 set_state_bits(PtrOffBits::update(value, raw_ptr()->state_bits_)); |
| 4347 } | 4353 } |
| 4348 int32_t* PointerOffsetAddrAt(int index) const { | 4354 int32_t* PointerOffsetAddrAt(int index) const { |
| 4349 ASSERT(index >= 0); | 4355 ASSERT(index >= 0); |
| 4350 ASSERT(index < pointer_offsets_length()); | 4356 ASSERT(index < pointer_offsets_length()); |
| (...skipping 3678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8029 | 8035 |
| 8030 | 8036 |
| 8031 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8037 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 8032 intptr_t index) { | 8038 intptr_t index) { |
| 8033 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8039 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 8034 } | 8040 } |
| 8035 | 8041 |
| 8036 } // namespace dart | 8042 } // namespace dart |
| 8037 | 8043 |
| 8038 #endif // VM_OBJECT_H_ | 8044 #endif // VM_OBJECT_H_ |
| OLD | NEW |