Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: src/api.cc

Issue 952893006: Take the ScriptOrigin into account for CompileFunctionInContext (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 i::Handle<i::SharedFunctionInfo> outer_info(context->closure()->shared(), 1698 i::Handle<i::SharedFunctionInfo> outer_info(context->closure()->shared(),
1699 isolate); 1699 isolate);
1700 for (size_t i = 0; i < context_extension_count; ++i) { 1700 for (size_t i = 0; i < context_extension_count; ++i) {
1701 i::Handle<i::JSObject> extension = 1701 i::Handle<i::JSObject> extension =
1702 Utils::OpenHandle(*context_extensions[i]); 1702 Utils::OpenHandle(*context_extensions[i]);
1703 i::Handle<i::JSFunction> closure(context->closure(), isolate); 1703 i::Handle<i::JSFunction> closure(context->closure(), isolate);
1704 context = isolate->factory()->NewWithContext(closure, context, extension); 1704 context = isolate->factory()->NewWithContext(closure, context, extension);
1705 } 1705 }
1706 1706
1707 EXCEPTION_PREAMBLE(isolate); 1707 EXCEPTION_PREAMBLE(isolate);
1708 i::Handle<i::Object> name_obj;
1709 int line_offset = 0;
1710 int column_offset = 0;
1711 bool is_embedder_debug_script = false;
1712 bool is_shared_cross_origin = false;
1713 if (!source->resource_name.IsEmpty()) {
1714 name_obj = Utils::OpenHandle(*(source->resource_name));
1715 }
1716 if (!source->resource_line_offset.IsEmpty()) {
1717 line_offset = static_cast<int>(source->resource_line_offset->Value());
1718 }
1719 if (!source->resource_column_offset.IsEmpty()) {
1720 column_offset = static_cast<int>(source->resource_column_offset->Value());
1721 }
1722 if (!source->resource_is_shared_cross_origin.IsEmpty()) {
1723 is_shared_cross_origin = source->resource_is_shared_cross_origin->IsTrue();
1724 }
1725 if (!source->resource_is_embedder_debug_script.IsEmpty()) {
1726 is_embedder_debug_script =
1727 source->resource_is_embedder_debug_script->IsTrue();
1728 }
1708 i::MaybeHandle<i::JSFunction> maybe_fun = i::Compiler::GetFunctionFromEval( 1729 i::MaybeHandle<i::JSFunction> maybe_fun = i::Compiler::GetFunctionFromEval(
1709 source_string, outer_info, context, i::SLOPPY, 1730 source_string, outer_info, context, i::SLOPPY,
1710 i::ONLY_SINGLE_FUNCTION_LITERAL, scope_position); 1731 i::ONLY_SINGLE_FUNCTION_LITERAL, line_offset,
1732 column_offset - scope_position, name_obj, is_embedder_debug_script,
1733 is_shared_cross_origin);
1711 i::Handle<i::JSFunction> fun; 1734 i::Handle<i::JSFunction> fun;
1712 has_pending_exception = !maybe_fun.ToHandle(&fun); 1735 has_pending_exception = !maybe_fun.ToHandle(&fun);
1713 EXCEPTION_BAILOUT_CHECK(isolate, Local<Function>()); 1736 EXCEPTION_BAILOUT_CHECK(isolate, Local<Function>());
1714 1737
1715 i::MaybeHandle<i::Object> result = i::Execution::Call( 1738 i::MaybeHandle<i::Object> result = i::Execution::Call(
1716 isolate, fun, Utils::OpenHandle(*v8_context->Global()), 0, NULL); 1739 isolate, fun, Utils::OpenHandle(*v8_context->Global()), 0, NULL);
1717 i::Handle<i::Object> final_result; 1740 i::Handle<i::Object> final_result;
1718 has_pending_exception = !result.ToHandle(&final_result); 1741 has_pending_exception = !result.ToHandle(&final_result);
1719 EXCEPTION_BAILOUT_CHECK(isolate, Local<Function>()); 1742 EXCEPTION_BAILOUT_CHECK(isolate, Local<Function>());
1720 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(final_result)); 1743 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(final_result));
(...skipping 6054 matching lines...) Expand 10 before | Expand all | Expand 10 after
7775 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7798 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7776 Address callback_address = 7799 Address callback_address =
7777 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7800 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7778 VMState<EXTERNAL> state(isolate); 7801 VMState<EXTERNAL> state(isolate);
7779 ExternalCallbackScope call_scope(isolate, callback_address); 7802 ExternalCallbackScope call_scope(isolate, callback_address);
7780 callback(info); 7803 callback(info);
7781 } 7804 }
7782 7805
7783 7806
7784 } } // namespace v8::internal 7807 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698