Revision: 5971
Author: b...@google.com
Date: Mon Aug 17 09:47:48 2009
Log: Rework stack trace emulation flag.

Patch by: bobv
Review by: bruce
http://code.google.com/p/google-web-toolkit/source/detail?r=5971

Modified:
  /trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
  /trunk/dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java
  /trunk/user/src/com/google/gwt/core/CompilerParameters.gwt.xml
  /trunk/user/src/com/google/gwt/core/Core.gwt.xml
  /trunk/user/src/com/google/gwt/core/CoreWithUserAgent.gwt.xml
  /trunk/user/src/com/google/gwt/core/EmulateJsStack.gwt.xml
  /trunk/user/src/com/google/gwt/junit/JUnit.gwt.xml

=======================================
---  
/trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java        
 
Thu Aug 13 14:40:09 2009
+++  
/trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java        
 
Mon Aug 17 09:47:48 2009
@@ -272,15 +272,8 @@

        /*
         * Creates new variables, must run before code splitter and namer.
-       *
-       * TODO(bobv): This is a temporary hack to conditionally map in this  
pass.
-       * Once deferred-binding properties can specify a subset of the
-       * permutation matrix, revisit this if statement.
         */
-      if (jprogram.getDeclaredTypes().contains(
-           
jprogram.getFromTypeMap("com.google.gwt.core.client.impl.StackTraceCreator.CollectorEmulated")))
  
{
-        JsStackEmulator.exec(jsProgram, propertyOracles);
-      }
+      JsStackEmulator.exec(jsProgram, propertyOracles);

        // (10) Split up the program into fragments
        SoycArtifact dependencies = null;
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java      Tue Jul 
 
28 09:27:08 2009
+++ /trunk/dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java      Mon Aug 
 
17 09:47:48 2009
@@ -17,7 +17,10 @@

  import com.google.gwt.core.ext.BadPropertyValueException;
  import com.google.gwt.core.ext.PropertyOracle;
+import com.google.gwt.core.ext.SelectionProperty;
+import com.google.gwt.core.ext.TreeLogger;
  import com.google.gwt.dev.jjs.HasSourceInfo;
+import com.google.gwt.dev.jjs.InternalCompilerException;
  import com.google.gwt.dev.jjs.SourceInfo;
  import com.google.gwt.dev.js.ast.JsArrayAccess;
  import com.google.gwt.dev.js.ast.JsArrayLiteral;
@@ -64,6 +67,8 @@
   */
  public class JsStackEmulator {

+  private static final String PROPERTY_NAME = "compiler.emulatedStack";
+
    /**
     * Resets the global stack depth to the local stack index and top stack  
frame
     * after calls to Exceptions.caught. This is created by
@@ -776,7 +781,21 @@
    }

    public static void exec(JsProgram program, PropertyOracle[]  
propertyOracles) {
-    (new JsStackEmulator(program, propertyOracles)).execImpl();
+    SelectionProperty property;
+    try {
+      property = propertyOracles[0].getSelectionProperty(TreeLogger.NULL,
+          PROPERTY_NAME);
+    } catch (BadPropertyValueException e) {
+      // Should be inherited via Core.gwt.xml
+      throw new InternalCompilerException("Expected property " +  
PROPERTY_NAME
+          + " not defined", e);
+    }
+
+    String value = property.getCurrentValue();
+    assert value != null : property.getName() + " did not have a value";
+    if (Boolean.valueOf(value)) {
+      (new JsStackEmulator(program, propertyOracles)).execImpl();
+    }
    }

    private JsFunction caughtFunction;
=======================================
--- /trunk/user/src/com/google/gwt/core/CompilerParameters.gwt.xml      Tue Jul 
 
28 09:27:08 2009
+++ /trunk/user/src/com/google/gwt/core/CompilerParameters.gwt.xml      Mon Aug 
 
17 09:47:48 2009
@@ -22,14 +22,6 @@
    <define-configuration-property  
name='compiler.splitpoint.initial.sequence'
      is-multi-valued='true' />

-  <!-- If set to true, this will add line number data to the stack trace  
data -->
-  <define-configuration-property  
name="compiler.emulatedStack.recordLineNumbers"
-    is-multi-valued="false" />
-
-  <!-- Implies recordLineNumbers and adds source file name data to emitted  
JS -->
-  <define-configuration-property  
name="compiler.emulatedStack.recordFileNames"
-    is-multi-valued="false" />
-
    <!-- From here down, the properties are unsupported and are only  
available for test cases -->

    <!--
=======================================
--- /trunk/user/src/com/google/gwt/core/Core.gwt.xml    Tue Aug 11 10:21:03  
2009
+++ /trunk/user/src/com/google/gwt/core/Core.gwt.xml    Mon Aug 17 09:47:48  
2009
@@ -22,6 +22,7 @@
    <inherits name="com.google.gwt.emul.Emulation" />
    <inherits name="com.google.gwt.xhr.XMLHttpRequest" />
    <inherits name="com.google.gwt.core.CompilerParameters" />
+  <inherits name="com.google.gwt.core.EmulateJsStack" />

    <super-source path="translatable" />

=======================================
--- /trunk/user/src/com/google/gwt/core/CoreWithUserAgent.gwt.xml       Thu Feb 
 
19 22:19:58 2009
+++ /trunk/user/src/com/google/gwt/core/CoreWithUserAgent.gwt.xml       Mon Aug 
 
17 09:47:48 2009
@@ -18,6 +18,7 @@

    <replace-with  
class="com.google.gwt.core.client.impl.StackTraceCreator.CollectorMoz">
      <when-type-is  
class="com.google.gwt.core.client.impl.StackTraceCreator.Collector" />
+    <when-property-is name="compiler.emulatedStack" value="false" />
      <any>
        <when-property-is name="user.agent" value="gecko" />
        <when-property-is name="user.agent" value="gecko1_8" />
@@ -26,6 +27,7 @@

    <replace-with  
class="com.google.gwt.core.client.impl.StackTraceCreator.CollectorOpera">
      <when-type-is  
class="com.google.gwt.core.client.impl.StackTraceCreator.Collector" />
+    <when-property-is name="compiler.emulatedStack" value="false" />
      <any>
        <when-property-is name="user.agent" value="opera" />
      </any>
=======================================
--- /trunk/user/src/com/google/gwt/core/EmulateJsStack.gwt.xml  Tue Jul 28  
09:27:08 2009
+++ /trunk/user/src/com/google/gwt/core/EmulateJsStack.gwt.xml  Mon Aug 17  
09:47:48 2009
@@ -13,11 +13,25 @@
  <!-- implied. License for the specific language governing permissions  
and   -->
  <!-- limitations under the  
License.                                         -->

-<!-- TODO(bobv): Implement the subset-of-permutation-matrix predicates -->
+<!-- Defines support for emulating the JS stack -->
  <module>
    <inherits name="com.google.gwt.core.Core" />
+
+  <!-- If set to true, emulated stack frames will be emitted into the JS  
-->
+  <define-property name="compiler.emulatedStack" values="true,false" />
+  <set-property name="compiler.emulatedStack" value="false" />
+
+  <!-- If set to true, this will add line number data to the stack trace  
data -->
+  <define-configuration-property  
name="compiler.emulatedStack.recordLineNumbers"
+    is-multi-valued="false" />
+
+  <!-- Implies recordLineNumbers and adds source file name data to emitted  
JS -->
+  <define-configuration-property  
name="compiler.emulatedStack.recordFileNames"
+    is-multi-valued="false" />
+
    <replace-with
       
class="com.google.gwt.core.client.impl.StackTraceCreator.CollectorEmulated">
      <when-type-is  
class="com.google.gwt.core.client.impl.StackTraceCreator.Collector" />
+    <when-property-is name="compiler.emulatedStack" value="true" />
    </replace-with>
  </module>
=======================================
--- /trunk/user/src/com/google/gwt/junit/JUnit.gwt.xml  Tue Jul 28 09:27:08  
2009
+++ /trunk/user/src/com/google/gwt/junit/JUnit.gwt.xml  Mon Aug 17 09:47:48  
2009
@@ -31,18 +31,16 @@
      <when-type-assignable class="com.google.gwt.junit.client.GWTTestCase"/>
    </generate-with>

-  <!-- TODO(bobv): This is temporary until subset-of-permutation-matrix  
work is done. -->
    <!-- We want to provide good stack traces on browsers that don't provide  
good native stack traces. -->
    <set-configuration-property  
name="compiler.emulatedStack.recordFileNames" value="true" />
-  <replace-with
-     
class="com.google.gwt.core.client.impl.StackTraceCreator.CollectorEmulated">
-    <when-type-is  
class="com.google.gwt.core.client.impl.StackTraceCreator.Collector" />
+  <set-property name="compiler.emulatedStack" value="true" />
+  <set-property name="compiler.emulatedStack" value="false">
      <none>
        <when-property-is name="user.agent" value="gecko" />
        <when-property-is name="user.agent" value="gecko1_8" />
        <when-property-is name="user.agent" value="opera" />
      </none>
-  </replace-with>
+  </set-property>

    <servlet path='/junithost'  
class='com.google.gwt.junit.server.JUnitHostImpl'/>


--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to