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 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1995 script->set_source_mapping_url( | 1995 script->set_source_mapping_url( |
1996 *Utils::OpenHandle(*(origin.SourceMapUrl()))); | 1996 *Utils::OpenHandle(*(origin.SourceMapUrl()))); |
1997 } | 1997 } |
1998 | 1998 |
1999 source->info->set_script(script); | 1999 source->info->set_script(script); |
2000 source->info->set_context(isolate->native_context()); | 2000 source->info->set_context(isolate->native_context()); |
2001 | 2001 |
2002 // Do the parsing tasks which need to be done on the main thread. This will | 2002 // Do the parsing tasks which need to be done on the main thread. This will |
2003 // also handle parse errors. | 2003 // also handle parse errors. |
2004 source->parser->Internalize(isolate, script, | 2004 source->parser->Internalize(isolate, script, |
2005 source->info->function() == nullptr); | 2005 source->info->literal() == nullptr); |
2006 source->parser->HandleSourceURLComments(isolate, script); | 2006 source->parser->HandleSourceURLComments(isolate, script); |
2007 | 2007 |
2008 i::Handle<i::SharedFunctionInfo> result; | 2008 i::Handle<i::SharedFunctionInfo> result; |
2009 if (source->info->function() != nullptr) { | 2009 if (source->info->literal() != nullptr) { |
2010 // Parsing has succeeded. | 2010 // Parsing has succeeded. |
2011 result = i::Compiler::CompileStreamedScript(script, source->info.get(), | 2011 result = i::Compiler::CompileStreamedScript(script, source->info.get(), |
2012 str->length()); | 2012 str->length()); |
2013 } | 2013 } |
2014 has_pending_exception = result.is_null(); | 2014 has_pending_exception = result.is_null(); |
2015 if (has_pending_exception) isolate->ReportPendingMessages(); | 2015 if (has_pending_exception) isolate->ReportPendingMessages(); |
2016 RETURN_ON_FAILED_EXECUTION(Script); | 2016 RETURN_ON_FAILED_EXECUTION(Script); |
2017 | 2017 |
2018 source->info->clear_script(); // because script goes out of scope. | 2018 source->info->clear_script(); // because script goes out of scope. |
2019 | 2019 |
(...skipping 6388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8408 Address callback_address = | 8408 Address callback_address = |
8409 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8409 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8410 VMState<EXTERNAL> state(isolate); | 8410 VMState<EXTERNAL> state(isolate); |
8411 ExternalCallbackScope call_scope(isolate, callback_address); | 8411 ExternalCallbackScope call_scope(isolate, callback_address); |
8412 callback(info); | 8412 callback(info); |
8413 } | 8413 } |
8414 | 8414 |
8415 | 8415 |
8416 } // namespace internal | 8416 } // namespace internal |
8417 } // namespace v8 | 8417 } // namespace v8 |
OLD | NEW |