Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: src/api.cc

Issue 316173002: Handle "//# sourceURL" comments in the Parser instead of the JS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: yet another trivial rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/accessors.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index a324726cc2bf0a2c1e1cad609385814d4db86194..7c484de53ee1e537a8abeefdce1e0cab69e4952e 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1633,6 +1633,38 @@ Handle<Value> UnboundScript::GetScriptName() {
}
+Handle<Value> UnboundScript::GetSourceURL() {
+ i::Handle<i::SharedFunctionInfo> obj =
+ i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(this));
+ i::Isolate* isolate = obj->GetIsolate();
+ ON_BAILOUT(isolate, "v8::UnboundScript::GetSourceURL()",
+ return Handle<String>());
+ LOG_API(isolate, "UnboundScript::GetSourceURL");
+ if (obj->script()->IsScript()) {
+ i::Object* url = i::Script::cast(obj->script())->source_url();
+ return Utils::ToLocal(i::Handle<i::Object>(url, isolate));
+ } else {
+ return Handle<String>();
+ }
+}
+
+
+Handle<Value> UnboundScript::GetSourceMappingURL() {
+ i::Handle<i::SharedFunctionInfo> obj =
+ i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(this));
+ i::Isolate* isolate = obj->GetIsolate();
+ ON_BAILOUT(isolate, "v8::UnboundScript::GetSourceMappingURL()",
+ return Handle<String>());
+ LOG_API(isolate, "UnboundScript::GetSourceMappingURL");
+ if (obj->script()->IsScript()) {
+ i::Object* url = i::Script::cast(obj->script())->source_mapping_url();
+ return Utils::ToLocal(i::Handle<i::Object>(url, isolate));
+ } else {
+ return Handle<String>();
+ }
+}
+
+
Local<Value> Script::Run() {
i::Handle<i::Object> obj = Utils::OpenHandle(this, true);
// If execution is terminating, Compile(..)->Run() requires this
« no previous file with comments | « src/accessors.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698