OLD | NEW |
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 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 LOG_API(isolate, "UnboundScript::GetName"); | 1608 LOG_API(isolate, "UnboundScript::GetName"); |
1609 if (obj->script()->IsScript()) { | 1609 if (obj->script()->IsScript()) { |
1610 i::Object* name = i::Script::cast(obj->script())->name(); | 1610 i::Object* name = i::Script::cast(obj->script())->name(); |
1611 return Utils::ToLocal(i::Handle<i::Object>(name, isolate)); | 1611 return Utils::ToLocal(i::Handle<i::Object>(name, isolate)); |
1612 } else { | 1612 } else { |
1613 return Handle<String>(); | 1613 return Handle<String>(); |
1614 } | 1614 } |
1615 } | 1615 } |
1616 | 1616 |
1617 | 1617 |
| 1618 Handle<Value> UnboundScript::GetSourceURL() { |
| 1619 i::Handle<i::SharedFunctionInfo> obj = |
| 1620 i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(this)); |
| 1621 i::Isolate* isolate = obj->GetIsolate(); |
| 1622 ON_BAILOUT(isolate, "v8::UnboundScript::GetSourceURL()", |
| 1623 return Handle<String>()); |
| 1624 LOG_API(isolate, "UnboundScript::GetSourceURL"); |
| 1625 if (obj->script()->IsScript()) { |
| 1626 i::Object* url = i::Script::cast(obj->script())->source_url(); |
| 1627 return Utils::ToLocal(i::Handle<i::Object>(url, isolate)); |
| 1628 } else { |
| 1629 return Handle<String>(); |
| 1630 } |
| 1631 } |
| 1632 |
| 1633 |
| 1634 Handle<Value> UnboundScript::GetSourceMappingURL() { |
| 1635 i::Handle<i::SharedFunctionInfo> obj = |
| 1636 i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(this)); |
| 1637 i::Isolate* isolate = obj->GetIsolate(); |
| 1638 ON_BAILOUT(isolate, "v8::UnboundScript::GetSourceMappingURL()", |
| 1639 return Handle<String>()); |
| 1640 LOG_API(isolate, "UnboundScript::GetSourceMappingURL"); |
| 1641 if (obj->script()->IsScript()) { |
| 1642 i::Object* url = i::Script::cast(obj->script())->source_mapping_url(); |
| 1643 return Utils::ToLocal(i::Handle<i::Object>(url, isolate)); |
| 1644 } else { |
| 1645 return Handle<String>(); |
| 1646 } |
| 1647 } |
| 1648 |
| 1649 |
1618 Local<Value> Script::Run() { | 1650 Local<Value> Script::Run() { |
1619 i::Handle<i::Object> obj = Utils::OpenHandle(this, true); | 1651 i::Handle<i::Object> obj = Utils::OpenHandle(this, true); |
1620 // If execution is terminating, Compile(..)->Run() requires this | 1652 // If execution is terminating, Compile(..)->Run() requires this |
1621 // check. | 1653 // check. |
1622 if (obj.is_null()) return Local<Value>(); | 1654 if (obj.is_null()) return Local<Value>(); |
1623 i::Isolate* isolate = i::Handle<i::HeapObject>::cast(obj)->GetIsolate(); | 1655 i::Isolate* isolate = i::Handle<i::HeapObject>::cast(obj)->GetIsolate(); |
1624 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); | 1656 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); |
1625 LOG_API(isolate, "Script::Run"); | 1657 LOG_API(isolate, "Script::Run"); |
1626 ENTER_V8(isolate); | 1658 ENTER_V8(isolate); |
1627 i::Logger::TimerEventScope timer_scope( | 1659 i::Logger::TimerEventScope timer_scope( |
(...skipping 5970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7598 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7630 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7599 Address callback_address = | 7631 Address callback_address = |
7600 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7632 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7601 VMState<EXTERNAL> state(isolate); | 7633 VMState<EXTERNAL> state(isolate); |
7602 ExternalCallbackScope call_scope(isolate, callback_address); | 7634 ExternalCallbackScope call_scope(isolate, callback_address); |
7603 callback(info); | 7635 callback(info); |
7604 } | 7636 } |
7605 | 7637 |
7606 | 7638 |
7607 } } // namespace v8::internal | 7639 } } // namespace v8::internal |
OLD | NEW |