| 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 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 LOG_API(isolate, "UnboundScript::GetName"); | 1624 LOG_API(isolate, "UnboundScript::GetName"); |
| 1625 if (obj->script()->IsScript()) { | 1625 if (obj->script()->IsScript()) { |
| 1626 i::Object* name = i::Script::cast(obj->script())->name(); | 1626 i::Object* name = i::Script::cast(obj->script())->name(); |
| 1627 return Utils::ToLocal(i::Handle<i::Object>(name, isolate)); | 1627 return Utils::ToLocal(i::Handle<i::Object>(name, isolate)); |
| 1628 } else { | 1628 } else { |
| 1629 return Handle<String>(); | 1629 return Handle<String>(); |
| 1630 } | 1630 } |
| 1631 } | 1631 } |
| 1632 | 1632 |
| 1633 | 1633 |
| 1634 Handle<Value> UnboundScript::GetSourceURL() { |
| 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::GetSourceURL()", |
| 1639 return Handle<String>()); |
| 1640 LOG_API(isolate, "UnboundScript::GetSourceURL"); |
| 1641 if (obj->script()->IsScript()) { |
| 1642 i::Object* url = i::Script::cast(obj->script())->source_url(); |
| 1643 return Utils::ToLocal(i::Handle<i::Object>(url, isolate)); |
| 1644 } else { |
| 1645 return Handle<String>(); |
| 1646 } |
| 1647 } |
| 1648 |
| 1649 |
| 1650 Handle<Value> UnboundScript::GetSourceMappingURL() { |
| 1651 i::Handle<i::SharedFunctionInfo> obj = |
| 1652 i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(this)); |
| 1653 i::Isolate* isolate = obj->GetIsolate(); |
| 1654 ON_BAILOUT(isolate, "v8::UnboundScript::GetSourceMappingURL()", |
| 1655 return Handle<String>()); |
| 1656 LOG_API(isolate, "UnboundScript::GetSourceMappingURL"); |
| 1657 if (obj->script()->IsScript()) { |
| 1658 i::Object* url = i::Script::cast(obj->script())->source_mapping_url(); |
| 1659 return Utils::ToLocal(i::Handle<i::Object>(url, isolate)); |
| 1660 } else { |
| 1661 return Handle<String>(); |
| 1662 } |
| 1663 } |
| 1664 |
| 1665 |
| 1634 Local<Value> Script::Run() { | 1666 Local<Value> Script::Run() { |
| 1635 // If execution is terminating, Compile(..)->Run() requires this | 1667 // If execution is terminating, Compile(..)->Run() requires this |
| 1636 // check. | 1668 // check. |
| 1637 if (this == NULL) return Local<Value>(); | 1669 if (this == NULL) return Local<Value>(); |
| 1638 i::Handle<i::HeapObject> obj = | 1670 i::Handle<i::HeapObject> obj = |
| 1639 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 1671 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); |
| 1640 i::Isolate* isolate = obj->GetIsolate(); | 1672 i::Isolate* isolate = obj->GetIsolate(); |
| 1641 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); | 1673 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); |
| 1642 LOG_API(isolate, "Script::Run"); | 1674 LOG_API(isolate, "Script::Run"); |
| 1643 ENTER_V8(isolate); | 1675 ENTER_V8(isolate); |
| (...skipping 5937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7581 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7613 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7582 Address callback_address = | 7614 Address callback_address = |
| 7583 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7615 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7584 VMState<EXTERNAL> state(isolate); | 7616 VMState<EXTERNAL> state(isolate); |
| 7585 ExternalCallbackScope call_scope(isolate, callback_address); | 7617 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7586 callback(info); | 7618 callback(info); |
| 7587 } | 7619 } |
| 7588 | 7620 |
| 7589 | 7621 |
| 7590 } } // namespace v8::internal | 7622 } } // namespace v8::internal |
| OLD | NEW |