| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 HandleScopeClass, do_callback) \ | 90 HandleScopeClass, do_callback) \ |
| 91 if (IsExecutionTerminatingCheck(isolate)) { \ | 91 if (IsExecutionTerminatingCheck(isolate)) { \ |
| 92 return bailout_value; \ | 92 return bailout_value; \ |
| 93 } \ | 93 } \ |
| 94 HandleScopeClass handle_scope(isolate); \ | 94 HandleScopeClass handle_scope(isolate); \ |
| 95 CallDepthScope<do_callback> call_depth_scope(isolate, context); \ | 95 CallDepthScope<do_callback> call_depth_scope(isolate, context); \ |
| 96 LOG_API(isolate, class_name, function_name); \ | 96 LOG_API(isolate, class_name, function_name); \ |
| 97 ENTER_V8(isolate); \ | 97 ENTER_V8(isolate); \ |
| 98 bool has_pending_exception = false | 98 bool has_pending_exception = false |
| 99 | 99 |
| 100 #define PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(isolate, T) \ |
| 101 if (IsExecutionTerminatingCheck(isolate)) { \ |
| 102 return MaybeLocal<T>(); \ |
| 103 } \ |
| 104 InternalEscapableScope handle_scope(isolate); \ |
| 105 CallDepthScope<false> call_depth_scope(isolate, v8::Local<v8::Context>()); \ |
| 106 ENTER_V8(isolate); \ |
| 107 bool has_pending_exception = false |
| 108 |
| 100 #define PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \ | 109 #define PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \ |
| 101 bailout_value, HandleScopeClass, \ | 110 bailout_value, HandleScopeClass, \ |
| 102 do_callback) \ | 111 do_callback) \ |
| 103 auto isolate = context.IsEmpty() \ | 112 auto isolate = context.IsEmpty() \ |
| 104 ? i::Isolate::Current() \ | 113 ? i::Isolate::Current() \ |
| 105 : reinterpret_cast<i::Isolate*>(context->GetIsolate()); \ | 114 : reinterpret_cast<i::Isolate*>(context->GetIsolate()); \ |
| 106 PREPARE_FOR_EXECUTION_GENERIC(isolate, context, class_name, function_name, \ | 115 PREPARE_FOR_EXECUTION_GENERIC(isolate, context, class_name, function_name, \ |
| 107 bailout_value, HandleScopeClass, do_callback); | 116 bailout_value, HandleScopeClass, do_callback); |
| 108 | 117 |
| 109 #define PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( \ | 118 #define PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( \ |
| (...skipping 9029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9139 i::Handle<i::Object> script_obj( | 9148 i::Handle<i::Object> script_obj( |
| 9140 i::Handle<i::JSValue>::cast(script_wrapper)->value(), isolate); | 9149 i::Handle<i::JSValue>::cast(script_wrapper)->value(), isolate); |
| 9141 if (!script_obj->IsScript()) return {}; | 9150 if (!script_obj->IsScript()) return {}; |
| 9142 i::Handle<i::Script> script = i::Handle<i::Script>::cast(script_obj); | 9151 i::Handle<i::Script> script = i::Handle<i::Script>::cast(script_obj); |
| 9143 if (script->type() != i::Script::TYPE_WASM) return {}; | 9152 if (script->type() != i::Script::TYPE_WASM) return {}; |
| 9144 i::Handle<i::WasmCompiledModule> compiled_module( | 9153 i::Handle<i::WasmCompiledModule> compiled_module( |
| 9145 i::WasmCompiledModule::cast(script->wasm_compiled_module()), isolate); | 9154 i::WasmCompiledModule::cast(script->wasm_compiled_module()), isolate); |
| 9146 return i::wasm::DisassembleFunction(compiled_module, function_index); | 9155 return i::wasm::DisassembleFunction(compiled_module, function_index); |
| 9147 } | 9156 } |
| 9148 | 9157 |
| 9158 MaybeLocal<UnboundScript> DebugInterface::CompileInspectorScript( |
| 9159 Isolate* v8_isolate, Local<String> source) { |
| 9160 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 9161 PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(isolate, UnboundScript); |
| 9162 i::ScriptData* script_data = NULL; |
| 9163 i::Handle<i::String> str = Utils::OpenHandle(*source); |
| 9164 i::Handle<i::SharedFunctionInfo> result; |
| 9165 { |
| 9166 ScriptOriginOptions origin_options; |
| 9167 result = i::Compiler::GetSharedFunctionInfoForScript( |
| 9168 str, i::Handle<i::Object>(), 0, 0, origin_options, |
| 9169 i::Handle<i::Object>(), isolate->native_context(), NULL, &script_data, |
| 9170 ScriptCompiler::kNoCompileOptions, i::INSPECTOR_CODE, false); |
| 9171 has_pending_exception = result.is_null(); |
| 9172 RETURN_ON_FAILED_EXECUTION(UnboundScript); |
| 9173 } |
| 9174 RETURN_ESCAPED(ToApiHandle<UnboundScript>(result)); |
| 9175 } |
| 9176 |
| 9149 Local<String> CpuProfileNode::GetFunctionName() const { | 9177 Local<String> CpuProfileNode::GetFunctionName() const { |
| 9150 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 9178 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
| 9151 i::Isolate* isolate = node->isolate(); | 9179 i::Isolate* isolate = node->isolate(); |
| 9152 const i::CodeEntry* entry = node->entry(); | 9180 const i::CodeEntry* entry = node->entry(); |
| 9153 i::Handle<i::String> name = | 9181 i::Handle<i::String> name = |
| 9154 isolate->factory()->InternalizeUtf8String(entry->name()); | 9182 isolate->factory()->InternalizeUtf8String(entry->name()); |
| 9155 if (!entry->has_name_prefix()) { | 9183 if (!entry->has_name_prefix()) { |
| 9156 return ToApiHandle<String>(name); | 9184 return ToApiHandle<String>(name); |
| 9157 } else { | 9185 } else { |
| 9158 // We do not expect this to fail. Change this if it does. | 9186 // We do not expect this to fail. Change this if it does. |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9827 Address callback_address = | 9855 Address callback_address = |
| 9828 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9856 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 9829 VMState<EXTERNAL> state(isolate); | 9857 VMState<EXTERNAL> state(isolate); |
| 9830 ExternalCallbackScope call_scope(isolate, callback_address); | 9858 ExternalCallbackScope call_scope(isolate, callback_address); |
| 9831 callback(info); | 9859 callback(info); |
| 9832 } | 9860 } |
| 9833 | 9861 |
| 9834 | 9862 |
| 9835 } // namespace internal | 9863 } // namespace internal |
| 9836 } // namespace v8 | 9864 } // namespace v8 |
| OLD | NEW |