Debugger: always include deoptimization support for debug code.
authoryangguo <yangguo@chromium.org>
Fri, 24 Jul 2015 13:43:38 +0000 (06:43 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 24 Jul 2015 13:43:46 +0000 (13:43 +0000)
R=mstarzinger@chromium.org
BUG=chromium:513496
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#29846}

src/compiler.cc
src/compiler.h
src/full-codegen/full-codegen.cc
src/objects-inl.h
src/objects.h

index 9ed4943..861a34a 100644 (file)
@@ -969,13 +969,6 @@ bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
 MaybeHandle<Code> CompileForDebugging(CompilationInfo* info) {
   info->MarkAsDebug();
   VMState<COMPILER> state(info->isolate());
-  if (info->shared_info()->is_compiled()) {
-    if (info->shared_info()->code()->is_compiled_optimizable()) {
-      info->EnableDeoptimizationSupport();
-    } else {
-      info->MarkNonOptimizable();
-    }
-  }
   MaybeHandle<Code> maybe_new_code = GetUnoptimizedCodeCommon(info);
   Handle<Code> new_code;
   if (!maybe_new_code.ToHandle(&new_code)) {
index e50b42d..7bedcad 100644 (file)
@@ -208,7 +208,11 @@ class CompilationInfo {
 
   // Compiles marked as debug produce unoptimized code with debug break slots.
   // Inner functions that cannot be compiled w/o context are compiled eagerly.
-  void MarkAsDebug() { SetFlag(kDebug); }
+  // Always include deoptimization support to avoid having to recompile again.
+  void MarkAsDebug() {
+    SetFlag(kDebug);
+    SetFlag(kDeoptimizationSupport);
+  }
 
   bool is_debug() const { return GetFlag(kDebug); }
 
@@ -271,10 +275,6 @@ class CompilationInfo {
   }
   void SetCode(Handle<Code> code) { code_ = code; }
 
-  void MarkNonOptimizable() {
-    SetMode(CompilationInfo::NONOPT);
-  }
-
   bool ShouldTrapOnDeopt() const {
     return (FLAG_trap_on_deopt && IsOptimizing()) ||
         (FLAG_trap_on_stub_deopt && IsStub());
@@ -425,12 +425,9 @@ class CompilationInfo {
   // Compilation mode.
   // BASE is generated by the full codegen, optionally prepared for bailouts.
   // OPTIMIZE is optimized code generated by the Hydrogen-based backend.
-  // NONOPT is generated by the full codegen and is not prepared for
-  //   recompilation/bailouts.  These functions are never recompiled.
   enum Mode {
     BASE,
     OPTIMIZE,
-    NONOPT,
     STUB
   };
 
index 4b32e96..c1512ac 100644 (file)
@@ -59,7 +59,6 @@ bool FullCodeGenerator::MakeCode(CompilationInfo* info) {
   cgen.PopulateHandlerTable(code);
   code->set_has_deoptimization_support(info->HasDeoptimizationSupport());
   code->set_has_reloc_info_for_serialization(info->will_serialize());
-  code->set_compiled_optimizable(info->IsOptimizable());
   code->set_allow_osr_at_loop_nesting_level(0);
   code->set_profiler_ticks(0);
   code->set_back_edge_table_offset(table_offset);
index 2bd8b53..0555440 100644 (file)
@@ -4567,21 +4567,6 @@ void Code::set_has_debug_break_slots(bool value) {
 }
 
 
-bool Code::is_compiled_optimizable() {
-  DCHECK_EQ(FUNCTION, kind());
-  unsigned flags = READ_UINT32_FIELD(this, kFullCodeFlags);
-  return FullCodeFlagsIsCompiledOptimizable::decode(flags);
-}
-
-
-void Code::set_compiled_optimizable(bool value) {
-  DCHECK_EQ(FUNCTION, kind());
-  unsigned flags = READ_UINT32_FIELD(this, kFullCodeFlags);
-  flags = FullCodeFlagsIsCompiledOptimizable::update(flags, value);
-  WRITE_UINT32_FIELD(this, kFullCodeFlags, flags);
-}
-
-
 bool Code::has_reloc_info_for_serialization() {
   DCHECK_EQ(FUNCTION, kind());
   unsigned flags = READ_UINT32_FIELD(this, kFullCodeFlags);
index caf1096..f0180a1 100644 (file)
@@ -5060,11 +5060,6 @@ class Code: public HeapObject {
   inline bool has_debug_break_slots();
   inline void set_has_debug_break_slots(bool value);
 
-  // [compiled_with_optimizing]: For FUNCTION kind, tells if it has
-  // been compiled with IsOptimizing set to true.
-  inline bool is_compiled_optimizable();
-  inline void set_compiled_optimizable(bool value);
-
   // [has_reloc_info_for_serialization]: For FUNCTION kind, tells if its
   // reloc info includes runtime and external references to support
   // serialization/deserialization.
@@ -5359,9 +5354,9 @@ class Code: public HeapObject {
   class FullCodeFlagsHasDeoptimizationSupportField:
       public BitField<bool, 0, 1> {};  // NOLINT
   class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {};
-  class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {};
   class FullCodeFlagsHasRelocInfoForSerialization
-      : public BitField<bool, 3, 1> {};
+      : public BitField<bool, 2, 1> {};
+  // Bit 3 in this bitfield is unused.
   class ProfilerTicksField : public BitField<int, 4, 28> {};
 
   // Flags layout.  BitField<type, shift, size>.