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 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2260 static_cast<int>(origin.ResourceColumnOffset()->Value())); | 2260 static_cast<int>(origin.ResourceColumnOffset()->Value())); |
2261 } | 2261 } |
2262 script->set_origin_options(origin.Options()); | 2262 script->set_origin_options(origin.Options()); |
2263 if (!origin.SourceMapUrl().IsEmpty()) { | 2263 if (!origin.SourceMapUrl().IsEmpty()) { |
2264 script->set_source_mapping_url( | 2264 script->set_source_mapping_url( |
2265 *Utils::OpenHandle(*(origin.SourceMapUrl()))); | 2265 *Utils::OpenHandle(*(origin.SourceMapUrl()))); |
2266 } | 2266 } |
2267 | 2267 |
2268 source->info->set_script(script); | 2268 source->info->set_script(script); |
2269 | 2269 |
2270 { | 2270 // Do the parsing tasks which need to be done on the main thread. This will |
2271 // Create a canonical handle scope if compiling ignition bytecode. This is | 2271 // also handle parse errors. |
2272 // required by the constant array builder to de-duplicate objects without | 2272 source->parser->Internalize(isolate, script, |
2273 // dereferencing handles. | 2273 source->info->literal() == nullptr); |
2274 std::unique_ptr<i::CanonicalHandleScope> canonical; | |
2275 if (i::FLAG_ignition) canonical.reset(new i::CanonicalHandleScope(isolate)); | |
2276 | |
2277 // Do the parsing tasks which need to be done on the main thread. This will | |
2278 // also handle parse errors. | |
2279 source->parser->Internalize(isolate, script, | |
2280 source->info->literal() == nullptr); | |
2281 } | |
2282 source->parser->HandleSourceURLComments(isolate, script); | 2274 source->parser->HandleSourceURLComments(isolate, script); |
2283 | 2275 |
2284 i::Handle<i::SharedFunctionInfo> result; | 2276 i::Handle<i::SharedFunctionInfo> result; |
2285 if (source->info->literal() != nullptr) { | 2277 if (source->info->literal() != nullptr) { |
2286 // Parsing has succeeded. | 2278 // Parsing has succeeded. |
2287 result = i::Compiler::GetSharedFunctionInfoForStreamedScript( | 2279 result = i::Compiler::GetSharedFunctionInfoForStreamedScript( |
2288 script, source->info.get(), str->length()); | 2280 script, source->info.get(), str->length()); |
2289 } | 2281 } |
2290 has_pending_exception = result.is_null(); | 2282 has_pending_exception = result.is_null(); |
2291 if (has_pending_exception) isolate->ReportPendingMessages(); | 2283 if (has_pending_exception) isolate->ReportPendingMessages(); |
(...skipping 7208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9500 Address callback_address = | 9492 Address callback_address = |
9501 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9493 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9502 VMState<EXTERNAL> state(isolate); | 9494 VMState<EXTERNAL> state(isolate); |
9503 ExternalCallbackScope call_scope(isolate, callback_address); | 9495 ExternalCallbackScope call_scope(isolate, callback_address); |
9504 callback(info); | 9496 callback(info); |
9505 } | 9497 } |
9506 | 9498 |
9507 | 9499 |
9508 } // namespace internal | 9500 } // namespace internal |
9509 } // namespace v8 | 9501 } // namespace v8 |
OLD | NEW |