IA32: Use the full compiler when debugging
authorsgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 19 May 2010 09:07:33 +0000 (09:07 +0000)
committersgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 19 May 2010 09:07:33 +0000 (09:07 +0000)
The full compiler will now be used for all code compiler when debugging is active. As the code generated by the full compiler is much simpler it will be easier to make debugging work better when using that code.

To ensure that all code debugged is from the full compiler all functions will have to be recompiled when starting debugging. Initialing debugging already turns off the code cache.
Review URL: http://codereview.chromium.org/2120009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4680 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/compiler.cc
src/debug.h
src/flag-definitions.h
test/cctest/test-log-stack-tracer.cc

index 901f218..5f37951 100755 (executable)
@@ -120,7 +120,21 @@ static Handle<Code> MakeCode(Handle<Context> context, CompilationInfo* info) {
       ? info->scope()->is_global_scope()
       : (shared->is_toplevel() || shared->try_full_codegen());
 
-  if (FLAG_always_full_compiler || (FLAG_full_compiler && is_run_once)) {
+  bool force_full_compiler = false;
+#ifdef V8_TARGET_ARCH_IA32
+  // On ia32 the full compiler can compile all code whereas the other platforms
+  // the constructs supported is checked by the associated syntax checker. When
+  // --always-full-compiler is used on ia32 the syntax checker is still in
+  // effect, but there is a special flag --force-full-compiler to ignore the
+  // syntax checker completely and use the full compiler for all code. Also
+  // when debugging on ia32 the full compiler will be used for all code.
+  force_full_compiler =
+      Debugger::IsDebuggerActive() || FLAG_force_full_compiler;
+#endif
+
+  if (force_full_compiler) {
+    return FullCodeGenerator::MakeCode(info);
+  } else if (FLAG_always_full_compiler || (FLAG_full_compiler && is_run_once)) {
     FullCodeGenSyntaxChecker checker;
     checker.Check(function);
     if (checker.has_supported_syntax()) {
index e7ac94e..9b8d389 100644 (file)
@@ -693,8 +693,9 @@ class Debugger {
   static void set_loading_debugger(bool v) { is_loading_debugger_ = v; }
   static bool is_loading_debugger() { return Debugger::is_loading_debugger_; }
 
- private:
   static bool IsDebuggerActive();
+
+ private:
   static void ListenersChanged();
 
   static Mutex* debugger_access_;  // Mutex guarding debugger variables.
index c086df4..fc3f40c 100644 (file)
@@ -149,6 +149,10 @@ DEFINE_bool(full_compiler, true, "enable dedicated backend for run-once code")
 DEFINE_bool(fast_compiler, false, "enable speculative optimizing backend")
 DEFINE_bool(always_full_compiler, false,
             "try to use the dedicated run-once backend for all code")
+#ifdef V8_TARGET_ARCH_IA32
+DEFINE_bool(force_full_compiler, false,
+            "force use of the dedicated run-once backend for all code")
+#endif
 DEFINE_bool(always_fast_compiler, false,
             "try to use the speculative optimizing backend for all code")
 DEFINE_bool(trace_bailout, false,
index 3ce19d7..261222e 100644 (file)
@@ -273,6 +273,13 @@ static void CreateTraceCallerFunction(const char* func_name,
 // StackTracer uses Top::c_entry_fp as a starting point for stack
 // walking.
 TEST(CFromJSStackTrace) {
+#ifdef V8_HOST_ARCH_IA32
+  // TODO(711) The hack of replacing the inline runtime function
+  // RandomHeapNumber with GetFrameNumber does not work with the way the full
+  // compiler generates inline runtime calls.
+  i::FLAG_force_full_compiler = false;
+#endif
+
   TickSample sample;
   InitTraceEnv(&sample);
 
@@ -308,6 +315,13 @@ TEST(CFromJSStackTrace) {
 // Top::c_entry_fp value. In this case, StackTracer uses passed frame
 // pointer value as a starting point for stack walking.
 TEST(PureJSStackTrace) {
+#ifdef V8_HOST_ARCH_IA32
+  // TODO(711) The hack of replacing the inline runtime function
+  // RandomHeapNumber with GetFrameNumber does not work with the way the full
+  // compiler generates inline runtime calls.
+  i::FLAG_force_full_compiler = false;
+#endif
+
   TickSample sample;
   InitTraceEnv(&sample);