OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 // Copy the data to align it. | 1604 // Copy the data to align it. |
1605 unsigned* deserialized_data = i::NewArray<unsigned>(deserialized_data_length); | 1605 unsigned* deserialized_data = i::NewArray<unsigned>(deserialized_data_length); |
1606 i::CopyBytes(reinterpret_cast<char*>(deserialized_data), | 1606 i::CopyBytes(reinterpret_cast<char*>(deserialized_data), |
1607 data, static_cast<size_t>(length)); | 1607 data, static_cast<size_t>(length)); |
1608 | 1608 |
1609 return new i::ScriptDataImpl( | 1609 return new i::ScriptDataImpl( |
1610 i::Vector<unsigned>(deserialized_data, deserialized_data_length)); | 1610 i::Vector<unsigned>(deserialized_data, deserialized_data_length)); |
1611 } | 1611 } |
1612 | 1612 |
1613 | 1613 |
1614 // --- S c r i p t s --- | 1614 // --- S c r i p t --- |
1615 | 1615 |
1616 | 1616 |
1617 // Internally, UnboundScript is a SharedFunctionInfo, and Script is a | 1617 Local<Script> Script::New(v8::Handle<String> source, |
1618 // JSFunction. | 1618 v8::ScriptOrigin* origin, |
1619 | 1619 v8::ScriptData* pre_data) { |
1620 ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin, | 1620 i::Handle<i::String> str = Utils::OpenHandle(*source); |
1621 const CachedData& data) | 1621 i::Isolate* isolate = str->GetIsolate(); |
1622 : source_string(string), | 1622 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>()); |
1623 resource_name(origin.ResourceName()), | 1623 LOG_API(isolate, "Script::New"); |
1624 resource_line_offset(origin.ResourceLineOffset()), | 1624 ENTER_V8(isolate); |
1625 resource_column_offset(origin.ResourceColumnOffset()), | 1625 i::SharedFunctionInfo* raw_result = NULL; |
1626 resource_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin()), | 1626 { i::HandleScope scope(isolate); |
1627 cached_data(data) {} | 1627 i::Handle<i::Object> name_obj; |
1628 | 1628 int line_offset = 0; |
1629 | 1629 int column_offset = 0; |
1630 ScriptCompiler::Source::Source(Local<String> string, | 1630 bool is_shared_cross_origin = false; |
1631 const CachedData& data) | 1631 if (origin != NULL) { |
1632 : source_string(string), cached_data(data) {} | 1632 if (!origin->ResourceName().IsEmpty()) { |
1633 | 1633 name_obj = Utils::OpenHandle(*origin->ResourceName()); |
1634 | 1634 } |
1635 Local<Script> UnboundScript::BindToCurrentContext() { | 1635 if (!origin->ResourceLineOffset().IsEmpty()) { |
1636 i::Handle<i::HeapObject> obj = | 1636 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); |
1637 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 1637 } |
1638 i::Handle<i::SharedFunctionInfo> | 1638 if (!origin->ResourceColumnOffset().IsEmpty()) { |
1639 function_info(i::SharedFunctionInfo::cast(*obj), obj->GetIsolate()); | 1639 column_offset = |
1640 i::Handle<i::JSFunction> function = | 1640 static_cast<int>(origin->ResourceColumnOffset()->Value()); |
1641 obj->GetIsolate()->factory()->NewFunctionFromSharedFunctionInfo( | 1641 } |
1642 function_info, obj->GetIsolate()->global_context()); | 1642 if (!origin->ResourceIsSharedCrossOrigin().IsEmpty()) { |
1643 return ToApiHandle<Script>(function); | 1643 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
| 1644 is_shared_cross_origin = |
| 1645 origin->ResourceIsSharedCrossOrigin() == v8::True(v8_isolate); |
| 1646 } |
| 1647 } |
| 1648 EXCEPTION_PREAMBLE(isolate); |
| 1649 i::ScriptDataImpl* pre_data_impl = |
| 1650 static_cast<i::ScriptDataImpl*>(pre_data); |
| 1651 // We assert that the pre-data is sane, even though we can actually |
| 1652 // handle it if it turns out not to be in release mode. |
| 1653 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); |
| 1654 // If the pre-data isn't sane we simply ignore it |
| 1655 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { |
| 1656 pre_data_impl = NULL; |
| 1657 } |
| 1658 i::Handle<i::SharedFunctionInfo> result = |
| 1659 i::Compiler::CompileScript(str, |
| 1660 name_obj, |
| 1661 line_offset, |
| 1662 column_offset, |
| 1663 is_shared_cross_origin, |
| 1664 isolate->global_context(), |
| 1665 NULL, |
| 1666 pre_data_impl, |
| 1667 i::NOT_NATIVES_CODE); |
| 1668 has_pending_exception = result.is_null(); |
| 1669 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); |
| 1670 raw_result = *result; |
| 1671 } |
| 1672 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); |
| 1673 return ToApiHandle<Script>(result); |
1644 } | 1674 } |
1645 | 1675 |
1646 | 1676 |
1647 int UnboundScript::GetId() { | 1677 Local<Script> Script::New(v8::Handle<String> source, |
1648 i::Handle<i::HeapObject> obj = | 1678 v8::Handle<Value> file_name) { |
1649 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 1679 ScriptOrigin origin(file_name); |
1650 i::Isolate* isolate = obj->GetIsolate(); | 1680 return New(source, &origin); |
1651 ON_BAILOUT(isolate, "v8::UnboundScript::GetId()", return -1); | |
1652 LOG_API(isolate, "v8::UnboundScript::GetId"); | |
1653 { | |
1654 i::HandleScope scope(isolate); | |
1655 i::Handle<i::SharedFunctionInfo> function_info( | |
1656 i::SharedFunctionInfo::cast(*obj)); | |
1657 i::Handle<i::Script> script(i::Script::cast(function_info->script())); | |
1658 return script->id()->value(); | |
1659 } | |
1660 } | 1681 } |
1661 | 1682 |
1662 | 1683 |
1663 int UnboundScript::GetLineNumber(int code_pos) { | 1684 Local<Script> Script::Compile(v8::Handle<String> source, |
1664 i::Handle<i::HeapObject> obj = | 1685 v8::ScriptOrigin* origin, |
1665 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 1686 v8::ScriptData* pre_data) { |
1666 i::Isolate* isolate = obj->GetIsolate(); | 1687 i::Handle<i::String> str = Utils::OpenHandle(*source); |
1667 ON_BAILOUT(isolate, "v8::UnboundScript::GetLineNumber()", return -1); | 1688 i::Isolate* isolate = str->GetIsolate(); |
1668 LOG_API(isolate, "UnboundScript::GetLineNumber"); | 1689 ON_BAILOUT(isolate, "v8::Script::Compile()", return Local<Script>()); |
1669 if (obj->IsScript()) { | 1690 LOG_API(isolate, "Script::Compile"); |
1670 i::Handle<i::Script> script(i::Script::cast(*obj)); | 1691 ENTER_V8(isolate); |
1671 return i::GetScriptLineNumber(script, code_pos); | 1692 Local<Script> generic = New(source, origin, pre_data); |
1672 } else { | 1693 if (generic.IsEmpty()) |
1673 return -1; | 1694 return generic; |
1674 } | 1695 i::Handle<i::Object> obj = Utils::OpenHandle(*generic); |
| 1696 i::Handle<i::SharedFunctionInfo> function = |
| 1697 i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj)); |
| 1698 i::Handle<i::JSFunction> result = |
| 1699 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 1700 function, |
| 1701 isolate->global_context()); |
| 1702 return ToApiHandle<Script>(result); |
1675 } | 1703 } |
1676 | 1704 |
1677 | 1705 |
1678 Handle<Value> UnboundScript::GetScriptName() { | 1706 Local<Script> Script::Compile(v8::Handle<String> source, |
1679 i::Handle<i::HeapObject> obj = | 1707 v8::Handle<Value> file_name) { |
1680 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 1708 ScriptOrigin origin(file_name); |
1681 i::Isolate* isolate = obj->GetIsolate(); | 1709 return Compile(source, &origin); |
1682 ON_BAILOUT(isolate, "v8::UnboundScript::GetName()", | |
1683 return Handle<String>()); | |
1684 LOG_API(isolate, "UnboundScript::GetName"); | |
1685 if (obj->IsScript()) { | |
1686 i::Object* name = i::Script::cast(*obj)->name(); | |
1687 return Utils::ToLocal(i::Handle<i::Object>(name, isolate)); | |
1688 } else { | |
1689 return Handle<String>(); | |
1690 } | |
1691 } | 1710 } |
1692 | 1711 |
1693 | 1712 |
1694 Local<Value> Script::Run() { | 1713 Local<Value> Script::Run() { |
1695 // If execution is terminating, Compile(..)->Run() requires this | 1714 // If execution is terminating, Compile(script)->Run() requires this check. |
1696 // check. | |
1697 if (this == NULL) return Local<Value>(); | 1715 if (this == NULL) return Local<Value>(); |
1698 i::Handle<i::HeapObject> obj = | 1716 i::Handle<i::HeapObject> obj = |
1699 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 1717 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); |
1700 i::Isolate* isolate = obj->GetIsolate(); | 1718 i::Isolate* isolate = obj->GetIsolate(); |
1701 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); | 1719 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); |
1702 LOG_API(isolate, "Script::Run"); | 1720 LOG_API(isolate, "Script::Run"); |
1703 ENTER_V8(isolate); | 1721 ENTER_V8(isolate); |
1704 i::Logger::TimerEventScope timer_scope( | 1722 i::Logger::TimerEventScope timer_scope( |
1705 isolate, i::Logger::TimerEventScope::v8_execute); | 1723 isolate, i::Logger::TimerEventScope::v8_execute); |
1706 i::Object* raw_result = NULL; | 1724 i::Object* raw_result = NULL; |
1707 { | 1725 { |
1708 i::HandleScope scope(isolate); | 1726 i::HandleScope scope(isolate); |
1709 i::Handle<i::JSFunction> fun = | 1727 i::Handle<i::JSFunction> fun; |
1710 i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate); | 1728 if (obj->IsSharedFunctionInfo()) { |
| 1729 i::Handle<i::SharedFunctionInfo> |
| 1730 function_info(i::SharedFunctionInfo::cast(*obj), isolate); |
| 1731 fun = isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 1732 function_info, isolate->global_context()); |
| 1733 } else { |
| 1734 fun = i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate); |
| 1735 } |
1711 EXCEPTION_PREAMBLE(isolate); | 1736 EXCEPTION_PREAMBLE(isolate); |
1712 i::Handle<i::Object> receiver( | 1737 i::Handle<i::Object> receiver( |
1713 isolate->context()->global_proxy(), isolate); | 1738 isolate->context()->global_proxy(), isolate); |
1714 i::Handle<i::Object> result = i::Execution::Call( | 1739 i::Handle<i::Object> result = i::Execution::Call( |
1715 isolate, fun, receiver, 0, NULL, &has_pending_exception); | 1740 isolate, fun, receiver, 0, NULL, &has_pending_exception); |
1716 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); | 1741 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); |
1717 raw_result = *result; | 1742 raw_result = *result; |
1718 } | 1743 } |
1719 i::Handle<i::Object> result(raw_result, isolate); | 1744 i::Handle<i::Object> result(raw_result, isolate); |
1720 return Utils::ToLocal(result); | 1745 return Utils::ToLocal(result); |
1721 } | 1746 } |
1722 | 1747 |
1723 | 1748 |
1724 Local<UnboundScript> Script::GetUnboundScript() { | 1749 static i::Handle<i::SharedFunctionInfo> OpenScript(Script* script) { |
1725 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 1750 i::Handle<i::Object> obj = Utils::OpenHandle(script); |
1726 return ToApiHandle<UnboundScript>( | 1751 i::Handle<i::SharedFunctionInfo> result; |
1727 i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared())); | 1752 if (obj->IsSharedFunctionInfo()) { |
| 1753 result = |
| 1754 i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj)); |
| 1755 } else { |
| 1756 result = |
| 1757 i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared()); |
| 1758 } |
| 1759 return result; |
1728 } | 1760 } |
1729 | 1761 |
1730 | 1762 |
1731 Local<UnboundScript> ScriptCompiler::CompileUnbound( | 1763 int Script::GetId() { |
1732 Isolate* v8_isolate, | 1764 i::Handle<i::HeapObject> obj = |
1733 const Source& source, | 1765 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); |
1734 CompileOptions options) { | 1766 i::Isolate* isolate = obj->GetIsolate(); |
1735 // FIXME(marja): This function cannot yet create cached data (if options | | 1767 ON_BAILOUT(isolate, "v8::Script::Id()", return -1); |
1736 // produce_data_to_cache is true), but the PreCompile function is still there | 1768 LOG_API(isolate, "Script::Id"); |
1737 // for doing it. | 1769 { |
1738 i::Handle<i::String> str = Utils::OpenHandle(*(source.source_string)); | 1770 i::HandleScope scope(isolate); |
1739 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 1771 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this); |
1740 ON_BAILOUT(isolate, "v8::ScriptCompiler::CompileUnbound()", | 1772 i::Handle<i::Script> script(i::Script::cast(function_info->script())); |
1741 return Local<UnboundScript>()); | 1773 return script->id()->value(); |
1742 LOG_API(isolate, "ScriptCompiler::CompileUnbound"); | |
1743 ENTER_V8(isolate); | |
1744 i::SharedFunctionInfo* raw_result = NULL; | |
1745 { i::HandleScope scope(isolate); | |
1746 i::Handle<i::Object> name_obj; | |
1747 int line_offset = 0; | |
1748 int column_offset = 0; | |
1749 bool is_shared_cross_origin = false; | |
1750 if (!source.resource_name.IsEmpty()) { | |
1751 name_obj = Utils::OpenHandle(*source.resource_name); | |
1752 } | |
1753 if (!source.resource_line_offset.IsEmpty()) { | |
1754 line_offset = static_cast<int>(source.resource_line_offset->Value()); | |
1755 } | |
1756 if (!source.resource_column_offset.IsEmpty()) { | |
1757 column_offset = | |
1758 static_cast<int>(source.resource_column_offset->Value()); | |
1759 } | |
1760 if (!source.resource_is_shared_cross_origin.IsEmpty()) { | |
1761 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | |
1762 is_shared_cross_origin = | |
1763 source.resource_is_shared_cross_origin == v8::True(v8_isolate); | |
1764 } | |
1765 EXCEPTION_PREAMBLE(isolate); | |
1766 i::ScriptDataImpl* pre_data_impl = NULL; | |
1767 if (source.cached_data.data) { | |
1768 // FIXME(marja): Make compiler use CachedData directly. | |
1769 pre_data_impl = static_cast<i::ScriptDataImpl*>(ScriptData::New( | |
1770 reinterpret_cast<const char*>(source.cached_data.data), | |
1771 source.cached_data.length)); | |
1772 } | |
1773 // We assert that the pre-data is sane, even though we can actually | |
1774 // handle it if it turns out not to be in release mode. | |
1775 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); | |
1776 // If the pre-data isn't sane we simply ignore it | |
1777 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { | |
1778 delete pre_data_impl; | |
1779 pre_data_impl = NULL; | |
1780 } | |
1781 i::Handle<i::SharedFunctionInfo> result = | |
1782 i::Compiler::CompileScript(str, | |
1783 name_obj, | |
1784 line_offset, | |
1785 column_offset, | |
1786 is_shared_cross_origin, | |
1787 isolate->global_context(), | |
1788 NULL, | |
1789 pre_data_impl, | |
1790 i::NOT_NATIVES_CODE); | |
1791 has_pending_exception = result.is_null(); | |
1792 EXCEPTION_BAILOUT_CHECK(isolate, Local<UnboundScript>()); | |
1793 raw_result = *result; | |
1794 delete pre_data_impl; | |
1795 } | 1774 } |
1796 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); | |
1797 return ToApiHandle<UnboundScript>(result); | |
1798 } | 1775 } |
1799 | 1776 |
1800 | 1777 |
1801 Local<Script> ScriptCompiler::Compile( | 1778 int Script::GetLineNumber(int code_pos) { |
1802 Isolate* v8_isolate, | 1779 i::Handle<i::HeapObject> obj = |
1803 const Source& source, | 1780 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); |
1804 CompileOptions options) { | 1781 i::Isolate* isolate = obj->GetIsolate(); |
1805 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 1782 ON_BAILOUT(isolate, "v8::Script::GetLineNumber()", return -1); |
1806 ON_BAILOUT(isolate, "v8::ScriptCompiler::Compile()", | 1783 LOG_API(isolate, "Script::GetLineNumber"); |
1807 return Local<Script>()); | 1784 if (obj->IsScript()) { |
1808 LOG_API(isolate, "ScriptCompiler::CompiletBound()"); | 1785 i::Handle<i::Script> script = i::Handle<i::Script>(i::Script::cast(*obj)); |
1809 ENTER_V8(isolate); | 1786 return i::GetScriptLineNumber(script, code_pos); |
1810 Local<UnboundScript> generic = | 1787 } else { |
1811 CompileUnbound(v8_isolate, source, options); | 1788 return -1; |
1812 if (generic.IsEmpty()) return Local<Script>(); | 1789 } |
1813 return generic->BindToCurrentContext(); | |
1814 } | 1790 } |
1815 | 1791 |
1816 | 1792 |
1817 Local<Script> Script::Compile(v8::Handle<String> source, | 1793 Handle<Value> Script::GetScriptName() { |
1818 v8::ScriptOrigin* origin) { | 1794 i::Handle<i::HeapObject> obj = |
1819 i::Handle<i::String> str = Utils::OpenHandle(*source); | 1795 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); |
1820 if (origin) { | 1796 i::Isolate* isolate = obj->GetIsolate(); |
1821 return ScriptCompiler::Compile( | 1797 ON_BAILOUT(isolate, "v8::Script::GetName()", return Handle<String>()); |
1822 reinterpret_cast<v8::Isolate*>(str->GetIsolate()), | 1798 LOG_API(isolate, "Script::GetName"); |
1823 ScriptCompiler::Source(source, *origin)); | 1799 if (obj->IsScript()) { |
| 1800 i::Object* name = i::Script::cast(*obj)->name(); |
| 1801 return Utils::ToLocal(i::Handle<i::Object>(name, isolate)); |
| 1802 } else { |
| 1803 return Handle<String>(); |
1824 } | 1804 } |
1825 return ScriptCompiler::Compile( | |
1826 reinterpret_cast<v8::Isolate*>(str->GetIsolate()), | |
1827 ScriptCompiler::Source(source)); | |
1828 } | 1805 } |
1829 | 1806 |
1830 | 1807 |
1831 Local<Script> Script::Compile(v8::Handle<String> source, | |
1832 v8::Handle<String> file_name) { | |
1833 ScriptOrigin origin(file_name); | |
1834 return Compile(source, &origin); | |
1835 } | |
1836 | |
1837 | |
1838 // --- E x c e p t i o n s --- | 1808 // --- E x c e p t i o n s --- |
1839 | 1809 |
1840 | 1810 |
1841 v8::TryCatch::TryCatch() | 1811 v8::TryCatch::TryCatch() |
1842 : isolate_(i::Isolate::Current()), | 1812 : isolate_(i::Isolate::Current()), |
1843 next_(isolate_->try_catch_handler_address()), | 1813 next_(isolate_->try_catch_handler_address()), |
1844 is_verbose_(false), | 1814 is_verbose_(false), |
1845 can_continue_(true), | 1815 can_continue_(true), |
1846 capture_message_(true), | 1816 capture_message_(true), |
1847 rethrow_(false), | 1817 rethrow_(false), |
(...skipping 2203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4051 | 4021 |
4052 | 4022 |
4053 bool Function::IsBuiltin() const { | 4023 bool Function::IsBuiltin() const { |
4054 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4024 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
4055 return func->IsBuiltin(); | 4025 return func->IsBuiltin(); |
4056 } | 4026 } |
4057 | 4027 |
4058 | 4028 |
4059 int Function::ScriptId() const { | 4029 int Function::ScriptId() const { |
4060 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4030 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
4061 if (!func->shared()->script()->IsScript()) { | 4031 if (!func->shared()->script()->IsScript()) return v8::Script::kNoScriptId; |
4062 return v8::UnboundScript::kNoScriptId; | |
4063 } | |
4064 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4032 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
4065 return script->id()->value(); | 4033 return script->id()->value(); |
4066 } | 4034 } |
4067 | 4035 |
4068 | 4036 |
4069 Local<v8::Value> Function::GetBoundFunction() const { | 4037 Local<v8::Value> Function::GetBoundFunction() const { |
4070 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4038 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
4071 if (!func->shared()->bound()) { | 4039 if (!func->shared()->bound()) { |
4072 return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate())); | 4040 return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate())); |
4073 } | 4041 } |
(...skipping 3413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7487 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7455 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7488 Address callback_address = | 7456 Address callback_address = |
7489 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7457 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7490 VMState<EXTERNAL> state(isolate); | 7458 VMState<EXTERNAL> state(isolate); |
7491 ExternalCallbackScope call_scope(isolate, callback_address); | 7459 ExternalCallbackScope call_scope(isolate, callback_address); |
7492 callback(info); | 7460 callback(info); |
7493 } | 7461 } |
7494 | 7462 |
7495 | 7463 |
7496 } } // namespace v8::internal | 7464 } } // namespace v8::internal |
OLD | NEW |