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