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 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2026 isolate); | 2026 isolate); |
2027 for (size_t i = 0; i < context_extension_count; ++i) { | 2027 for (size_t i = 0; i < context_extension_count; ++i) { |
2028 i::Handle<i::JSReceiver> extension = | 2028 i::Handle<i::JSReceiver> extension = |
2029 Utils::OpenHandle(*context_extensions[i]); | 2029 Utils::OpenHandle(*context_extensions[i]); |
2030 if (!extension->IsJSObject()) return Local<Function>(); | 2030 if (!extension->IsJSObject()) return Local<Function>(); |
2031 i::Handle<i::JSFunction> closure(context->closure(), isolate); | 2031 i::Handle<i::JSFunction> closure(context->closure(), isolate); |
2032 context = factory->NewWithContext(closure, context, extension); | 2032 context = factory->NewWithContext(closure, context, extension); |
2033 } | 2033 } |
2034 | 2034 |
2035 i::Handle<i::Object> name_obj; | 2035 i::Handle<i::Object> name_obj; |
| 2036 int eval_scope_position = 0; |
| 2037 int eval_position = i::RelocInfo::kNoPosition; |
2036 int line_offset = 0; | 2038 int line_offset = 0; |
2037 int column_offset = 0; | 2039 int column_offset = 0; |
2038 if (!source->resource_name.IsEmpty()) { | 2040 if (!source->resource_name.IsEmpty()) { |
2039 name_obj = Utils::OpenHandle(*(source->resource_name)); | 2041 name_obj = Utils::OpenHandle(*(source->resource_name)); |
2040 } | 2042 } |
2041 if (!source->resource_line_offset.IsEmpty()) { | 2043 if (!source->resource_line_offset.IsEmpty()) { |
2042 line_offset = static_cast<int>(source->resource_line_offset->Value()); | 2044 line_offset = static_cast<int>(source->resource_line_offset->Value()); |
2043 } | 2045 } |
2044 if (!source->resource_column_offset.IsEmpty()) { | 2046 if (!source->resource_column_offset.IsEmpty()) { |
2045 column_offset = static_cast<int>(source->resource_column_offset->Value()); | 2047 column_offset = static_cast<int>(source->resource_column_offset->Value()); |
2046 } | 2048 } |
2047 i::Handle<i::JSFunction> fun; | 2049 i::Handle<i::JSFunction> fun; |
2048 has_pending_exception = !i::Compiler::GetFunctionFromEval( | 2050 has_pending_exception = |
2049 source_string, outer_info, context, i::SLOPPY, | 2051 !i::Compiler::GetFunctionFromEval( |
2050 i::ONLY_SINGLE_FUNCTION_LITERAL, line_offset, | 2052 source_string, outer_info, context, i::SLOPPY, |
2051 column_offset - scope_position, name_obj, | 2053 i::ONLY_SINGLE_FUNCTION_LITERAL, eval_scope_position, eval_position, |
2052 source->resource_options).ToHandle(&fun); | 2054 line_offset, column_offset - scope_position, name_obj, |
| 2055 source->resource_options) |
| 2056 .ToHandle(&fun); |
2053 if (has_pending_exception) { | 2057 if (has_pending_exception) { |
2054 isolate->ReportPendingMessages(); | 2058 isolate->ReportPendingMessages(); |
2055 } | 2059 } |
2056 RETURN_ON_FAILED_EXECUTION(Function); | 2060 RETURN_ON_FAILED_EXECUTION(Function); |
2057 | 2061 |
2058 i::Handle<i::Object> result; | 2062 i::Handle<i::Object> result; |
2059 has_pending_exception = | 2063 has_pending_exception = |
2060 !i::Execution::Call(isolate, fun, | 2064 !i::Execution::Call(isolate, fun, |
2061 Utils::OpenHandle(*v8_context->Global()), 0, | 2065 Utils::OpenHandle(*v8_context->Global()), 0, |
2062 nullptr).ToHandle(&result); | 2066 nullptr).ToHandle(&result); |
(...skipping 6762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8825 Address callback_address = | 8829 Address callback_address = |
8826 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8830 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8827 VMState<EXTERNAL> state(isolate); | 8831 VMState<EXTERNAL> state(isolate); |
8828 ExternalCallbackScope call_scope(isolate, callback_address); | 8832 ExternalCallbackScope call_scope(isolate, callback_address); |
8829 callback(info); | 8833 callback(info); |
8830 } | 8834 } |
8831 | 8835 |
8832 | 8836 |
8833 } // namespace internal | 8837 } // namespace internal |
8834 } // namespace v8 | 8838 } // namespace v8 |
OLD | NEW |