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 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 i::Handle<i::Context> context = Utils::OpenHandle(*v8_context); | 1908 i::Handle<i::Context> context = Utils::OpenHandle(*v8_context); |
1909 i::Handle<i::SharedFunctionInfo> outer_info(context->closure()->shared(), | 1909 i::Handle<i::SharedFunctionInfo> outer_info(context->closure()->shared(), |
1910 isolate); | 1910 isolate); |
1911 for (size_t i = 0; i < context_extension_count; ++i) { | 1911 for (size_t i = 0; i < context_extension_count; ++i) { |
1912 i::Handle<i::JSObject> extension = | 1912 i::Handle<i::JSObject> extension = |
1913 Utils::OpenHandle(*context_extensions[i]); | 1913 Utils::OpenHandle(*context_extensions[i]); |
1914 i::Handle<i::JSFunction> closure(context->closure(), isolate); | 1914 i::Handle<i::JSFunction> closure(context->closure(), isolate); |
1915 context = factory->NewWithContext(closure, context, extension); | 1915 context = factory->NewWithContext(closure, context, extension); |
1916 } | 1916 } |
1917 | 1917 |
| 1918 i::Handle<i::Object> name_obj; |
| 1919 int line_offset = 0; |
| 1920 int column_offset = 0; |
| 1921 if (!source->resource_name.IsEmpty()) { |
| 1922 name_obj = Utils::OpenHandle(*(source->resource_name)); |
| 1923 } |
| 1924 if (!source->resource_line_offset.IsEmpty()) { |
| 1925 line_offset = static_cast<int>(source->resource_line_offset->Value()); |
| 1926 } |
| 1927 if (!source->resource_column_offset.IsEmpty()) { |
| 1928 column_offset = static_cast<int>(source->resource_column_offset->Value()); |
| 1929 } |
1918 i::Handle<i::JSFunction> fun; | 1930 i::Handle<i::JSFunction> fun; |
1919 has_pending_exception = | 1931 has_pending_exception = !i::Compiler::GetFunctionFromEval( |
1920 !i::Compiler::GetFunctionFromEval( | 1932 source_string, outer_info, context, i::SLOPPY, |
1921 source_string, outer_info, context, i::SLOPPY, | 1933 i::ONLY_SINGLE_FUNCTION_LITERAL, line_offset, |
1922 i::ONLY_SINGLE_FUNCTION_LITERAL, scope_position).ToHandle(&fun); | 1934 column_offset - scope_position, name_obj, |
| 1935 source->resource_options).ToHandle(&fun); |
| 1936 if (has_pending_exception) { |
| 1937 isolate->ReportPendingMessages(); |
| 1938 } |
1923 RETURN_ON_FAILED_EXECUTION(Function); | 1939 RETURN_ON_FAILED_EXECUTION(Function); |
1924 | 1940 |
1925 i::Handle<i::Object> result; | 1941 i::Handle<i::Object> result; |
1926 has_pending_exception = | 1942 has_pending_exception = |
1927 !i::Execution::Call(isolate, fun, | 1943 !i::Execution::Call(isolate, fun, |
1928 Utils::OpenHandle(*v8_context->Global()), 0, | 1944 Utils::OpenHandle(*v8_context->Global()), 0, |
1929 nullptr).ToHandle(&result); | 1945 nullptr).ToHandle(&result); |
1930 RETURN_ON_FAILED_EXECUTION(Function); | 1946 RETURN_ON_FAILED_EXECUTION(Function); |
1931 RETURN_ESCAPED(Utils::ToLocal(i::Handle<i::JSFunction>::cast(result))); | 1947 RETURN_ESCAPED(Utils::ToLocal(i::Handle<i::JSFunction>::cast(result))); |
1932 } | 1948 } |
(...skipping 6479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8412 Address callback_address = | 8428 Address callback_address = |
8413 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8429 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8414 VMState<EXTERNAL> state(isolate); | 8430 VMState<EXTERNAL> state(isolate); |
8415 ExternalCallbackScope call_scope(isolate, callback_address); | 8431 ExternalCallbackScope call_scope(isolate, callback_address); |
8416 callback(info); | 8432 callback(info); |
8417 } | 8433 } |
8418 | 8434 |
8419 | 8435 |
8420 } // namespace internal | 8436 } // namespace internal |
8421 } // namespace v8 | 8437 } // namespace v8 |
OLD | NEW |