Minor cleanup: use handle when setting instructions in code object.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2416963009 .
This commit is contained in:
Regis Crelier 2016-10-14 16:06:59 -07:00
parent a43d37be81
commit 0ac91fab5c
3 changed files with 14 additions and 14 deletions

View file

@ -14293,8 +14293,8 @@ RawCode* Code::FinalizeCode(const char* name,
}
// Hook up Code and Instructions objects.
code.SetActiveInstructions(instrs.raw());
code.set_instructions(instrs.raw());
code.SetActiveInstructions(instrs);
code.set_instructions(instrs);
code.set_is_alive(true);
// Set object pool in Instructions object.
@ -14506,7 +14506,7 @@ void Code::DisableDartCode() const {
ASSERT(instructions() == active_instructions());
const Code& new_code =
Code::Handle(StubCode::FixCallersTarget_entry()->code());
SetActiveInstructions(new_code.instructions());
SetActiveInstructions(Instructions::Handle(new_code.instructions()));
}
@ -14517,7 +14517,7 @@ void Code::DisableStubCode() const {
ASSERT(instructions() == active_instructions());
const Code& new_code =
Code::Handle(StubCode::FixAllocationStubTarget_entry()->code());
SetActiveInstructions(new_code.instructions());
SetActiveInstructions(Instructions::Handle(new_code.instructions()));
#else
// DBC does not use allocation stubs.
UNIMPLEMENTED();
@ -14525,18 +14525,18 @@ void Code::DisableStubCode() const {
}
void Code::SetActiveInstructions(RawInstructions* instructions) const {
void Code::SetActiveInstructions(const Instructions& instructions) const {
#if defined(DART_PRECOMPILED_RUNTIME)
UNREACHABLE();
#else
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);
StorePointer(&raw_ptr()->active_instructions_, instructions.raw());
StoreNonPointer(&raw_ptr()->entry_point_,
Instructions::UncheckedEntryPoint(instructions));
Instructions::UncheckedEntryPoint(instructions.raw()));
StoreNonPointer(&raw_ptr()->checked_entry_point_,
Instructions::CheckedEntryPoint(instructions));
Instructions::CheckedEntryPoint(instructions.raw()));
#endif
}

View file

@ -4945,7 +4945,7 @@ class Code : public Object {
if (!IsDisabled()) return;
ASSERT(Thread::Current()->IsMutatorThread());
ASSERT(instructions() != active_instructions());
SetActiveInstructions(instructions());
SetActiveInstructions(Instructions::Handle(instructions()));
}
bool IsDisabled() const {
@ -5001,11 +5001,11 @@ class Code : public Object {
#endif
}
void SetActiveInstructions(RawInstructions* instructions) const;
void SetActiveInstructions(const Instructions& instructions) const;
void set_instructions(RawInstructions* instructions) const {
void set_instructions(const Instructions& instructions) const {
ASSERT(Thread::Current()->IsMutatorThread() || !is_alive());
StorePointer(&raw_ptr()->instructions_, instructions);
StorePointer(&raw_ptr()->instructions_, instructions.raw());
}
void set_pointer_offsets_length(intptr_t value) {

View file

@ -2342,8 +2342,8 @@ void Precompiler::DedupInstructions() {
code_ = function.CurrentCode();
instructions_ = code_.instructions();
instructions_ = DedupOneInstructions(instructions_);
code_.SetActiveInstructions(instructions_.raw());
code_.set_instructions(instructions_.raw());
code_.SetActiveInstructions(instructions_);
code_.set_instructions(instructions_);
function.SetInstructions(code_); // Update cached entry point.
}