Ensure that Code objects' kind specific flags are initialized properly.

Also, have the stub cache set a valid MajorKey on stubs it creates.
Getting weird random bits frightens and confuses the poor simple type feedback oracle.

R=hpayer@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18309 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 213b05b5
......@@ -197,6 +197,7 @@ const char* CodeStub::MajorName(CodeStub::Major major_key,
#define DEF_CASE(name) case name: return #name "Stub";
CODE_STUB_LIST(DEF_CASE)
#undef DEF_CASE
case UninitializedMajorKey: return "<UninitializedMajorKey>Stub";
default:
if (!allow_unknown_keys) {
UNREACHABLE();
......
......@@ -130,6 +130,7 @@ namespace internal {
class CodeStub BASE_EMBEDDED {
public:
enum Major {
UninitializedMajorKey = 0,
#define DEF_ENUM(name) name,
CODE_STUB_LIST(DEF_ENUM)
#undef DEF_ENUM
......
......@@ -4228,6 +4228,8 @@ MaybeObject* Heap::CreateCode(const CodeDesc& desc,
code->set_instruction_size(desc.instr_size);
code->set_relocation_info(reloc_info);
code->set_flags(flags);
code->set_raw_kind_specific_flags1(0);
code->set_raw_kind_specific_flags2(0);
if (code->is_call_stub() || code->is_keyed_call_stub()) {
code->set_check_type(RECEIVER_MAP_CHECK);
}
......
......@@ -3915,6 +3915,17 @@ int Code::arguments_count() {
}
// For initialization.
void Code::set_raw_kind_specific_flags1(int value) {
WRITE_INT_FIELD(this, kKindSpecificFlags1Offset, value);
}
void Code::set_raw_kind_specific_flags2(int value) {
WRITE_INT_FIELD(this, kKindSpecificFlags2Offset, value);
}
inline bool Code::is_crankshafted() {
return IsCrankshaftedField::decode(
READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
......
......@@ -5150,6 +5150,9 @@ class Code: public HeapObject {
inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; }
inline bool is_keyed_stub();
inline void set_raw_kind_specific_flags1(int value);
inline void set_raw_kind_specific_flags2(int value);
// [major_key]: For kind STUB or BINARY_OP_IC, the major key.
inline int major_key();
inline void set_major_key(int value);
......
......@@ -1100,6 +1100,9 @@ Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags,
CodeDesc desc;
masm_.GetCode(&desc);
Handle<Code> code = factory()->NewCode(desc, flags, masm_.CodeObject());
if (code->has_major_key()) {
code->set_major_key(CodeStub::NoCache);
}
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_code_stubs) code->Disassemble(name);
#endif
......
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