Revision: 18309
Author:   [email protected]
Date:     Fri Dec 13 10:27:19 2013 UTC
Log: 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.

[email protected]

Review URL: https://codereview.chromium.org/108443004
http://code.google.com/p/v8/source/detail?r=18309

Modified:
 /branches/bleeding_edge/src/code-stubs.cc
 /branches/bleeding_edge/src/code-stubs.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/stub-cache.cc

=======================================
--- /branches/bleeding_edge/src/code-stubs.cc   Mon Dec  9 07:41:20 2013 UTC
+++ /branches/bleeding_edge/src/code-stubs.cc   Fri Dec 13 10:27:19 2013 UTC
@@ -197,6 +197,7 @@
 #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();
=======================================
--- /branches/bleeding_edge/src/code-stubs.h    Tue Dec 10 09:44:44 2013 UTC
+++ /branches/bleeding_edge/src/code-stubs.h    Fri Dec 13 10:27:19 2013 UTC
@@ -130,6 +130,7 @@
 class CodeStub BASE_EMBEDDED {
  public:
   enum Major {
+    UninitializedMajorKey = 0,
 #define DEF_ENUM(name) name,
     CODE_STUB_LIST(DEF_ENUM)
 #undef DEF_ENUM
=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Dec 10 12:11:45 2013 UTC
+++ /branches/bleeding_edge/src/heap.cc Fri Dec 13 10:27:19 2013 UTC
@@ -4228,6 +4228,8 @@
   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);
   }
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Wed Dec 11 13:51:48 2013 UTC
+++ /branches/bleeding_edge/src/objects-inl.h   Fri Dec 13 10:27:19 2013 UTC
@@ -3913,6 +3913,17 @@
          kind() == STUB || is_handler());
   return ExtractArgumentsCountFromFlags(flags());
 }
+
+
+// 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() {
=======================================
--- /branches/bleeding_edge/src/objects.h       Thu Dec 12 14:57:00 2013 UTC
+++ /branches/bleeding_edge/src/objects.h       Fri Dec 13 10:27:19 2013 UTC
@@ -5150,6 +5150,9 @@
   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);
=======================================
--- /branches/bleeding_edge/src/stub-cache.cc   Mon Dec  9 07:41:20 2013 UTC
+++ /branches/bleeding_edge/src/stub-cache.cc   Fri Dec 13 10:27:19 2013 UTC
@@ -1100,6 +1100,9 @@
   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.

Reply via email to