| 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 4375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4386 bool IsAllocationStubCode() const; | 4386 bool IsAllocationStubCode() const; |
| 4387 bool IsStubCode() const; | 4387 bool IsStubCode() const; |
| 4388 bool IsFunctionCode() const; | 4388 bool IsFunctionCode() const; |
| 4389 | 4389 |
| 4390 void DisableDartCode() const; | 4390 void DisableDartCode() const; |
| 4391 | 4391 |
| 4392 void DisableStubCode() const; | 4392 void DisableStubCode() const; |
| 4393 | 4393 |
| 4394 void Enable() const { | 4394 void Enable() const { |
| 4395 if (!IsDisabled()) return; | 4395 if (!IsDisabled()) return; |
| 4396 ASSERT(Thread::Current()->IsMutatorThread()); |
| 4396 ASSERT(instructions() != active_instructions()); | 4397 ASSERT(instructions() != active_instructions()); |
| 4397 set_active_instructions(instructions()); | 4398 set_active_instructions(instructions()); |
| 4398 } | 4399 } |
| 4399 | 4400 |
| 4400 bool IsDisabled() const { | 4401 bool IsDisabled() const { |
| 4401 return instructions() != active_instructions(); | 4402 return instructions() != active_instructions(); |
| 4402 } | 4403 } |
| 4403 | 4404 |
| 4404 private: | 4405 private: |
| 4405 void set_state_bits(intptr_t bits) const; | 4406 void set_state_bits(intptr_t bits) const; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4440 return Code::OptimizedBit::decode(code->ptr()->state_bits_); | 4441 return Code::OptimizedBit::decode(code->ptr()->state_bits_); |
| 4441 } | 4442 } |
| 4442 | 4443 |
| 4443 static const intptr_t kEntrySize = sizeof(int32_t); // NOLINT | 4444 static const intptr_t kEntrySize = sizeof(int32_t); // NOLINT |
| 4444 | 4445 |
| 4445 void set_compile_timestamp(int64_t timestamp) const { | 4446 void set_compile_timestamp(int64_t timestamp) const { |
| 4446 StoreNonPointer(&raw_ptr()->compile_timestamp_, timestamp); | 4447 StoreNonPointer(&raw_ptr()->compile_timestamp_, timestamp); |
| 4447 } | 4448 } |
| 4448 | 4449 |
| 4449 void set_active_instructions(RawInstructions* instructions) const { | 4450 void set_active_instructions(RawInstructions* instructions) const { |
| 4451 ASSERT(Thread::Current()->IsMutatorThread() || !is_alive()); |
| 4450 // RawInstructions are never allocated in New space and hence a | 4452 // RawInstructions are never allocated in New space and hence a |
| 4451 // store buffer update is not needed here. | 4453 // store buffer update is not needed here. |
| 4452 StorePointer(&raw_ptr()->active_instructions_, instructions); | 4454 StorePointer(&raw_ptr()->active_instructions_, instructions); |
| 4453 StoreNonPointer(&raw_ptr()->entry_point_, | 4455 StoreNonPointer(&raw_ptr()->entry_point_, |
| 4454 reinterpret_cast<uword>(instructions->ptr()) + | 4456 reinterpret_cast<uword>(instructions->ptr()) + |
| 4455 Instructions::HeaderSize()); | 4457 Instructions::HeaderSize()); |
| 4456 } | 4458 } |
| 4457 | 4459 |
| 4458 void set_instructions(RawInstructions* instructions) const { | 4460 void set_instructions(RawInstructions* instructions) const { |
| 4461 ASSERT(Thread::Current()->IsMutatorThread() || !is_alive()); |
| 4459 StorePointer(&raw_ptr()->instructions_, instructions); | 4462 StorePointer(&raw_ptr()->instructions_, instructions); |
| 4460 } | 4463 } |
| 4461 | 4464 |
| 4462 void set_pointer_offsets_length(intptr_t value) { | 4465 void set_pointer_offsets_length(intptr_t value) { |
| 4463 // The number of fixups is limited to 1-billion. | 4466 // The number of fixups is limited to 1-billion. |
| 4464 ASSERT(Utils::IsUint(30, value)); | 4467 ASSERT(Utils::IsUint(30, value)); |
| 4465 set_state_bits(PtrOffBits::update(value, raw_ptr()->state_bits_)); | 4468 set_state_bits(PtrOffBits::update(value, raw_ptr()->state_bits_)); |
| 4466 } | 4469 } |
| 4467 int32_t* PointerOffsetAddrAt(int index) const { | 4470 int32_t* PointerOffsetAddrAt(int index) const { |
| 4468 ASSERT(index >= 0); | 4471 ASSERT(index >= 0); |
| (...skipping 3738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8207 | 8210 |
| 8208 | 8211 |
| 8209 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8212 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 8210 intptr_t index) { | 8213 intptr_t index) { |
| 8211 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8214 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 8212 } | 8215 } |
| 8213 | 8216 |
| 8214 } // namespace dart | 8217 } // namespace dart |
| 8215 | 8218 |
| 8216 #endif // VM_OBJECT_H_ | 8219 #endif // VM_OBJECT_H_ |
| OLD | NEW |