Revision: 21206
Author:   [email protected]
Date:     Fri May  9 08:42:17 2014 UTC
Log:      Use ReplaceCode instead of set_code in debug.cc.

[email protected]

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

Modified:
 /branches/bleeding_edge/src/debug.cc

=======================================
--- /branches/bleeding_edge/src/debug.cc        Thu May  8 18:00:26 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc        Fri May  9 08:42:17 2014 UTC
@@ -2050,12 +2050,11 @@
     ForceDebuggerActive force_debugger_active(isolate_);
     MaybeHandle<Code> code = Compiler::GetCodeForDebugging(function);
     // Recompilation can fail.  In that case leave the code as it was.
-    if (!code.is_null())
-      function->ReplaceCode(*code.ToHandleChecked());
+    if (!code.is_null()) function->ReplaceCode(*code.ToHandleChecked());
+  } else {
+    // Simply use shared code if it has debug break slots.
+    function->ReplaceCode(function->shared()->code());
   }
-
-  // Keep function code in sync with shared function info.
-  function->ReplaceCode(function->shared()->code());
 }


@@ -2152,8 +2151,8 @@
           Code::Kind kind = function->code()->kind();
           if (kind == Code::FUNCTION &&
               !function->code()->has_debug_break_slots()) {
-            function->set_code(*lazy_compile);
-            function->shared()->set_code(*lazy_compile);
+            function->ReplaceCode(*lazy_compile);
+            function->shared()->ReplaceCode(*lazy_compile);
           } else if (kind == Code::BUILTIN &&
               (function->IsInOptimizationQueue() ||
                function->IsMarkedForOptimization() ||
@@ -2162,10 +2161,10 @@
             Code* shared_code = function->shared()->code();
             if (shared_code->kind() == Code::FUNCTION &&
                 shared_code->has_debug_break_slots()) {
-              function->set_code(shared_code);
+              function->ReplaceCode(shared_code);
             } else {
-              function->set_code(*lazy_compile);
-              function->shared()->set_code(*lazy_compile);
+              function->ReplaceCode(*lazy_compile);
+              function->shared()->ReplaceCode(*lazy_compile);
             }
           }
         } else if (obj->IsJSGeneratorObject()) {
@@ -2206,8 +2205,8 @@
       Handle<JSFunction> &function = generator_functions[i];
       if (function->code()->kind() != Code::FUNCTION) continue;
       if (function->code()->has_debug_break_slots()) continue;
-      function->set_code(*lazy_compile);
-      function->shared()->set_code(*lazy_compile);
+      function->ReplaceCode(*lazy_compile);
+      function->shared()->ReplaceCode(*lazy_compile);
     }

     // Now recompile all functions with activation frames and and

--
--
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/d/optout.

Reply via email to