Reviewers: Hannes Payer,
Message:
PTAL.
Description:
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.
Please review this at https://codereview.chromium.org/108443004/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+19, -0 lines):
M src/code-stubs.h
M src/code-stubs.cc
M src/heap.cc
M src/objects-inl.h
M src/objects.h
M src/stub-cache.cc
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index
c66001a1a226fd0174d32257b811194c01cb8c25..275beb4a9f1b1032652d60c4245b8ee5bce7b95c
100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -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();
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index
55ebe219fdf8c80ba91c52cced2e0aab4a1b09b4..bedf295d2f9481913d041b9094951d7f4052b165
100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -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
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
b9e1a2b323a36664d1e53e84e7c7e899f2f9817e..6921bb653f8a97c905fcc0800736c5044e6e38d4
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -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);
}
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
b41a8d350503f38a588e18bbdaa92404099c3023..8ca8299fd3ab854b6c14cbe2431129f1ab98e6ce
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -3915,6 +3915,15 @@ 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));
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
41c3f034179f557003998a63d848b9a01100700b..5a2d5595fc9cf2fd12bf166494b22a0136db66d0
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -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);
Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index
a562ace477a66ae99fc8d5cd638ebbad8817791e..6e68314be7ebd9299ceda913e2d95737e3641c40
100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -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
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.