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

Side by Side Diff: src/api.cc

Issue 974213002: Extract ParseInfo from CompilationInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/ast-numbering.cc » ('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 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 if (!origin.ResourceIsEmbedderDebugScript().IsEmpty()) { 1915 if (!origin.ResourceIsEmbedderDebugScript().IsEmpty()) {
1916 script->set_is_embedder_debug_script( 1916 script->set_is_embedder_debug_script(
1917 origin.ResourceIsEmbedderDebugScript()->IsTrue()); 1917 origin.ResourceIsEmbedderDebugScript()->IsTrue());
1918 } 1918 }
1919 if (!origin.SourceMapUrl().IsEmpty()) { 1919 if (!origin.SourceMapUrl().IsEmpty()) {
1920 script->set_source_mapping_url( 1920 script->set_source_mapping_url(
1921 *Utils::OpenHandle(*(origin.SourceMapUrl()))); 1921 *Utils::OpenHandle(*(origin.SourceMapUrl())));
1922 } 1922 }
1923 1923
1924 source->info->set_script(script); 1924 source->info->set_script(script);
1925 source->info->SetContext(isolate->native_context()); 1925 source->info->set_context(isolate->native_context());
1926 1926
1927 // Do the parsing tasks which need to be done on the main thread. This will 1927 // Do the parsing tasks which need to be done on the main thread. This will
1928 // also handle parse errors. 1928 // also handle parse errors.
1929 source->parser->Internalize(isolate, script, 1929 source->parser->Internalize(isolate, script,
1930 source->info->function() == nullptr); 1930 source->info->function() == nullptr);
1931 source->parser->HandleSourceURLComments(isolate, script); 1931 source->parser->HandleSourceURLComments(isolate, script);
1932 1932
1933 i::Handle<i::SharedFunctionInfo> result; 1933 i::Handle<i::SharedFunctionInfo> result;
1934 if (source->info->function() != nullptr) { 1934 if (source->info->function() != nullptr) {
1935 // Parsing has succeeded. 1935 // Parsing has succeeded.
1936 result = 1936 result = i::Compiler::CompileStreamedScript(script, source->info.get(),
1937 i::Compiler::CompileStreamedScript(source->info.get(), str->length()); 1937 str->length());
1938 } 1938 }
1939 has_pending_exception = result.is_null(); 1939 has_pending_exception = result.is_null();
1940 if (has_pending_exception) isolate->ReportPendingMessages(); 1940 if (has_pending_exception) isolate->ReportPendingMessages();
1941 RETURN_ON_FAILED_EXECUTION(Script); 1941 RETURN_ON_FAILED_EXECUTION(Script);
1942 1942
1943 raw_result = *result; 1943 source->info->clear_script(); // because script goes out of scope.
1944 // The Handle<Script> will go out of scope soon; make sure CompilationInfo 1944 raw_result = *result; // TODO(titzer): use CloseAndEscape?
1945 // doesn't point to it. 1945 }
1946 source->info->set_script(i::Handle<i::Script>()); 1946
1947 } // HandleScope goes out of scope.
1948 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); 1947 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate);
1949 Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result); 1948 Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result);
1950 if (generic.IsEmpty()) return Local<Script>(); 1949 if (generic.IsEmpty()) return Local<Script>();
1951 RETURN_ESCAPED(generic->BindToCurrentContext()); 1950 RETURN_ESCAPED(generic->BindToCurrentContext());
1952 } 1951 }
1953 1952
1954 1953
1955 Local<Script> ScriptCompiler::Compile(Isolate* v8_isolate, 1954 Local<Script> ScriptCompiler::Compile(Isolate* v8_isolate,
1956 StreamedSource* v8_source, 1955 StreamedSource* v8_source,
1957 Handle<String> full_source_string, 1956 Handle<String> full_source_string,
(...skipping 6040 matching lines...) Expand 10 before | Expand all | Expand 10 after
7998 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7997 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7999 Address callback_address = 7998 Address callback_address =
8000 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7999 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8001 VMState<EXTERNAL> state(isolate); 8000 VMState<EXTERNAL> state(isolate);
8002 ExternalCallbackScope call_scope(isolate, callback_address); 8001 ExternalCallbackScope call_scope(isolate, callback_address);
8003 callback(info); 8002 callback(info);
8004 } 8003 }
8005 8004
8006 8005
8007 } } // namespace v8::internal 8006 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ast-numbering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698