Revert "Remove Code::active_instructions_."

This reverts commit 714027a81b.

Review URL: https://codereview.chromium.org/1821793002 .
This commit is contained in:
Ryan Macnak 2016-03-21 13:06:46 -07:00
parent c7b7c6490a
commit d3901a3fa1
4 changed files with 11 additions and 17 deletions

View file

@ -13509,10 +13509,9 @@ bool Code::IsFunctionCode() const {
void Code::DisableDartCode() const {
DEBUG_ASSERT(IsMutatorOrAtSafepoint());
ASSERT(IsFunctionCode());
ASSERT(!IsDisabled());
ASSERT(instructions() == active_instructions());
const Code& new_code =
Code::Handle(StubCode::FixCallersTarget_entry()->code());
ASSERT(new_code.instructions()->IsVMHeapObject());
SetActiveInstructions(new_code.instructions());
}
@ -13520,10 +13519,9 @@ void Code::DisableDartCode() const {
void Code::DisableStubCode() const {
ASSERT(Thread::Current()->IsMutatorThread());
ASSERT(IsAllocationStubCode());
ASSERT(!IsDisabled());
ASSERT(instructions() == active_instructions());
const Code& new_code =
Code::Handle(StubCode::FixAllocationStubTarget_entry()->code());
ASSERT(new_code.instructions()->IsVMHeapObject());
SetActiveInstructions(new_code.instructions());
}
@ -13532,6 +13530,7 @@ void Code::SetActiveInstructions(RawInstructions* instructions) const {
DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive());
// RawInstructions are never allocated in New space and hence a
// store buffer update is not needed here.
StorePointer(&raw_ptr()->active_instructions_, instructions);
StoreNonPointer(&raw_ptr()->entry_point_,
reinterpret_cast<uword>(instructions->ptr()) +
Instructions::HeaderSize());

View file

@ -4324,7 +4324,9 @@ class DeoptInfo : public AllStatic {
class Code : public Object {
public:
uword active_entry_point() const { return raw_ptr()->entry_point_; }
RawInstructions* active_instructions() const {
return raw_ptr()->active_instructions_;
}
RawInstructions* instructions() const { return raw_ptr()->instructions_; }
@ -4606,11 +4608,12 @@ class Code : public Object {
void Enable() const {
if (!IsDisabled()) return;
ASSERT(Thread::Current()->IsMutatorThread());
ASSERT(instructions() != active_instructions());
SetActiveInstructions(instructions());
}
bool IsDisabled() const {
return active_entry_point() != EntryPoint();
return instructions() != active_instructions();
}
private:

View file

@ -542,11 +542,8 @@ intptr_t RawCode::VisitCodePointers(RawCode* raw_obj,
RawCode* obj = raw_obj->ptr();
intptr_t length = Code::PtrOffBits::decode(obj->state_bits_);
#if defined(TARGET_ARCH_IA32)
// On IA32 only we embed pointers to objects directly in the generated
// instructions. The variable porition of a Code object describes where to
// find those pointers for tracing.
if (Code::AliveBit::decode(obj->state_bits_)) {
// Also visit all the embedded pointers in the corresponding instructions.
uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) +
Instructions::HeaderSize();
for (intptr_t i = 0; i < length; i++) {
@ -556,12 +553,6 @@ intptr_t RawCode::VisitCodePointers(RawCode* raw_obj,
}
}
return Code::InstanceSize(length);
#else
// On all other architectures, objects are referenced indirectly through
// either the ObjectPool or Thread.
ASSERT(length == 0);
return Code::InstanceSize(0);
#endif
}

View file

@ -1080,8 +1080,9 @@ class RawCode : public RawObject {
uword entry_point_;
RawObject** from() {
return reinterpret_cast<RawObject**>(&ptr()->instructions_);
return reinterpret_cast<RawObject**>(&ptr()->active_instructions_);
}
RawInstructions* active_instructions_;
RawInstructions* instructions_;
RawObjectPool* object_pool_;
// If owner_ is Function::null() the owner is a regular stub.