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

Side by Side 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, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/accessors.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 LOG_API(isolate, "UnboundScript::GetName"); 1626 LOG_API(isolate, "UnboundScript::GetName");
1627 if (obj->script()->IsScript()) { 1627 if (obj->script()->IsScript()) {
1628 i::Object* name = i::Script::cast(obj->script())->name(); 1628 i::Object* name = i::Script::cast(obj->script())->name();
1629 return Utils::ToLocal(i::Handle<i::Object>(name, isolate)); 1629 return Utils::ToLocal(i::Handle<i::Object>(name, isolate));
1630 } else { 1630 } else {
1631 return Handle<String>(); 1631 return Handle<String>();
1632 } 1632 }
1633 } 1633 }
1634 1634
1635 1635
1636 Handle<Value> UnboundScript::GetSourceURL() {
1637 i::Handle<i::SharedFunctionInfo> obj =
1638 i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(this));
1639 i::Isolate* isolate = obj->GetIsolate();
1640 ON_BAILOUT(isolate, "v8::UnboundScript::GetSourceURL()",
1641 return Handle<String>());
1642 LOG_API(isolate, "UnboundScript::GetSourceURL");
1643 if (obj->script()->IsScript()) {
1644 i::Object* url = i::Script::cast(obj->script())->source_url();
1645 return Utils::ToLocal(i::Handle<i::Object>(url, isolate));
1646 } else {
1647 return Handle<String>();
1648 }
1649 }
1650
1651
1652 Handle<Value> UnboundScript::GetSourceMappingURL() {
1653 i::Handle<i::SharedFunctionInfo> obj =
1654 i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(this));
1655 i::Isolate* isolate = obj->GetIsolate();
1656 ON_BAILOUT(isolate, "v8::UnboundScript::GetSourceMappingURL()",
1657 return Handle<String>());
1658 LOG_API(isolate, "UnboundScript::GetSourceMappingURL");
1659 if (obj->script()->IsScript()) {
1660 i::Object* url = i::Script::cast(obj->script())->source_mapping_url();
1661 return Utils::ToLocal(i::Handle<i::Object>(url, isolate));
1662 } else {
1663 return Handle<String>();
1664 }
1665 }
1666
1667
1636 Local<Value> Script::Run() { 1668 Local<Value> Script::Run() {
1637 i::Handle<i::Object> obj = Utils::OpenHandle(this, true); 1669 i::Handle<i::Object> obj = Utils::OpenHandle(this, true);
1638 // If execution is terminating, Compile(..)->Run() requires this 1670 // If execution is terminating, Compile(..)->Run() requires this
1639 // check. 1671 // check.
1640 if (obj.is_null()) return Local<Value>(); 1672 if (obj.is_null()) return Local<Value>();
1641 i::Isolate* isolate = i::Handle<i::HeapObject>::cast(obj)->GetIsolate(); 1673 i::Isolate* isolate = i::Handle<i::HeapObject>::cast(obj)->GetIsolate();
1642 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); 1674 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>());
1643 LOG_API(isolate, "Script::Run"); 1675 LOG_API(isolate, "Script::Run");
1644 ENTER_V8(isolate); 1676 ENTER_V8(isolate);
1645 i::Logger::TimerEventScope timer_scope( 1677 i::Logger::TimerEventScope timer_scope(
(...skipping 5980 matching lines...) Expand 10 before | Expand all | Expand 10 after
7626 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7658 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7627 Address callback_address = 7659 Address callback_address =
7628 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7660 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7629 VMState<EXTERNAL> state(isolate); 7661 VMState<EXTERNAL> state(isolate);
7630 ExternalCallbackScope call_scope(isolate, callback_address); 7662 ExternalCallbackScope call_scope(isolate, callback_address);
7631 callback(info); 7663 callback(info);
7632 } 7664 }
7633 7665
7634 7666
7635 } } // namespace v8::internal 7667 } } // namespace v8::internal
OLDNEW
« 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