Commit 184de6af authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[objects] Remove some obsolete {Code} setter methods.

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

Change-Id: Id97c7a9911eb2c0606f8ea25d0a2c8ebcb4c8ccd
Reviewed-on: https://chromium-review.googlesource.com/753729Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49517}
parent b636408f
...@@ -1798,10 +1798,7 @@ Handle<Code> Factory::NewCode( ...@@ -1798,10 +1798,7 @@ Handle<Code> Factory::NewCode(
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
code->set_instruction_size(desc.instr_size); code->set_instruction_size(desc.instr_size);
code->set_relocation_info(*reloc_info); code->set_relocation_info(*reloc_info);
code->initialize_flags(kind); code->initialize_flags(kind, has_unwinding_info, is_turbofanned, stack_slots);
code->set_has_unwinding_info(has_unwinding_info);
code->set_is_turbofanned(is_turbofanned);
code->set_stack_slots(stack_slots);
code->set_safepoint_table_offset(safepoint_table_offset); code->set_safepoint_table_offset(safepoint_table_offset);
code->set_code_data_container(*data_container); code->set_code_data_container(*data_container);
code->set_has_tagged_params(true); code->set_has_tagged_params(true);
......
...@@ -288,15 +288,16 @@ Code::Kind Code::kind() const { ...@@ -288,15 +288,16 @@ Code::Kind Code::kind() const {
return KindField::decode(READ_UINT32_FIELD(this, kFlagsOffset)); return KindField::decode(READ_UINT32_FIELD(this, kFlagsOffset));
} }
void Code::initialize_flags(Kind kind) { void Code::initialize_flags(Kind kind, bool has_unwinding_info,
WRITE_UINT32_FIELD(this, kFlagsOffset, KindField::encode(kind)); bool is_turbofanned, int stack_slots) {
} CHECK_LE(stack_slots, StackSlotsField::kMax);
DCHECK_IMPLIES(stack_slots != 0, is_turbofanned);
void Code::set_kind(Kind kind) { static_assert(Code::NUMBER_OF_KINDS <= KindField::kMax + 1, "field overflow");
STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); uint32_t flags = HasUnwindingInfoField::encode(has_unwinding_info) |
uint32_t previous = READ_UINT32_FIELD(this, kFlagsOffset); KindField::encode(kind) |
uint32_t updated_value = KindField::update(previous, kind); IsTurbofannedField::encode(is_turbofanned) |
WRITE_UINT32_FIELD(this, kFlagsOffset, updated_value); StackSlotsField::encode(stack_slots);
WRITE_UINT32_FIELD(this, kFlagsOffset, flags);
} }
inline bool Code::is_interpreter_trampoline_builtin() const { inline bool Code::is_interpreter_trampoline_builtin() const {
...@@ -324,12 +325,6 @@ inline bool Code::has_unwinding_info() const { ...@@ -324,12 +325,6 @@ inline bool Code::has_unwinding_info() const {
return HasUnwindingInfoField::decode(READ_UINT32_FIELD(this, kFlagsOffset)); return HasUnwindingInfoField::decode(READ_UINT32_FIELD(this, kFlagsOffset));
} }
inline void Code::set_has_unwinding_info(bool state) {
uint32_t previous = READ_UINT32_FIELD(this, kFlagsOffset);
uint32_t updated_value = HasUnwindingInfoField::update(previous, state);
WRITE_UINT32_FIELD(this, kFlagsOffset, updated_value);
}
inline bool Code::has_tagged_params() const { inline bool Code::has_tagged_params() const {
int flags = READ_UINT32_FIELD(this, kFlagsOffset); int flags = READ_UINT32_FIELD(this, kFlagsOffset);
return HasTaggedStackField::decode(flags); return HasTaggedStackField::decode(flags);
...@@ -345,12 +340,6 @@ inline bool Code::is_turbofanned() const { ...@@ -345,12 +340,6 @@ inline bool Code::is_turbofanned() const {
return IsTurbofannedField::decode(READ_UINT32_FIELD(this, kFlagsOffset)); return IsTurbofannedField::decode(READ_UINT32_FIELD(this, kFlagsOffset));
} }
inline void Code::set_is_turbofanned(bool value) {
int previous = READ_UINT32_FIELD(this, kFlagsOffset);
int updated = IsTurbofannedField::update(previous, value);
WRITE_UINT32_FIELD(this, kFlagsOffset, updated);
}
inline bool Code::can_have_weak_objects() const { inline bool Code::can_have_weak_objects() const {
DCHECK(kind() == OPTIMIZED_FUNCTION); DCHECK(kind() == OPTIMIZED_FUNCTION);
int flags = code_data_container()->kind_specific_flags(); int flags = code_data_container()->kind_specific_flags();
...@@ -427,14 +416,6 @@ unsigned Code::stack_slots() const { ...@@ -427,14 +416,6 @@ unsigned Code::stack_slots() const {
return StackSlotsField::decode(READ_UINT32_FIELD(this, kFlagsOffset)); return StackSlotsField::decode(READ_UINT32_FIELD(this, kFlagsOffset));
} }
void Code::set_stack_slots(unsigned slots) {
CHECK(slots <= StackSlotsField::kMax);
DCHECK(is_turbofanned() || slots == 0); // Allow zero initialization.
int previous = READ_UINT32_FIELD(this, kFlagsOffset);
int updated = StackSlotsField::update(previous, slots);
WRITE_UINT32_FIELD(this, kFlagsOffset, updated);
}
unsigned Code::safepoint_table_offset() const { unsigned Code::safepoint_table_offset() const {
DCHECK(is_turbofanned()); DCHECK(is_turbofanned());
return READ_UINT32_FIELD(this, kSafepointTableOffsetOffset); return READ_UINT32_FIELD(this, kSafepointTableOffsetOffset);
......
...@@ -191,7 +191,6 @@ class Code : public HeapObject { ...@@ -191,7 +191,6 @@ class Code : public HeapObject {
// [kind]: Access to specific code kind. // [kind]: Access to specific code kind.
inline Kind kind() const; inline Kind kind() const;
inline void set_kind(Kind kind);
inline bool is_stub() const; inline bool is_stub() const;
inline bool is_optimized_code() const; inline bool is_optimized_code() const;
...@@ -212,7 +211,6 @@ class Code : public HeapObject { ...@@ -212,7 +211,6 @@ class Code : public HeapObject {
// [is_turbofanned]: For kind STUB or OPTIMIZED_FUNCTION, tells whether the // [is_turbofanned]: For kind STUB or OPTIMIZED_FUNCTION, tells whether the
// code object was generated by the TurboFan optimizing compiler. // code object was generated by the TurboFan optimizing compiler.
inline bool is_turbofanned() const; inline bool is_turbofanned() const;
inline void set_is_turbofanned(bool value);
// [can_have_weak_objects]: For kind OPTIMIZED_FUNCTION, tells whether the // [can_have_weak_objects]: For kind OPTIMIZED_FUNCTION, tells whether the
// embedded objects in code should be treated weakly. // embedded objects in code should be treated weakly.
...@@ -235,7 +233,6 @@ class Code : public HeapObject { ...@@ -235,7 +233,6 @@ class Code : public HeapObject {
// [stack_slots]: For kind OPTIMIZED_FUNCTION, the number of stack slots // [stack_slots]: For kind OPTIMIZED_FUNCTION, the number of stack slots
// reserved in the code prologue. // reserved in the code prologue.
inline unsigned stack_slots() const; inline unsigned stack_slots() const;
inline void set_stack_slots(unsigned slots);
// [safepoint_table_start]: For kind OPTIMIZED_FUNCTION, the offset in // [safepoint_table_start]: For kind OPTIMIZED_FUNCTION, the offset in
// the instruction stream where the safepoint table starts. // the instruction stream where the safepoint table starts.
...@@ -284,7 +281,8 @@ class Code : public HeapObject { ...@@ -284,7 +281,8 @@ class Code : public HeapObject {
inline void clear_padding(); inline void clear_padding();
// Initialize the flags field. Similar to clear_padding above this ensure that // Initialize the flags field. Similar to clear_padding above this ensure that
// the snapshot content is deterministic. // the snapshot content is deterministic.
inline void initialize_flags(Kind kind); inline void initialize_flags(Kind kind, bool has_unwinding_info,
bool is_turbofanned, int stack_slots);
// Convert a target address into a code object. // Convert a target address into a code object.
static inline Code* GetCodeFromTargetAddress(Address address); static inline Code* GetCodeFromTargetAddress(Address address);
...@@ -343,7 +341,7 @@ class Code : public HeapObject { ...@@ -343,7 +341,7 @@ class Code : public HeapObject {
// and unwinding_info_end() points to the first memory location after the end // and unwinding_info_end() points to the first memory location after the end
// of the code object. // of the code object.
// //
DECL_BOOLEAN_ACCESSORS(has_unwinding_info) inline bool has_unwinding_info() const;
// [unwinding_info_size]: Size of the unwinding information. // [unwinding_info_size]: Size of the unwinding information.
inline int unwinding_info_size() const; inline int unwinding_info_size() const;
......
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