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 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2187 source->parser->HandleSourceURLComments(isolate, script); | 2187 source->parser->HandleSourceURLComments(isolate, script); |
2188 | 2188 |
2189 i::Handle<i::SharedFunctionInfo> result; | 2189 i::Handle<i::SharedFunctionInfo> result; |
2190 if (source->info->literal() != nullptr) { | 2190 if (source->info->literal() != nullptr) { |
2191 // Parsing has succeeded. | 2191 // Parsing has succeeded. |
2192 result = i::Compiler::GetSharedFunctionInfoForStreamedScript( | 2192 result = i::Compiler::GetSharedFunctionInfoForStreamedScript( |
2193 script, source->info.get(), str->length()); | 2193 script, source->info.get(), str->length()); |
2194 } | 2194 } |
2195 has_pending_exception = result.is_null(); | 2195 has_pending_exception = result.is_null(); |
2196 if (has_pending_exception) isolate->ReportPendingMessages(); | 2196 if (has_pending_exception) isolate->ReportPendingMessages(); |
| 2197 |
| 2198 source->Release(); |
| 2199 |
2197 RETURN_ON_FAILED_EXECUTION(Script); | 2200 RETURN_ON_FAILED_EXECUTION(Script); |
2198 | 2201 |
2199 source->info->clear_script(); // because script goes out of scope. | |
2200 | |
2201 Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result); | 2202 Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result); |
2202 if (generic.IsEmpty()) return Local<Script>(); | 2203 if (generic.IsEmpty()) return Local<Script>(); |
2203 Local<Script> bound = generic->BindToCurrentContext(); | 2204 Local<Script> bound = generic->BindToCurrentContext(); |
2204 if (bound.IsEmpty()) return Local<Script>(); | 2205 if (bound.IsEmpty()) return Local<Script>(); |
2205 RETURN_ESCAPED(bound); | 2206 RETURN_ESCAPED(bound); |
2206 } | 2207 } |
2207 | 2208 |
2208 | 2209 |
2209 Local<Script> ScriptCompiler::Compile(Isolate* v8_isolate, | 2210 Local<Script> ScriptCompiler::Compile(Isolate* v8_isolate, |
2210 StreamedSource* v8_source, | 2211 StreamedSource* v8_source, |
(...skipping 6886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9097 Address callback_address = | 9098 Address callback_address = |
9098 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9099 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9099 VMState<EXTERNAL> state(isolate); | 9100 VMState<EXTERNAL> state(isolate); |
9100 ExternalCallbackScope call_scope(isolate, callback_address); | 9101 ExternalCallbackScope call_scope(isolate, callback_address); |
9101 callback(info); | 9102 callback(info); |
9102 } | 9103 } |
9103 | 9104 |
9104 | 9105 |
9105 } // namespace internal | 9106 } // namespace internal |
9106 } // namespace v8 | 9107 } // namespace v8 |
OLD | NEW |