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 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 if (!source->resource_line_offset.IsEmpty()) { | 1762 if (!source->resource_line_offset.IsEmpty()) { |
1763 line_offset = static_cast<int>(source->resource_line_offset->Value()); | 1763 line_offset = static_cast<int>(source->resource_line_offset->Value()); |
1764 } | 1764 } |
1765 if (!source->resource_column_offset.IsEmpty()) { | 1765 if (!source->resource_column_offset.IsEmpty()) { |
1766 column_offset = | 1766 column_offset = |
1767 static_cast<int>(source->resource_column_offset->Value()); | 1767 static_cast<int>(source->resource_column_offset->Value()); |
1768 } | 1768 } |
1769 if (!source->source_map_url.IsEmpty()) { | 1769 if (!source->source_map_url.IsEmpty()) { |
1770 source_map_url = Utils::OpenHandle(*(source->source_map_url)); | 1770 source_map_url = Utils::OpenHandle(*(source->source_map_url)); |
1771 } | 1771 } |
1772 result = i::Compiler::CompileScript( | 1772 result = i::Compiler::GetSharedFunctionInfoForScript( |
1773 str, name_obj, line_offset, column_offset, source->resource_options, | 1773 str, name_obj, line_offset, column_offset, source->resource_options, |
1774 source_map_url, isolate->native_context(), NULL, &script_data, options, | 1774 source_map_url, isolate->native_context(), NULL, &script_data, options, |
1775 i::NOT_NATIVES_CODE, is_module); | 1775 i::NOT_NATIVES_CODE, is_module); |
1776 has_pending_exception = result.is_null(); | 1776 has_pending_exception = result.is_null(); |
1777 if (has_pending_exception && script_data != NULL) { | 1777 if (has_pending_exception && script_data != NULL) { |
1778 // This case won't happen during normal operation; we have compiled | 1778 // This case won't happen during normal operation; we have compiled |
1779 // successfully and produced cached data, and but the second compilation | 1779 // successfully and produced cached data, and but the second compilation |
1780 // of the same source code fails. | 1780 // of the same source code fails. |
1781 delete script_data; | 1781 delete script_data; |
1782 script_data = NULL; | 1782 script_data = NULL; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 | 2029 |
2030 // Do the parsing tasks which need to be done on the main thread. This will | 2030 // Do the parsing tasks which need to be done on the main thread. This will |
2031 // also handle parse errors. | 2031 // also handle parse errors. |
2032 source->parser->Internalize(isolate, script, | 2032 source->parser->Internalize(isolate, script, |
2033 source->info->literal() == nullptr); | 2033 source->info->literal() == nullptr); |
2034 source->parser->HandleSourceURLComments(isolate, script); | 2034 source->parser->HandleSourceURLComments(isolate, script); |
2035 | 2035 |
2036 i::Handle<i::SharedFunctionInfo> result; | 2036 i::Handle<i::SharedFunctionInfo> result; |
2037 if (source->info->literal() != nullptr) { | 2037 if (source->info->literal() != nullptr) { |
2038 // Parsing has succeeded. | 2038 // Parsing has succeeded. |
2039 result = i::Compiler::CompileStreamedScript(script, source->info.get(), | 2039 result = i::Compiler::GetSharedFunctionInfoForStreamedScript( |
2040 str->length()); | 2040 script, source->info.get(), str->length()); |
2041 } | 2041 } |
2042 has_pending_exception = result.is_null(); | 2042 has_pending_exception = result.is_null(); |
2043 if (has_pending_exception) isolate->ReportPendingMessages(); | 2043 if (has_pending_exception) isolate->ReportPendingMessages(); |
2044 RETURN_ON_FAILED_EXECUTION(Script); | 2044 RETURN_ON_FAILED_EXECUTION(Script); |
2045 | 2045 |
2046 source->info->clear_script(); // because script goes out of scope. | 2046 source->info->clear_script(); // because script goes out of scope. |
2047 | 2047 |
2048 Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result); | 2048 Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result); |
2049 if (generic.IsEmpty()) return Local<Script>(); | 2049 if (generic.IsEmpty()) return Local<Script>(); |
2050 Local<Script> bound = generic->BindToCurrentContext(); | 2050 Local<Script> bound = generic->BindToCurrentContext(); |
(...skipping 6569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8620 Address callback_address = | 8620 Address callback_address = |
8621 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8621 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8622 VMState<EXTERNAL> state(isolate); | 8622 VMState<EXTERNAL> state(isolate); |
8623 ExternalCallbackScope call_scope(isolate, callback_address); | 8623 ExternalCallbackScope call_scope(isolate, callback_address); |
8624 callback(info); | 8624 callback(info); |
8625 } | 8625 } |
8626 | 8626 |
8627 | 8627 |
8628 } // namespace internal | 8628 } // namespace internal |
8629 } // namespace v8 | 8629 } // namespace v8 |
OLD | NEW |