Commit c8febe20 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[turbofan] Remove obsolete Code::is_crankshafted bit.

The predicate in question used to report true on both, Crankshaft and
TurboFan code. It has hence become obsolete and can be replaced by the
existing {Code::is_turbofanned} predicate. This also frees up a bit in
the second kind-specific bit field.

R=jarin@chromium.org
BUG=v8:6408

Change-Id: I204d7dd78a639c752c9749fd305c7006c6b6aca3
Reviewed-on: https://chromium-review.googlesource.com/599868Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47125}
parent 7eb91175
......@@ -128,15 +128,15 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(TurboAssembler* tasm,
// Allocate and install the code.
CodeDesc desc;
Code::Flags flags = info->code_flags();
bool is_crankshafted =
bool is_turbofanned =
Code::ExtractKindFromFlags(flags) == Code::OPTIMIZED_FUNCTION ||
info->IsStub();
tasm->GetCode(isolate, &desc);
if (eh_frame_writer) eh_frame_writer->GetEhFrame(&desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, flags, self_reference, false, is_crankshafted,
info->prologue_offset(), info->is_debug() && !is_crankshafted);
desc, flags, self_reference, false, info->prologue_offset(),
info->is_debug() && !is_turbofanned);
isolate->counters()->total_compiled_code_size()->Increment(
code->instruction_size());
return code;
......
......@@ -702,8 +702,7 @@ void Deoptimizer::DoComputeOutputFrames() {
"]\n",
input_data->OptimizationId()->value(), bailout_id_, fp_to_sp_delta_,
caller_frame_top_);
if (bailout_type_ == EAGER || bailout_type_ == SOFT ||
(compiled_code_->is_hydrogen_stub())) {
if (bailout_type_ == EAGER || bailout_type_ == SOFT) {
compiled_code_->PrintDeoptLocation(trace_scope_->file(), from_);
}
}
......
......@@ -1734,7 +1734,6 @@ Handle<Code> Factory::NewCode(const CodeDesc& desc,
Code::Flags flags,
Handle<Object> self_ref,
bool immovable,
bool crankshafted,
int prologue_offset,
bool is_debug) {
Handle<ByteArray> reloc_info = NewByteArray(desc.reloc_size, TENURED);
......@@ -1767,7 +1766,6 @@ Handle<Code> Factory::NewCode(const CodeDesc& desc,
code->set_has_unwinding_info(has_unwinding_info);
code->set_raw_kind_specific_flags1(0);
code->set_raw_kind_specific_flags2(0);
code->set_is_crankshafted(crankshafted);
code->set_has_tagged_params(true);
code->set_deoptimization_data(*empty_fixed_array(), SKIP_WRITE_BARRIER);
code->set_raw_type_feedback_info(Smi::kZero);
......
......@@ -692,7 +692,6 @@ class V8_EXPORT_PRIVATE Factory final {
Code::Flags flags,
Handle<Object> self_reference,
bool immovable = false,
bool crankshafted = false,
int prologue_offset = Code::kPrologueOffsetNotSet,
bool is_debug = false);
......
......@@ -3698,15 +3698,6 @@ void Code::set_raw_kind_specific_flags2(int value) {
WRITE_INT_FIELD(this, kKindSpecificFlags2Offset, value);
}
inline bool Code::is_crankshafted() const {
return IsCrankshaftedField::decode(
READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
}
inline bool Code::is_hydrogen_stub() const {
return is_crankshafted() && kind() != OPTIMIZED_FUNCTION;
}
inline bool Code::is_interpreter_trampoline_builtin() const {
Builtins* builtins = GetIsolate()->builtins();
return this == builtins->builtin(Builtins::kInterpreterEntryTrampoline) ||
......@@ -3732,12 +3723,6 @@ inline void Code::set_has_unwinding_info(bool state) {
WRITE_UINT32_FIELD(this, kFlagsOffset, updated_value);
}
inline void Code::set_is_crankshafted(bool value) {
int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
int updated = IsCrankshaftedField::update(previous, value);
WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated);
}
inline bool Code::has_tagged_params() const {
int flags = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
return HasTaggedStackField::decode(flags);
......@@ -3872,7 +3857,7 @@ void Code::set_builtin_index(int index) {
}
unsigned Code::stack_slots() const {
DCHECK(is_crankshafted());
DCHECK(is_turbofanned());
return StackSlotsField::decode(
READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
}
......@@ -3880,14 +3865,14 @@ unsigned Code::stack_slots() const {
void Code::set_stack_slots(unsigned slots) {
CHECK(slots <= (1 << kStackSlotsBitCount));
DCHECK(is_crankshafted());
DCHECK(is_turbofanned());
int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
int updated = StackSlotsField::update(previous, slots);
WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
}
unsigned Code::safepoint_table_offset() const {
DCHECK(is_crankshafted());
DCHECK(is_turbofanned());
return SafepointTableOffsetField::decode(
READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
}
......@@ -3895,7 +3880,7 @@ unsigned Code::safepoint_table_offset() const {
void Code::set_safepoint_table_offset(unsigned offset) {
CHECK(offset <= (1 << kSafepointTableOffsetBitCount));
DCHECK(is_crankshafted());
DCHECK(is_turbofanned());
DCHECK(IsAligned(offset, static_cast<unsigned>(kIntSize)));
int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
int updated = SafepointTableOffsetField::update(previous, offset);
......
......@@ -14706,19 +14706,18 @@ void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT
if (kind() == OPTIMIZED_FUNCTION) {
os << "stack_slots = " << stack_slots() << "\n";
}
os << "compiler = " << (is_turbofanned()
? "turbofan"
: is_crankshafted() ? "crankshaft"
: kind() == Code::FUNCTION
? "full-codegen"
: "unknown") << "\n";
os << "compiler = "
<< (is_turbofanned()
? "turbofan"
: kind() == Code::FUNCTION ? "full-codegen" : "unknown")
<< "\n";
os << "Instructions (size = " << instruction_size() << ")\n";
{
Isolate* isolate = GetIsolate();
int size = instruction_size();
int safepoint_offset =
is_crankshafted() ? static_cast<int>(safepoint_table_offset()) : size;
is_turbofanned() ? static_cast<int>(safepoint_table_offset()) : size;
int back_edge_offset = (kind() == Code::FUNCTION)
? static_cast<int>(back_edge_table_offset())
: size;
......@@ -14765,7 +14764,7 @@ void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT
}
os << "\n";
if (is_crankshafted()) {
if (is_turbofanned()) {
SafepointTable table(this);
os << "Safepoints (size = " << table.size() << ")\n";
for (unsigned i = 0; i < table.length(); i++) {
......
......@@ -3782,13 +3782,6 @@ class Code: public HeapObject {
// feedback vector.
inline bool checks_optimization_marker() const;
// [is_crankshafted]: For kind STUB or ICs, tells whether or not a code
// object was generated by either the hydrogen or the TurboFan optimizing
// compiler (but it may not be an optimized function).
inline bool is_crankshafted() const;
inline bool is_hydrogen_stub() const; // Crankshafted, but not a function.
inline void set_is_crankshafted(bool value);
// [has_tagged_params]: For compiled code or builtins: Tells whether the
// outgoing parameters of this code are tagged pointers. True for other kinds.
inline bool has_tagged_params() const;
......@@ -4171,9 +4164,7 @@ class Code: public HeapObject {
}; // NOLINT
// KindSpecificFlags2 layout (ALL)
static const int kIsCrankshaftedBit = 0;
class IsCrankshaftedField : public BitField<bool, kIsCrankshaftedBit, 1> {};
static const int kHasTaggedStackBit = kIsCrankshaftedBit + 1;
static const int kHasTaggedStackBit = 0;
class HasTaggedStackField : public BitField<bool, kHasTaggedStackBit, 1> {};
// KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION)
......@@ -4189,10 +4180,10 @@ class Code: public HeapObject {
kSafepointTableOffsetBitCount> {}; // NOLINT
// KindSpecificFlags2 layout (FUNCTION)
class BackEdgeTableOffsetField: public BitField<int,
kIsCrankshaftedBit + 1, 27> {}; // NOLINT
class AllowOSRAtLoopNestingLevelField: public BitField<int,
kIsCrankshaftedBit + 1 + 27, 4> {}; // NOLINT
class BackEdgeTableOffsetField
: public BitField<int, kHasTaggedStackBit + 1, 27> {}; // NOLINT
class AllowOSRAtLoopNestingLevelField
: public BitField<int, kHasTaggedStackBit + 1 + 27, 4> {}; // NOLINT
static const int kArgumentsBits = 16;
static const int kMaxArguments = (1 << kArgumentsBits) - 1;
......
......@@ -218,11 +218,10 @@ void PerfJitLogger::LogRecordedBuffer(AbstractCode* abstract_code,
const char* code_name = name;
uint8_t* code_pointer = reinterpret_cast<uint8_t*>(code->instruction_start());
// Code generated by Crankshaft or Turbofan will have the safepoint table
// directly after instructions. There is no need to record the safepoint table
// itself.
uint32_t code_size = code->is_crankshafted() ? code->safepoint_table_offset()
: code->instruction_size();
// Code generated by Turbofan will have the safepoint table directly after
// instructions. There is no need to record the safepoint table itself.
uint32_t code_size = code->is_turbofanned() ? code->safepoint_table_offset()
: code->instruction_size();
// Unwinding info comes right after debug info.
if (FLAG_perf_prof_unwinding_info) LogWriteUnwindingInfo(code);
......@@ -271,7 +270,7 @@ std::unique_ptr<char[]> GetScriptName(Handle<Script> script) {
SourcePositionInfo GetSourcePositionInfo(Handle<Code> code,
Handle<SharedFunctionInfo> function,
SourcePosition pos) {
if (code->is_turbofanned() || code->is_crankshafted()) {
if (code->is_turbofanned()) {
DisallowHeapAllocation disallow;
return pos.InliningStack(code)[0];
} else {
......
......@@ -36,7 +36,7 @@ bool SafepointEntry::HasRegisterAt(int reg_index) const {
SafepointTable::SafepointTable(Code* code) {
DCHECK(code->is_crankshafted());
DCHECK(code->is_turbofanned());
code_ = code;
Address header = code->instruction_start() + code->safepoint_table_offset();
length_ = Memory::uint32_at(header + kLengthOffset);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment