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

Side by Side Diff: src/api.cc

Issue 199063003: New Compilation API, part 1, try 2 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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/api.h ('k') | src/d8.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 // 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
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 --- 1614 // --- S c r i p t s ---
1615 1615
1616 1616
1617 Local<Script> Script::New(v8::Handle<String> source, 1617 // Internally, UnboundScript is a SharedFunctionInfo, and Script is a
1618 v8::ScriptOrigin* origin, 1618 // JSFunction.
1619 v8::ScriptData* pre_data) { 1619
1620 i::Handle<i::String> str = Utils::OpenHandle(*source); 1620 ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin,
1621 i::Isolate* isolate = str->GetIsolate(); 1621 const CachedData& data)
1622 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>()); 1622 : source_string(string),
1623 LOG_API(isolate, "Script::New"); 1623 resource_name(origin.ResourceName()),
1624 ENTER_V8(isolate); 1624 resource_line_offset(origin.ResourceLineOffset()),
1625 i::SharedFunctionInfo* raw_result = NULL; 1625 resource_column_offset(origin.ResourceColumnOffset()),
1626 { i::HandleScope scope(isolate); 1626 resource_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin()),
1627 i::Handle<i::Object> name_obj; 1627 cached_data(data) {}
1628 int line_offset = 0; 1628
1629 int column_offset = 0; 1629
1630 bool is_shared_cross_origin = false; 1630 ScriptCompiler::Source::Source(Local<String> string,
1631 if (origin != NULL) { 1631 const CachedData& data)
1632 if (!origin->ResourceName().IsEmpty()) { 1632 : source_string(string), cached_data(data) {}
1633 name_obj = Utils::OpenHandle(*origin->ResourceName()); 1633
1634 } 1634
1635 if (!origin->ResourceLineOffset().IsEmpty()) { 1635 Local<Script> UnboundScript::BindToCurrentContext() {
1636 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); 1636 i::Handle<i::HeapObject> obj =
1637 } 1637 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
1638 if (!origin->ResourceColumnOffset().IsEmpty()) { 1638 i::Handle<i::SharedFunctionInfo>
1639 column_offset = 1639 function_info(i::SharedFunctionInfo::cast(*obj), obj->GetIsolate());
1640 static_cast<int>(origin->ResourceColumnOffset()->Value()); 1640 i::Handle<i::JSFunction> function =
1641 } 1641 obj->GetIsolate()->factory()->NewFunctionFromSharedFunctionInfo(
1642 if (!origin->ResourceIsSharedCrossOrigin().IsEmpty()) { 1642 function_info, obj->GetIsolate()->global_context());
1643 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); 1643 return ToApiHandle<Script>(function);
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);
1674 } 1644 }
1675 1645
1676 1646
1677 Local<Script> Script::New(v8::Handle<String> source, 1647 int UnboundScript::GetId() {
1678 v8::Handle<Value> file_name) { 1648 i::Handle<i::HeapObject> obj =
1679 ScriptOrigin origin(file_name); 1649 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
1680 return New(source, &origin); 1650 i::Isolate* isolate = obj->GetIsolate();
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 }
1681 } 1660 }
1682 1661
1683 1662
1684 Local<Script> Script::Compile(v8::Handle<String> source, 1663 int UnboundScript::GetLineNumber(int code_pos) {
1685 v8::ScriptOrigin* origin, 1664 i::Handle<i::HeapObject> obj =
1686 v8::ScriptData* pre_data) { 1665 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
1687 i::Handle<i::String> str = Utils::OpenHandle(*source); 1666 i::Isolate* isolate = obj->GetIsolate();
1688 i::Isolate* isolate = str->GetIsolate(); 1667 ON_BAILOUT(isolate, "v8::UnboundScript::GetLineNumber()", return -1);
1689 ON_BAILOUT(isolate, "v8::Script::Compile()", return Local<Script>()); 1668 LOG_API(isolate, "UnboundScript::GetLineNumber");
1690 LOG_API(isolate, "Script::Compile"); 1669 if (obj->IsScript()) {
1691 ENTER_V8(isolate); 1670 i::Handle<i::Script> script(i::Script::cast(*obj));
1692 Local<Script> generic = New(source, origin, pre_data); 1671 return i::GetScriptLineNumber(script, code_pos);
1693 if (generic.IsEmpty()) 1672 } else {
1694 return generic; 1673 return -1;
1695 i::Handle<i::Object> obj = Utils::OpenHandle(*generic); 1674 }
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);
1703 } 1675 }
1704 1676
1705 1677
1706 Local<Script> Script::Compile(v8::Handle<String> source, 1678 Handle<Value> UnboundScript::GetScriptName() {
1707 v8::Handle<Value> file_name) { 1679 i::Handle<i::HeapObject> obj =
1708 ScriptOrigin origin(file_name); 1680 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
1709 return Compile(source, &origin); 1681 i::Isolate* isolate = obj->GetIsolate();
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 }
1710 } 1691 }
1711 1692
1712 1693
1713 Local<Value> Script::Run() { 1694 Local<Value> Script::Run() {
1714 // If execution is terminating, Compile(script)->Run() requires this check. 1695 // If execution is terminating, Compile(..)->Run() requires this
1696 // check.
1715 if (this == NULL) return Local<Value>(); 1697 if (this == NULL) return Local<Value>();
1716 i::Handle<i::HeapObject> obj = 1698 i::Handle<i::HeapObject> obj =
1717 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); 1699 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
1718 i::Isolate* isolate = obj->GetIsolate(); 1700 i::Isolate* isolate = obj->GetIsolate();
1719 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); 1701 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>());
1720 LOG_API(isolate, "Script::Run"); 1702 LOG_API(isolate, "Script::Run");
1721 ENTER_V8(isolate); 1703 ENTER_V8(isolate);
1722 i::Logger::TimerEventScope timer_scope( 1704 i::Logger::TimerEventScope timer_scope(
1723 isolate, i::Logger::TimerEventScope::v8_execute); 1705 isolate, i::Logger::TimerEventScope::v8_execute);
1724 i::Object* raw_result = NULL; 1706 i::Object* raw_result = NULL;
1725 { 1707 {
1726 i::HandleScope scope(isolate); 1708 i::HandleScope scope(isolate);
1727 i::Handle<i::JSFunction> fun; 1709 i::Handle<i::JSFunction> fun =
1728 if (obj->IsSharedFunctionInfo()) { 1710 i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate);
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 }
1736 EXCEPTION_PREAMBLE(isolate); 1711 EXCEPTION_PREAMBLE(isolate);
1737 i::Handle<i::Object> receiver( 1712 i::Handle<i::Object> receiver(
1738 isolate->context()->global_proxy(), isolate); 1713 isolate->context()->global_proxy(), isolate);
1739 i::Handle<i::Object> result = i::Execution::Call( 1714 i::Handle<i::Object> result = i::Execution::Call(
1740 isolate, fun, receiver, 0, NULL, &has_pending_exception); 1715 isolate, fun, receiver, 0, NULL, &has_pending_exception);
1741 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); 1716 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>());
1742 raw_result = *result; 1717 raw_result = *result;
1743 } 1718 }
1744 i::Handle<i::Object> result(raw_result, isolate); 1719 i::Handle<i::Object> result(raw_result, isolate);
1745 return Utils::ToLocal(result); 1720 return Utils::ToLocal(result);
1746 } 1721 }
1747 1722
1748 1723
1749 static i::Handle<i::SharedFunctionInfo> OpenScript(Script* script) { 1724 Local<UnboundScript> Script::GetUnboundScript() {
1750 i::Handle<i::Object> obj = Utils::OpenHandle(script); 1725 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1751 i::Handle<i::SharedFunctionInfo> result; 1726 return ToApiHandle<UnboundScript>(
1752 if (obj->IsSharedFunctionInfo()) { 1727 i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared()));
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;
1760 } 1728 }
1761 1729
1762 1730
1763 int Script::GetId() { 1731 Local<UnboundScript> ScriptCompiler::CompileUnbound(
1764 i::Handle<i::HeapObject> obj = 1732 Isolate* v8_isolate,
1765 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); 1733 const Source& source,
1766 i::Isolate* isolate = obj->GetIsolate(); 1734 CompileOptions options) {
1767 ON_BAILOUT(isolate, "v8::Script::Id()", return -1); 1735 // FIXME(marja): This function cannot yet create cached data (if options |
1768 LOG_API(isolate, "Script::Id"); 1736 // produce_data_to_cache is true), but the PreCompile function is still there
1769 { 1737 // for doing it.
1770 i::HandleScope scope(isolate); 1738 i::Handle<i::String> str = Utils::OpenHandle(*(source.source_string));
1771 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this); 1739 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
1772 i::Handle<i::Script> script(i::Script::cast(function_info->script())); 1740 ON_BAILOUT(isolate, "v8::ScriptCompiler::CompileUnbound()",
1773 return script->id()->value(); 1741 return Local<UnboundScript>());
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;
1774 } 1795 }
1796 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate);
1797 return ToApiHandle<UnboundScript>(result);
1775 } 1798 }
1776 1799
1777 1800
1778 int Script::GetLineNumber(int code_pos) { 1801 Local<Script> ScriptCompiler::Compile(
1779 i::Handle<i::HeapObject> obj = 1802 Isolate* v8_isolate,
1780 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); 1803 const Source& source,
1781 i::Isolate* isolate = obj->GetIsolate(); 1804 CompileOptions options) {
1782 ON_BAILOUT(isolate, "v8::Script::GetLineNumber()", return -1); 1805 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
1783 LOG_API(isolate, "Script::GetLineNumber"); 1806 ON_BAILOUT(isolate, "v8::ScriptCompiler::Compile()",
1784 if (obj->IsScript()) { 1807 return Local<Script>());
1785 i::Handle<i::Script> script = i::Handle<i::Script>(i::Script::cast(*obj)); 1808 LOG_API(isolate, "ScriptCompiler::CompiletBound()");
1786 return i::GetScriptLineNumber(script, code_pos); 1809 ENTER_V8(isolate);
1787 } else { 1810 Local<UnboundScript> generic =
1788 return -1; 1811 CompileUnbound(v8_isolate, source, options);
1789 } 1812 if (generic.IsEmpty()) return Local<Script>();
1813 return generic->BindToCurrentContext();
1790 } 1814 }
1791 1815
1792 1816
1793 Handle<Value> Script::GetScriptName() { 1817 Local<Script> Script::Compile(v8::Handle<String> source,
1794 i::Handle<i::HeapObject> obj = 1818 v8::ScriptOrigin* origin,
1795 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); 1819 ScriptData* script_data) {
1796 i::Isolate* isolate = obj->GetIsolate(); 1820 i::Handle<i::String> str = Utils::OpenHandle(*source);
1797 ON_BAILOUT(isolate, "v8::Script::GetName()", return Handle<String>()); 1821 ScriptCompiler::CachedData cached_data;
1798 LOG_API(isolate, "Script::GetName"); 1822 if (script_data) {
1799 if (obj->IsScript()) { 1823 cached_data = ScriptCompiler::CachedData(
1800 i::Object* name = i::Script::cast(*obj)->name(); 1824 reinterpret_cast<const uint8_t*>(script_data->Data()),
1801 return Utils::ToLocal(i::Handle<i::Object>(name, isolate)); 1825 script_data->Length());
1802 } else {
1803 return Handle<String>();
1804 } 1826 }
1827 if (origin) {
1828 return ScriptCompiler::Compile(
1829 reinterpret_cast<v8::Isolate*>(str->GetIsolate()),
1830 ScriptCompiler::Source(source, *origin, cached_data));
1831 }
1832 return ScriptCompiler::Compile(
1833 reinterpret_cast<v8::Isolate*>(str->GetIsolate()),
1834 ScriptCompiler::Source(source, cached_data));
1805 } 1835 }
1806 1836
1807 1837
1838 Local<Script> Script::Compile(v8::Handle<String> source,
1839 v8::Handle<String> file_name) {
1840 ScriptOrigin origin(file_name);
1841 return Compile(source, &origin);
1842 }
1843
1844
1808 // --- E x c e p t i o n s --- 1845 // --- E x c e p t i o n s ---
1809 1846
1810 1847
1811 v8::TryCatch::TryCatch() 1848 v8::TryCatch::TryCatch()
1812 : isolate_(i::Isolate::Current()), 1849 : isolate_(i::Isolate::Current()),
1813 next_(isolate_->try_catch_handler_address()), 1850 next_(isolate_->try_catch_handler_address()),
1814 is_verbose_(false), 1851 is_verbose_(false),
1815 can_continue_(true), 1852 can_continue_(true),
1816 capture_message_(true), 1853 capture_message_(true),
1817 rethrow_(false), 1854 rethrow_(false),
(...skipping 2203 matching lines...) Expand 10 before | Expand all | Expand 10 after
4021 4058
4022 4059
4023 bool Function::IsBuiltin() const { 4060 bool Function::IsBuiltin() const {
4024 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); 4061 i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
4025 return func->IsBuiltin(); 4062 return func->IsBuiltin();
4026 } 4063 }
4027 4064
4028 4065
4029 int Function::ScriptId() const { 4066 int Function::ScriptId() const {
4030 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); 4067 i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
4031 if (!func->shared()->script()->IsScript()) return v8::Script::kNoScriptId; 4068 if (!func->shared()->script()->IsScript()) {
4069 return v8::UnboundScript::kNoScriptId;
4070 }
4032 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); 4071 i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
4033 return script->id()->value(); 4072 return script->id()->value();
4034 } 4073 }
4035 4074
4036 4075
4037 Local<v8::Value> Function::GetBoundFunction() const { 4076 Local<v8::Value> Function::GetBoundFunction() const {
4038 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); 4077 i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
4039 if (!func->shared()->bound()) { 4078 if (!func->shared()->bound()) {
4040 return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate())); 4079 return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate()));
4041 } 4080 }
(...skipping 3413 matching lines...) Expand 10 before | Expand all | Expand 10 after
7455 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7494 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7456 Address callback_address = 7495 Address callback_address =
7457 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7496 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7458 VMState<EXTERNAL> state(isolate); 7497 VMState<EXTERNAL> state(isolate);
7459 ExternalCallbackScope call_scope(isolate, callback_address); 7498 ExternalCallbackScope call_scope(isolate, callback_address);
7460 callback(info); 7499 callback(info);
7461 } 7500 }
7462 7501
7463 7502
7464 } } // namespace v8::internal 7503 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.h ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698