Revision: 11455
Author:   [email protected]
Date:     Thu Apr 26 06:44:18 2012
Log:      Remove more assumptions from debug tests.  Even though a function
is optimized, does not mean all frames on the stack are optimized.
Also, when we ask for the list of scripts we may get more or less
depending on GC timing.  Also fixed a presubmit error and made
%GetOptimizationStatus a little more honest.
Review URL: https://chromiumcodereview.appspot.com/10234007
http://code.google.com/p/v8/source/detail?r=11455

Modified:
 /branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/test/mjsunit/debug-evaluate-locals-optimized-double.js
 /branches/bleeding_edge/test/mjsunit/debug-evaluate-locals-optimized.js
 /branches/bleeding_edge/test/mjsunit/debug-scripts-request.js

=======================================
--- /branches/bleeding_edge/src/runtime.cc      Mon Apr 23 11:56:07 2012
+++ /branches/bleeding_edge/src/runtime.cc      Thu Apr 26 06:44:18 2012
@@ -8316,10 +8316,13 @@
   if (!V8::UseCrankshaft()) {
     return Smi::FromInt(4);  // 4 == "never".
   }
+  CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
   if (FLAG_always_opt) {
-    return Smi::FromInt(3);  // 3 == "always".
-  }
-  CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+    // We may have always opt, but that is more best-effort than a real
+    // promise, so we still say "no" if it is not optimized.
+    return function->IsOptimized() ? Smi::FromInt(3)   // 3 == "always".
+                                   : Smi::FromInt(2);  // 2 == "no".
+  }
   return function->IsOptimized() ? Smi::FromInt(1)   // 1 == "yes".
                                  : Smi::FromInt(2);  // 2 == "no".
 }
=======================================
--- /branches/bleeding_edge/test/mjsunit/debug-evaluate-locals-optimized-double.js Thu Apr 26 04:58:34 2012 +++ /branches/bleeding_edge/test/mjsunit/debug-evaluate-locals-optimized-double.js Thu Apr 26 06:44:18 2012
@@ -55,11 +55,6 @@
 function arraySum(arr) {
   return arr.reduce(function (a, b) { return a + b; }, 0);
 }
-
-function isCurrentlyOptimized(fun) {
-  // See runtime.cc.
-  return (%GetOptimizationStatus(fun) & 1) != 0;
-}

 function listener(event, exec_state, event_data, data) {
   try {
@@ -158,16 +153,6 @@
           assertFalse(frame.isInlinedFrame());
         }
       }
-
- // When function f is optimized we expect an optimized frame for f. We
-      // can't say whether or not the top 3 frames (g1, g2 and g3) are
-      // optimized and inlined.
-      var frame4 = exec_state.frame(4);
-
-      if (isCurrentlyOptimized(f)) {
-        assertTrue(frame4.isOptimizedFrame());
-        assertFalse(frame4.isInlinedFrame());
-      }

       // Indicate that all was processed.
       listenerComplete = true;
=======================================
--- /branches/bleeding_edge/test/mjsunit/debug-evaluate-locals-optimized.js Thu Apr 26 04:58:34 2012 +++ /branches/bleeding_edge/test/mjsunit/debug-evaluate-locals-optimized.js Thu Apr 26 06:44:18 2012
@@ -45,11 +45,6 @@
 function arraySum(arr) {
   return arr.reduce(function (a, b) { return a + b; }, 0);
 }
-
-function isCurrentlyOptimized(fun) {
-  // See runtime.cc.
-  return (%GetOptimizationStatus(fun) & 1) != 0;
-}

 function listener(event, exec_state, event_data, data) {
   try {
@@ -148,16 +143,6 @@
           assertFalse(frame.isInlinedFrame());
         }
       }
-
- // When function f is optimized we expect an optimized frame for f. We
-      // can't say whether or not the top 3 frames (g1, g2 and g3) are
-      // optimized and inlined.
-      var frame4 = exec_state.frame(4);
-
-      if (isCurrentlyOptimized(f)) {
-        assertTrue(frame4.isOptimizedFrame());
-        assertFalse(frame4.isInlinedFrame());
-      }

       // Indicate that all was processed.
       listenerComplete = true;
=======================================
--- /branches/bleeding_edge/test/mjsunit/debug-scripts-request.js Mon May 2 07:20:34 2011 +++ /branches/bleeding_edge/test/mjsunit/debug-scripts-request.js Thu Apr 26 06:44:18 2012
@@ -78,8 +78,10 @@
     var response = safeEval(dcp.processDebugJSONRequest(request));
     assertTrue(response.success);

-    // Test filtering by id.
-    assertEquals(2, response.body.length);
+    // Test filtering by id.  We have to get at least one script back, but
+    // the exact number depends on the timing of GC.
+    assertTrue(response.body.length >= 1);
+
     var script = response.body[0];
     var request = '{' + base_request + ',"arguments":{"ids":[' +
                   script.id + ']}}';

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to