| 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 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 } | 1866 } |
| 1867 if (!origin.ResourceIsSharedCrossOrigin().IsEmpty()) { | 1867 if (!origin.ResourceIsSharedCrossOrigin().IsEmpty()) { |
| 1868 script->set_is_shared_cross_origin( | 1868 script->set_is_shared_cross_origin( |
| 1869 origin.ResourceIsSharedCrossOrigin()->IsTrue()); | 1869 origin.ResourceIsSharedCrossOrigin()->IsTrue()); |
| 1870 } | 1870 } |
| 1871 if (!origin.ResourceIsEmbedderDebugScript().IsEmpty()) { | 1871 if (!origin.ResourceIsEmbedderDebugScript().IsEmpty()) { |
| 1872 script->set_is_embedder_debug_script( | 1872 script->set_is_embedder_debug_script( |
| 1873 origin.ResourceIsEmbedderDebugScript()->IsTrue()); | 1873 origin.ResourceIsEmbedderDebugScript()->IsTrue()); |
| 1874 } | 1874 } |
| 1875 source->info->set_script(script); | 1875 source->info->set_script(script); |
| 1876 source->info->SetContext(isolate->native_context()); | 1876 source->info->set_context(isolate->native_context()); |
| 1877 | 1877 |
| 1878 EXCEPTION_PREAMBLE(isolate); | 1878 EXCEPTION_PREAMBLE(isolate); |
| 1879 | 1879 |
| 1880 // Do the parsing tasks which need to be done on the main thread. This will | 1880 // Do the parsing tasks which need to be done on the main thread. This will |
| 1881 // also handle parse errors. | 1881 // also handle parse errors. |
| 1882 source->parser->Internalize(isolate, script, | 1882 source->parser->Internalize(isolate, script, |
| 1883 source->info->function() == NULL); | 1883 source->info->function() == NULL); |
| 1884 source->parser->HandleSourceURLComments(isolate, script); | 1884 source->parser->HandleSourceURLComments(isolate, script); |
| 1885 | 1885 |
| 1886 i::Handle<i::SharedFunctionInfo> result = | 1886 i::Handle<i::SharedFunctionInfo> result = |
| 1887 i::Handle<i::SharedFunctionInfo>::null(); | 1887 i::Handle<i::SharedFunctionInfo>::null(); |
| 1888 if (source->info->function() != NULL) { | 1888 if (source->info->function() != NULL) { |
| 1889 // Parsing has succeeded. | 1889 // Parsing has succeeded. |
| 1890 result = | 1890 result = i::Compiler::CompileStreamedScript(script, source->info.get(), |
| 1891 i::Compiler::CompileStreamedScript(source->info.get(), str->length()); | 1891 str->length()); |
| 1892 } | 1892 } |
| 1893 has_pending_exception = result.is_null(); | 1893 has_pending_exception = result.is_null(); |
| 1894 if (has_pending_exception) isolate->ReportPendingMessages(); | 1894 if (has_pending_exception) isolate->ReportPendingMessages(); |
| 1895 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); | 1895 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); |
| 1896 | 1896 |
| 1897 raw_result = *result; | 1897 source->info->clear_script(); // because script goes out of scope. |
| 1898 // The Handle<Script> will go out of scope soon; make sure CompilationInfo | 1898 raw_result = *result; // TODO(titzer): use CloseAndEscape? |
| 1899 // doesn't point to it. | 1899 } |
| 1900 source->info->set_script(i::Handle<i::Script>()); | 1900 |
| 1901 } // HandleScope goes out of scope. | |
| 1902 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); | 1901 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); |
| 1903 Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result); | 1902 Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result); |
| 1904 if (generic.IsEmpty()) { | 1903 if (generic.IsEmpty()) { |
| 1905 return Local<Script>(); | 1904 return Local<Script>(); |
| 1906 } | 1905 } |
| 1907 return generic->BindToCurrentContext(); | 1906 return generic->BindToCurrentContext(); |
| 1908 } | 1907 } |
| 1909 | 1908 |
| 1910 | 1909 |
| 1911 uint32_t ScriptCompiler::CachedDataVersionTag() { | 1910 uint32_t ScriptCompiler::CachedDataVersionTag() { |
| (...skipping 6094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8006 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8005 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 8007 Address callback_address = | 8006 Address callback_address = |
| 8008 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8007 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8009 VMState<EXTERNAL> state(isolate); | 8008 VMState<EXTERNAL> state(isolate); |
| 8010 ExternalCallbackScope call_scope(isolate, callback_address); | 8009 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8011 callback(info); | 8010 callback(info); |
| 8012 } | 8011 } |
| 8013 | 8012 |
| 8014 | 8013 |
| 8015 } } // namespace v8::internal | 8014 } } // namespace v8::internal |
| OLD | NEW |