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 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 } | 2165 } |
2166 script->set_origin_options(origin.Options()); | 2166 script->set_origin_options(origin.Options()); |
2167 if (!origin.SourceMapUrl().IsEmpty()) { | 2167 if (!origin.SourceMapUrl().IsEmpty()) { |
2168 script->set_source_mapping_url( | 2168 script->set_source_mapping_url( |
2169 *Utils::OpenHandle(*(origin.SourceMapUrl()))); | 2169 *Utils::OpenHandle(*(origin.SourceMapUrl()))); |
2170 } | 2170 } |
2171 | 2171 |
2172 source->info->set_script(script); | 2172 source->info->set_script(script); |
2173 source->info->set_context(isolate->native_context()); | 2173 source->info->set_context(isolate->native_context()); |
2174 | 2174 |
| 2175 // Create a canonical handle scope before internalizing parsed values if |
| 2176 // compiling bytecode. This is required for off-thread bytecode generation. |
| 2177 std::unique_ptr<i::CanonicalHandleScope> canonical; |
| 2178 if (i::FLAG_ignition) canonical.reset(new i::CanonicalHandleScope(isolate)); |
| 2179 |
2175 // Do the parsing tasks which need to be done on the main thread. This will | 2180 // Do the parsing tasks which need to be done on the main thread. This will |
2176 // also handle parse errors. | 2181 // also handle parse errors. |
2177 source->parser->Internalize(isolate, script, | 2182 source->parser->Internalize(isolate, script, |
2178 source->info->literal() == nullptr); | 2183 source->info->literal() == nullptr); |
2179 source->parser->HandleSourceURLComments(isolate, script); | 2184 source->parser->HandleSourceURLComments(isolate, script); |
2180 | 2185 |
2181 i::Handle<i::SharedFunctionInfo> result; | 2186 i::Handle<i::SharedFunctionInfo> result; |
2182 if (source->info->literal() != nullptr) { | 2187 if (source->info->literal() != nullptr) { |
2183 // Parsing has succeeded. | 2188 // Parsing has succeeded. |
2184 result = i::Compiler::GetSharedFunctionInfoForStreamedScript( | 2189 result = i::Compiler::GetSharedFunctionInfoForStreamedScript( |
(...skipping 6804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8989 Address callback_address = | 8994 Address callback_address = |
8990 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8995 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8991 VMState<EXTERNAL> state(isolate); | 8996 VMState<EXTERNAL> state(isolate); |
8992 ExternalCallbackScope call_scope(isolate, callback_address); | 8997 ExternalCallbackScope call_scope(isolate, callback_address); |
8993 callback(info); | 8998 callback(info); |
8994 } | 8999 } |
8995 | 9000 |
8996 | 9001 |
8997 } // namespace internal | 9002 } // namespace internal |
8998 } // namespace v8 | 9003 } // namespace v8 |
OLD | NEW |