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)) {
// 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); }
}
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());
// 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
};
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);
}
-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);
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.
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>.