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 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 : data(data_), length(length_), buffer_policy(buffer_policy_) {} | 1617 : data(data_), length(length_), buffer_policy(buffer_policy_) {} |
1618 | 1618 |
1619 | 1619 |
1620 ScriptCompiler::CachedData::~CachedData() { | 1620 ScriptCompiler::CachedData::~CachedData() { |
1621 if (buffer_policy == BufferOwned) { | 1621 if (buffer_policy == BufferOwned) { |
1622 delete[] data; | 1622 delete[] data; |
1623 } | 1623 } |
1624 } | 1624 } |
1625 | 1625 |
1626 | 1626 |
1627 ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin, | |
1628 CachedData* data) | |
1629 : source_string(string), | |
1630 resource_name(origin.ResourceName()), | |
1631 resource_line_offset(origin.ResourceLineOffset()), | |
1632 resource_column_offset(origin.ResourceColumnOffset()), | |
1633 resource_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin()), | |
1634 cached_data(data) {} | |
1635 | |
1636 | |
1637 ScriptCompiler::Source::Source(Local<String> string, | |
1638 CachedData* data) | |
1639 : source_string(string), cached_data(data) {} | |
1640 | |
1641 | |
1642 ScriptCompiler::Source::~Source() { | |
1643 delete cached_data; | |
1644 } | |
1645 | |
1646 | |
1647 const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData() | |
1648 const { | |
1649 return cached_data; | |
1650 } | |
1651 | |
1652 | |
1653 Local<Script> UnboundScript::BindToCurrentContext() { | 1627 Local<Script> UnboundScript::BindToCurrentContext() { |
1654 i::Handle<i::HeapObject> obj = | 1628 i::Handle<i::HeapObject> obj = |
1655 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 1629 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); |
1656 i::Handle<i::SharedFunctionInfo> | 1630 i::Handle<i::SharedFunctionInfo> |
1657 function_info(i::SharedFunctionInfo::cast(*obj), obj->GetIsolate()); | 1631 function_info(i::SharedFunctionInfo::cast(*obj), obj->GetIsolate()); |
1658 i::Handle<i::JSFunction> function = | 1632 i::Handle<i::JSFunction> function = |
1659 obj->GetIsolate()->factory()->NewFunctionFromSharedFunctionInfo( | 1633 obj->GetIsolate()->factory()->NewFunctionFromSharedFunctionInfo( |
1660 function_info, obj->GetIsolate()->global_context()); | 1634 function_info, obj->GetIsolate()->global_context()); |
1661 return ToApiHandle<Script>(function); | 1635 return ToApiHandle<Script>(function); |
1662 } | 1636 } |
(...skipping 5939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7602 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7576 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7603 Address callback_address = | 7577 Address callback_address = |
7604 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7578 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7605 VMState<EXTERNAL> state(isolate); | 7579 VMState<EXTERNAL> state(isolate); |
7606 ExternalCallbackScope call_scope(isolate, callback_address); | 7580 ExternalCallbackScope call_scope(isolate, callback_address); |
7607 callback(info); | 7581 callback(info); |
7608 } | 7582 } |
7609 | 7583 |
7610 | 7584 |
7611 } } // namespace v8::internal | 7585 } } // namespace v8::internal |
OLD | NEW |