Revision: 14883
Author:   [email protected]
Date:     Wed May 29 05:40:21 2013
Log: Add support for //# sourceURL similar to deprecated //@ sourceURL one.

BUG=v8:2702
[email protected], [email protected]

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

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/messages.js
 /branches/bleeding_edge/test/cctest/test-api.cc
 /branches/bleeding_edge/test/mjsunit/debug-compile-event.js
 /branches/bleeding_edge/test/mjsunit/debug-set-script-source.js
 /branches/bleeding_edge/test/mjsunit/debug-setbreakpoint.js
 /branches/bleeding_edge/test/mjsunit/regress/regress-1853.js
 /branches/bleeding_edge/test/mjsunit/stack-traces.js

=======================================
--- /branches/bleeding_edge/include/v8.h        Wed May 29 04:04:10 2013
+++ /branches/bleeding_edge/include/v8.h        Wed May 29 05:40:21 2013
@@ -1252,7 +1252,8 @@
   /**
    * Returns the name of the resource that contains the script for the
    * function for this StackFrame or sourceURL value if the script name
-   * is undefined and its source ends with //@ sourceURL=... string.
+   * is undefined and its source ends with //# sourceURL=... string or
+   * deprecated //@ sourceURL=... string.
    */
   Local<String> GetScriptNameOrSourceURL() const;

=======================================
--- /branches/bleeding_edge/src/messages.js     Fri May 24 04:33:46 2013
+++ /branches/bleeding_edge/src/messages.js     Wed May 29 05:40:21 2013
@@ -543,11 +543,11 @@
* If sourceURL comment is available and script starts at zero returns sourceURL
  * comment contents. Otherwise, script name is returned. See
* http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt - * for details on using //@ sourceURL comment to identify scritps that don't
- * have name.
+ * and Source Map Revision 3 proposal for details on using //# sourceURL and + * deprecated //@ sourceURL comment to identify scripts that don't have name.
  *
- * @return {?string} script name if present, value for //@ sourceURL comment
- * otherwise.
+ * @return {?string} script name if present, value for //# sourceURL or
+ * deprecated //@ sourceURL comment otherwise.
  */
 function ScriptNameOrSourceURL() {
   if (this.line_offset > 0 || this.column_offset > 0) {
@@ -572,7 +572,7 @@
   this.cachedNameOrSourceURL = this.name;
   if (sourceUrlPos > 4) {
     var sourceUrlPattern =
-        /\/\/@[\040\t]sourceURL=[\040\t]*([^\s\'\"]*)[\040\t]*$/gm;
+        /\/\/[#@][\040\t]sourceURL=[\040\t]*([^\s\'\"]*)[\040\t]*$/gm;
     // Don't reuse lastMatchInfo here, so we create a new array with room
     // for four captures (array with length one longer than the index
     // of the fourth capture, where the numbering is zero-based).
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc     Wed May 29 04:04:10 2013
+++ /branches/bleeding_edge/test/cctest/test-api.cc     Wed May 29 05:40:21 2013
@@ -15732,8 +15732,13 @@
     "}\n"
     "foo();\n"
     "}\n"
-    "eval('(' + outer +')()//@ sourceURL=eval_url');";
-  CHECK(CompileRun(source)->IsUndefined());
+    "eval('(' + outer +')()%s');";
+
+  i::ScopedVector<char> code(1024);
+  i::OS::SNPrintF(code, source, "//# sourceURL=eval_url");
+  CHECK(CompileRun(code.start())->IsUndefined());
+  i::OS::SNPrintF(code, source, "//@ sourceURL=eval_url");
+  CHECK(CompileRun(code.start())->IsUndefined());
 }


@@ -15773,9 +15778,13 @@
     "}\n"
     "foo();\n"
     "}\n"
-    "outer()\n"
-    "//@ sourceURL=source_url";
-  CHECK(CompileRunWithOrigin(source, "url", 0, 1)->IsUndefined());
+    "outer()\n%s";
+
+  i::ScopedVector<char> code(1024);
+  i::OS::SNPrintF(code, source, "//# sourceURL=source_url");
+  CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined());
+  i::OS::SNPrintF(code, source, "//@ sourceURL=source_url");
+  CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined());
 }


@@ -15815,9 +15824,13 @@
     "}\n"
     "foo();\n"
     "}\n"
-    "outer()\n"
-    "//@ sourceURL=source_url";
-  CHECK(CompileRunWithOrigin(source, "url", 0, 0)->IsUndefined());
+    "outer()\n%s";
+
+  i::ScopedVector<char> code(1024);
+  i::OS::SNPrintF(code, source, "//# sourceURL=source_url");
+  CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined());
+  i::OS::SNPrintF(code, source, "//@ sourceURL=source_url");
+  CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined());
 }

 static void CreateGarbageInOldSpace() {
=======================================
--- /branches/bleeding_edge/test/mjsunit/debug-compile-event.js Thu Sep 1 04:28:10 2011 +++ /branches/bleeding_edge/test/mjsunit/debug-compile-event.js Wed May 29 05:40:21 2013
@@ -80,7 +80,7 @@
       var msg = eval('(' + json + ')');
       assertTrue('context' in msg.body.script);

-      // Check that we pick script name from //@ sourceURL, iff present
+      // Check that we pick script name from //# sourceURL, iff present
       assertEquals(current_source.indexOf('sourceURL') >= 0 ?
                      'myscript.js' : undefined,
                    event_data.script().name());
@@ -103,7 +103,7 @@
 source_count += 2;  // Using eval causes additional compilation event.
 compileSource('JSON.parse(\'{"a":1,"b":2}\')');
 // Using JSON.parse does not causes additional compilation events.
-compileSource('x=1; //@ sourceURL=myscript.js');
+compileSource('x=1; //# sourceURL=myscript.js');

 // Make sure that the debug event listener was invoked.
 assertFalse(exception, "exception in listener")
=======================================
--- /branches/bleeding_edge/test/mjsunit/debug-set-script-source.js Thu Mar 15 04:51:26 2012 +++ /branches/bleeding_edge/test/mjsunit/debug-set-script-source.js Wed May 29 05:40:21 2013
@@ -36,10 +36,10 @@
 function listener(event, exec_state, event_data, data) {
   if (event == Debug.DebugEvent.BeforeCompile) {
     event_data.script().setSource(event_data.script().source() +
-        " //@ sourceURL=proper_location_" + (++script_number));
+        " //# sourceURL=proper_location_" + (++script_number));
   } else if (event == Debug.DebugEvent.AfterCompile) {
     try {
-      event_data.script().setSource("a=1 //@ sourceURL=wrong_location");
+      event_data.script().setSource("a=1 //# sourceURL=wrong_location");
     } catch(e) {
       exception = e;
     }
=======================================
--- /branches/bleeding_edge/test/mjsunit/debug-setbreakpoint.js Tue Dec 7 03:01:02 2010 +++ /branches/bleeding_edge/test/mjsunit/debug-setbreakpoint.js Wed May 29 05:40:21 2013
@@ -146,7 +146,7 @@
 };

 eval('function h(){}');
-eval('function sourceUrlFunc() { a = 2; }\n//@ sourceURL=sourceUrlScript');
+eval('function sourceUrlFunc() { a = 2; }\n//# sourceURL=sourceUrlScript');

 o = {a:function(){},b:function(){}}

=======================================
--- /branches/bleeding_edge/test/mjsunit/regress/regress-1853.js Mon Feb 27 03:52:08 2012 +++ /branches/bleeding_edge/test/mjsunit/regress/regress-1853.js Wed May 29 05:40:21 2013
@@ -102,13 +102,13 @@
      '  assertFalse(test_break_1);      \n' +
      '  assertTrue(test_break_1);       \n' +
      '}                                 \n' +
-     '//@ sourceURL=testScriptOne');
+     '//# sourceURL=testScriptOne');

 eval('function test2() {                \n' +
      '  assertFalse(test_break_2);      \n' +
      '  assertTrue(test_break_2);       \n' +
      '}                                 \n' +
-     '//@ sourceURL=testScriptTwo');
+     '//# sourceURL=testScriptTwo');

 test1();
 test2();
=======================================
--- /branches/bleeding_edge/test/mjsunit/stack-traces.js Mon Jan 14 05:19:27 2013 +++ /branches/bleeding_edge/test/mjsunit/stack-traces.js Wed May 29 05:40:21 2013
@@ -64,13 +64,13 @@
 }

 function testEvalWithSourceURL() {
-  eval("function Doo() { FAIL; }; Doo();\n//@ sourceURL=res://name");
+  eval("function Doo() { FAIL; }; Doo();\n//# sourceURL=res://name");
 }

 function testNestedEvalWithSourceURL() {
   var x = "FAIL";
var innerEval = 'function Inner() { eval(x); }\n//@ sourceURL=res://inner-eval'; - eval("function Outer() { eval(innerEval); Inner(); }; Outer();\n//@ sourceURL=res://outer-eval"); + eval("function Outer() { eval(innerEval); Inner(); }; Outer();\n//# sourceURL=res://outer-eval");
 }

 function testValue() {

--
--
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/groups/opt_out.


Reply via email to