| 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 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2216 } | 2216 } |
| 2217 script->set_origin_options(origin.Options()); | 2217 script->set_origin_options(origin.Options()); |
| 2218 if (!origin.SourceMapUrl().IsEmpty()) { | 2218 if (!origin.SourceMapUrl().IsEmpty()) { |
| 2219 script->set_source_mapping_url( | 2219 script->set_source_mapping_url( |
| 2220 *Utils::OpenHandle(*(origin.SourceMapUrl()))); | 2220 *Utils::OpenHandle(*(origin.SourceMapUrl()))); |
| 2221 } | 2221 } |
| 2222 | 2222 |
| 2223 source->info->set_script(script); | 2223 source->info->set_script(script); |
| 2224 source->info->set_context(isolate->native_context()); | 2224 source->info->set_context(isolate->native_context()); |
| 2225 | 2225 |
| 2226 // Create a canonical handle scope before internalizing parsed values if | 2226 { |
| 2227 // compiling bytecode. This is required for off-thread bytecode generation. | 2227 // Create a canonical handle scope if compiling ignition bytecode. This is |
| 2228 std::unique_ptr<i::CanonicalHandleScope> canonical; | 2228 // required by the constant array builder to de-duplicate objects without |
| 2229 if (i::FLAG_ignition) canonical.reset(new i::CanonicalHandleScope(isolate)); | 2229 // dereferencing handles. |
| 2230 std::unique_ptr<i::CanonicalHandleScope> canonical; |
| 2231 if (i::FLAG_ignition) canonical.reset(new i::CanonicalHandleScope(isolate)); |
| 2230 | 2232 |
| 2231 // Do the parsing tasks which need to be done on the main thread. This will | 2233 // Do the parsing tasks which need to be done on the main thread. This will |
| 2232 // also handle parse errors. | 2234 // also handle parse errors. |
| 2233 source->parser->Internalize(isolate, script, | 2235 source->parser->Internalize(isolate, script, |
| 2234 source->info->literal() == nullptr); | 2236 source->info->literal() == nullptr); |
| 2237 } |
| 2235 source->parser->HandleSourceURLComments(isolate, script); | 2238 source->parser->HandleSourceURLComments(isolate, script); |
| 2236 | 2239 |
| 2237 i::Handle<i::SharedFunctionInfo> result; | 2240 i::Handle<i::SharedFunctionInfo> result; |
| 2238 if (source->info->literal() != nullptr) { | 2241 if (source->info->literal() != nullptr) { |
| 2239 // Parsing has succeeded. | 2242 // Parsing has succeeded. |
| 2240 result = i::Compiler::GetSharedFunctionInfoForStreamedScript( | 2243 result = i::Compiler::GetSharedFunctionInfoForStreamedScript( |
| 2241 script, source->info.get(), str->length()); | 2244 script, source->info.get(), str->length()); |
| 2242 } | 2245 } |
| 2243 has_pending_exception = result.is_null(); | 2246 has_pending_exception = result.is_null(); |
| 2244 if (has_pending_exception) isolate->ReportPendingMessages(); | 2247 if (has_pending_exception) isolate->ReportPendingMessages(); |
| (...skipping 7082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9327 Address callback_address = | 9330 Address callback_address = |
| 9328 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9331 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 9329 VMState<EXTERNAL> state(isolate); | 9332 VMState<EXTERNAL> state(isolate); |
| 9330 ExternalCallbackScope call_scope(isolate, callback_address); | 9333 ExternalCallbackScope call_scope(isolate, callback_address); |
| 9331 callback(info); | 9334 callback(info); |
| 9332 } | 9335 } |
| 9333 | 9336 |
| 9334 | 9337 |
| 9335 } // namespace internal | 9338 } // namespace internal |
| 9336 } // namespace v8 | 9339 } // namespace v8 |
| OLD | NEW |