Introduce raw accessors for type_feedback_info.

This pure refactoring is needed for another upcoming CL.

Note that the actual names are still a bit confusing, because this is
still a kind of swiss-army-knife-field. :-/

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/52633003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17472 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5fce5dc1
......@@ -4194,7 +4194,7 @@ MaybeObject* Heap::CreateCode(const CodeDesc& desc,
}
code->set_is_crankshafted(crankshafted);
code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER);
code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value());
code->set_raw_type_feedback_info(undefined_value());
code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER);
code->set_gc_metadata(Smi::FromInt(0));
code->set_ic_age(global_ic_age_);
......
......@@ -5320,23 +5320,18 @@ INT_ACCESSORS(Code, prologue_offset, kPrologueOffset)
ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset)
ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset)
ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset)
// Type feedback slot: type_feedback_info for FUNCTIONs, stub_info for STUBs.
void Code::InitializeTypeFeedbackInfoNoWriteBarrier(Object* value) {
WRITE_FIELD(this, kTypeFeedbackInfoOffset, value);
}
ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset)
Object* Code::type_feedback_info() {
ASSERT(kind() == FUNCTION);
return Object::cast(READ_FIELD(this, kTypeFeedbackInfoOffset));
return raw_type_feedback_info();
}
void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) {
ASSERT(kind() == FUNCTION);
WRITE_FIELD(this, kTypeFeedbackInfoOffset, value);
set_raw_type_feedback_info(value, mode);
CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset,
value, mode);
}
......@@ -5344,13 +5339,13 @@ void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) {
Object* Code::next_code_link() {
CHECK(kind() == OPTIMIZED_FUNCTION);
return Object::cast(READ_FIELD(this, kTypeFeedbackInfoOffset));
return raw_type_feedback_info();
}
void Code::set_next_code_link(Object* value, WriteBarrierMode mode) {
CHECK(kind() == OPTIMIZED_FUNCTION);
WRITE_FIELD(this, kTypeFeedbackInfoOffset, value);
set_raw_type_feedback_info(value);
CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset,
value, mode);
}
......@@ -5359,8 +5354,7 @@ void Code::set_next_code_link(Object* value, WriteBarrierMode mode) {
int Code::stub_info() {
ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC ||
kind() == BINARY_OP_IC || kind() == LOAD_IC);
Object* value = READ_FIELD(this, kTypeFeedbackInfoOffset);
return Smi::cast(value)->value();
return Smi::cast(raw_type_feedback_info())->value();
}
......@@ -5373,7 +5367,7 @@ void Code::set_stub_info(int value) {
kind() == KEYED_LOAD_IC ||
kind() == STORE_IC ||
kind() == KEYED_STORE_IC);
WRITE_FIELD(this, kTypeFeedbackInfoOffset, Smi::FromInt(value));
set_raw_type_feedback_info(Smi::FromInt(value));
}
......
......@@ -5015,13 +5015,15 @@ class Code: public HeapObject {
// [deoptimization_data]: Array containing data for deopt.
DECL_ACCESSORS(deoptimization_data, FixedArray)
// [type_feedback_info]: This field stores various things, depending on the
// kind of the code object.
// [raw_type_feedback_info]: This field stores various things, depending on
// the kind of the code object.
// FUNCTION => type feedback information.
// STUB => various things, e.g. a SMI
// OPTIMIZED_FUNCTION => the next_code_link for optimized code list.
DECL_ACCESSORS(type_feedback_info, Object)
inline void InitializeTypeFeedbackInfoNoWriteBarrier(Object* value);
DECL_ACCESSORS(raw_type_feedback_info, Object)
inline Object* type_feedback_info();
inline void set_type_feedback_info(
Object* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
inline int stub_info();
inline void set_stub_info(int info);
......
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