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