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 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2025 isolate); | 2025 isolate); |
2026 for (size_t i = 0; i < context_extension_count; ++i) { | 2026 for (size_t i = 0; i < context_extension_count; ++i) { |
2027 i::Handle<i::JSReceiver> extension = | 2027 i::Handle<i::JSReceiver> extension = |
2028 Utils::OpenHandle(*context_extensions[i]); | 2028 Utils::OpenHandle(*context_extensions[i]); |
2029 if (!extension->IsJSObject()) return Local<Function>(); | 2029 if (!extension->IsJSObject()) return Local<Function>(); |
2030 i::Handle<i::JSFunction> closure(context->closure(), isolate); | 2030 i::Handle<i::JSFunction> closure(context->closure(), isolate); |
2031 context = factory->NewWithContext(closure, context, extension); | 2031 context = factory->NewWithContext(closure, context, extension); |
2032 } | 2032 } |
2033 | 2033 |
2034 i::Handle<i::Object> name_obj; | 2034 i::Handle<i::Object> name_obj; |
2035 int eval_position = 0; | |
2036 int line_offset = 0; | 2035 int line_offset = 0; |
2037 int column_offset = 0; | 2036 int column_offset = 0; |
2038 if (!source->resource_name.IsEmpty()) { | 2037 if (!source->resource_name.IsEmpty()) { |
2039 name_obj = Utils::OpenHandle(*(source->resource_name)); | 2038 name_obj = Utils::OpenHandle(*(source->resource_name)); |
2040 } | 2039 } |
2041 if (!source->resource_line_offset.IsEmpty()) { | 2040 if (!source->resource_line_offset.IsEmpty()) { |
2042 line_offset = static_cast<int>(source->resource_line_offset->Value()); | 2041 line_offset = static_cast<int>(source->resource_line_offset->Value()); |
2043 } | 2042 } |
2044 if (!source->resource_column_offset.IsEmpty()) { | 2043 if (!source->resource_column_offset.IsEmpty()) { |
2045 column_offset = static_cast<int>(source->resource_column_offset->Value()); | 2044 column_offset = static_cast<int>(source->resource_column_offset->Value()); |
2046 } | 2045 } |
2047 i::Handle<i::JSFunction> fun; | 2046 i::Handle<i::JSFunction> fun; |
2048 has_pending_exception = | 2047 has_pending_exception = !i::Compiler::GetFunctionFromEval( |
2049 !i::Compiler::GetFunctionFromEval( | 2048 source_string, outer_info, context, i::SLOPPY, |
2050 source_string, outer_info, context, i::SLOPPY, | 2049 i::ONLY_SINGLE_FUNCTION_LITERAL, line_offset, |
2051 i::ONLY_SINGLE_FUNCTION_LITERAL, eval_position, line_offset, | 2050 column_offset - scope_position, name_obj, |
2052 column_offset - scope_position, name_obj, source->resource_options) | 2051 source->resource_options).ToHandle(&fun); |
2053 .ToHandle(&fun); | |
2054 if (has_pending_exception) { | 2052 if (has_pending_exception) { |
2055 isolate->ReportPendingMessages(); | 2053 isolate->ReportPendingMessages(); |
2056 } | 2054 } |
2057 RETURN_ON_FAILED_EXECUTION(Function); | 2055 RETURN_ON_FAILED_EXECUTION(Function); |
2058 | 2056 |
2059 i::Handle<i::Object> result; | 2057 i::Handle<i::Object> result; |
2060 has_pending_exception = | 2058 has_pending_exception = |
2061 !i::Execution::Call(isolate, fun, | 2059 !i::Execution::Call(isolate, fun, |
2062 Utils::OpenHandle(*v8_context->Global()), 0, | 2060 Utils::OpenHandle(*v8_context->Global()), 0, |
2063 nullptr).ToHandle(&result); | 2061 nullptr).ToHandle(&result); |
(...skipping 6720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8784 Address callback_address = | 8782 Address callback_address = |
8785 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8783 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8786 VMState<EXTERNAL> state(isolate); | 8784 VMState<EXTERNAL> state(isolate); |
8787 ExternalCallbackScope call_scope(isolate, callback_address); | 8785 ExternalCallbackScope call_scope(isolate, callback_address); |
8788 callback(info); | 8786 callback(info); |
8789 } | 8787 } |
8790 | 8788 |
8791 | 8789 |
8792 } // namespace internal | 8790 } // namespace internal |
8793 } // namespace v8 | 8791 } // namespace v8 |
OLD | NEW |