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 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 if (!source->resource_line_offset.IsEmpty()) { | 1777 if (!source->resource_line_offset.IsEmpty()) { |
1778 line_offset = static_cast<int>(source->resource_line_offset->Value()); | 1778 line_offset = static_cast<int>(source->resource_line_offset->Value()); |
1779 } | 1779 } |
1780 if (!source->resource_column_offset.IsEmpty()) { | 1780 if (!source->resource_column_offset.IsEmpty()) { |
1781 column_offset = | 1781 column_offset = |
1782 static_cast<int>(source->resource_column_offset->Value()); | 1782 static_cast<int>(source->resource_column_offset->Value()); |
1783 } | 1783 } |
1784 if (!source->source_map_url.IsEmpty()) { | 1784 if (!source->source_map_url.IsEmpty()) { |
1785 source_map_url = Utils::OpenHandle(*(source->source_map_url)); | 1785 source_map_url = Utils::OpenHandle(*(source->source_map_url)); |
1786 } | 1786 } |
1787 result = i::Compiler::CompileScript( | 1787 result = i::Compiler::GetSharedFunctionInfoForScript( |
1788 str, name_obj, line_offset, column_offset, source->resource_options, | 1788 str, name_obj, line_offset, column_offset, source->resource_options, |
1789 source_map_url, isolate->native_context(), NULL, &script_data, options, | 1789 source_map_url, isolate->native_context(), NULL, &script_data, options, |
1790 i::NOT_NATIVES_CODE, is_module); | 1790 i::NOT_NATIVES_CODE, is_module); |
1791 has_pending_exception = result.is_null(); | 1791 has_pending_exception = result.is_null(); |
1792 if (has_pending_exception && script_data != NULL) { | 1792 if (has_pending_exception && script_data != NULL) { |
1793 // This case won't happen during normal operation; we have compiled | 1793 // This case won't happen during normal operation; we have compiled |
1794 // successfully and produced cached data, and but the second compilation | 1794 // successfully and produced cached data, and but the second compilation |
1795 // of the same source code fails. | 1795 // of the same source code fails. |
1796 delete script_data; | 1796 delete script_data; |
1797 script_data = NULL; | 1797 script_data = NULL; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2044 | 2044 |
2045 // Do the parsing tasks which need to be done on the main thread. This will | 2045 // Do the parsing tasks which need to be done on the main thread. This will |
2046 // also handle parse errors. | 2046 // also handle parse errors. |
2047 source->parser->Internalize(isolate, script, | 2047 source->parser->Internalize(isolate, script, |
2048 source->info->literal() == nullptr); | 2048 source->info->literal() == nullptr); |
2049 source->parser->HandleSourceURLComments(isolate, script); | 2049 source->parser->HandleSourceURLComments(isolate, script); |
2050 | 2050 |
2051 i::Handle<i::SharedFunctionInfo> result; | 2051 i::Handle<i::SharedFunctionInfo> result; |
2052 if (source->info->literal() != nullptr) { | 2052 if (source->info->literal() != nullptr) { |
2053 // Parsing has succeeded. | 2053 // Parsing has succeeded. |
2054 result = i::Compiler::CompileStreamedScript(script, source->info.get(), | 2054 result = i::Compiler::GetSharedFunctionInfoForStreamedScript( |
2055 str->length()); | 2055 script, source->info.get(), str->length()); |
2056 } | 2056 } |
2057 has_pending_exception = result.is_null(); | 2057 has_pending_exception = result.is_null(); |
2058 if (has_pending_exception) isolate->ReportPendingMessages(); | 2058 if (has_pending_exception) isolate->ReportPendingMessages(); |
2059 RETURN_ON_FAILED_EXECUTION(Script); | 2059 RETURN_ON_FAILED_EXECUTION(Script); |
2060 | 2060 |
2061 source->info->clear_script(); // because script goes out of scope. | 2061 source->info->clear_script(); // because script goes out of scope. |
2062 | 2062 |
2063 Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result); | 2063 Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result); |
2064 if (generic.IsEmpty()) return Local<Script>(); | 2064 if (generic.IsEmpty()) return Local<Script>(); |
2065 Local<Script> bound = generic->BindToCurrentContext(); | 2065 Local<Script> bound = generic->BindToCurrentContext(); |
(...skipping 6628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8694 Address callback_address = | 8694 Address callback_address = |
8695 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8695 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8696 VMState<EXTERNAL> state(isolate); | 8696 VMState<EXTERNAL> state(isolate); |
8697 ExternalCallbackScope call_scope(isolate, callback_address); | 8697 ExternalCallbackScope call_scope(isolate, callback_address); |
8698 callback(info); | 8698 callback(info); |
8699 } | 8699 } |
8700 | 8700 |
8701 | 8701 |
8702 } // namespace internal | 8702 } // namespace internal |
8703 } // namespace v8 | 8703 } // namespace v8 |
OLD | NEW |