Commit 8890bb21 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[no-wasm] Remove wasm debugging support

This removes all wasm includes from src/debug and src/inspector if
webassembly is disabled (v8_enable_webassembly=false). It also removes
the definition of {WasmValueObject} and {v8::debug::WasmScript}.
This will allow to later fully exclude the src/wasm directory from
compilation (once other components are fixed).

R=bmeurer@chromium.org, machenbach@chromium.org

Bug: v8:11238
Change-Id: I41a1d83d01fbb6c015cdfd6cc063bad90052505d
Cq-Include-Trybots: luci.v8.try:v8_linux64_no_wasm_compile_rel
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2726506Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73138}
parent 1dd8624b
...@@ -1360,7 +1360,6 @@ torque_files = [ ...@@ -1360,7 +1360,6 @@ torque_files = [
"src/builtins/typed-array.tq", "src/builtins/typed-array.tq",
"src/builtins/wasm.tq", "src/builtins/wasm.tq",
"src/builtins/weak-ref.tq", "src/builtins/weak-ref.tq",
"src/debug/debug-wasm-objects.tq",
"src/ic/handler-configuration.tq", "src/ic/handler-configuration.tq",
"src/objects/allocation-site.tq", "src/objects/allocation-site.tq",
"src/objects/api-callbacks.tq", "src/objects/api-callbacks.tq",
...@@ -1441,6 +1440,10 @@ if (v8_enable_i18n_support) { ...@@ -1441,6 +1440,10 @@ if (v8_enable_i18n_support) {
] ]
} }
if (v8_enable_webassembly) {
torque_files += [ "src/debug/debug-wasm-objects.tq" ]
}
# Template for running torque # Template for running torque
# When building with v8_verify_torque_generation_invariance=true we need # When building with v8_verify_torque_generation_invariance=true we need
# to be able to run torque for both 32 and 64 bits in the same build # to be able to run torque for both 32 and 64 bits in the same build
...@@ -2427,8 +2430,6 @@ v8_header_set("v8_internal_headers") { ...@@ -2427,8 +2430,6 @@ v8_header_set("v8_internal_headers") {
"src/debug/debug-scopes.h", "src/debug/debug-scopes.h",
"src/debug/debug-stack-trace-iterator.h", "src/debug/debug-stack-trace-iterator.h",
"src/debug/debug-type-profile.h", "src/debug/debug-type-profile.h",
"src/debug/debug-wasm-objects-inl.h",
"src/debug/debug-wasm-objects.h",
"src/debug/debug.h", "src/debug/debug.h",
"src/debug/interface-types.h", "src/debug/interface-types.h",
"src/debug/liveedit.h", "src/debug/liveedit.h",
...@@ -3015,6 +3016,8 @@ v8_header_set("v8_internal_headers") { ...@@ -3015,6 +3016,8 @@ v8_header_set("v8_internal_headers") {
"src/asmjs/asm-parser.h", "src/asmjs/asm-parser.h",
"src/asmjs/asm-scanner.h", "src/asmjs/asm-scanner.h",
"src/asmjs/asm-types.h", "src/asmjs/asm-types.h",
"src/debug/debug-wasm-objects-inl.h",
"src/debug/debug-wasm-objects.h",
] ]
} }
...@@ -3557,7 +3560,6 @@ v8_source_set("v8_base_without_compiler") { ...@@ -3557,7 +3560,6 @@ v8_source_set("v8_base_without_compiler") {
"src/debug/debug-scopes.cc", "src/debug/debug-scopes.cc",
"src/debug/debug-stack-trace-iterator.cc", "src/debug/debug-stack-trace-iterator.cc",
"src/debug/debug-type-profile.cc", "src/debug/debug-type-profile.cc",
"src/debug/debug-wasm-objects.cc",
"src/debug/debug.cc", "src/debug/debug.cc",
"src/debug/liveedit.cc", "src/debug/liveedit.cc",
"src/deoptimizer/deoptimize-reason.cc", "src/deoptimizer/deoptimize-reason.cc",
...@@ -3929,6 +3931,7 @@ v8_source_set("v8_base_without_compiler") { ...@@ -3929,6 +3931,7 @@ v8_source_set("v8_base_without_compiler") {
"src/asmjs/asm-parser.cc", "src/asmjs/asm-parser.cc",
"src/asmjs/asm-scanner.cc", "src/asmjs/asm-scanner.cc",
"src/asmjs/asm-types.cc", "src/asmjs/asm-types.cc",
"src/debug/debug-wasm-objects.cc",
] ]
} }
......
...@@ -263,7 +263,9 @@ Type::bitset BitsetType::Lub(const MapRefLike& map) { ...@@ -263,7 +263,9 @@ Type::bitset BitsetType::Lub(const MapRefLike& map) {
case WASM_MODULE_OBJECT_TYPE: case WASM_MODULE_OBJECT_TYPE:
case WASM_STRUCT_TYPE: case WASM_STRUCT_TYPE:
case WASM_TABLE_OBJECT_TYPE: case WASM_TABLE_OBJECT_TYPE:
#if V8_ENABLE_WEBASSEMBLY
case WASM_VALUE_OBJECT_TYPE: case WASM_VALUE_OBJECT_TYPE:
#endif // V8_ENABLE_WEBASSEMBLY
case WEAK_CELL_TYPE: case WEAK_CELL_TYPE:
DCHECK(!map.is_callable()); DCHECK(!map.is_callable());
DCHECK(!map.is_undetectable()); DCHECK(!map.is_undetectable());
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "src/common/globals.h" #include "src/common/globals.h"
#include "src/debug/debug-frames.h" #include "src/debug/debug-frames.h"
#include "src/debug/debug-scopes.h" #include "src/debug/debug-scopes.h"
#include "src/debug/debug-wasm-objects.h"
#include "src/debug/debug.h" #include "src/debug/debug.h"
#include "src/execution/frames-inl.h" #include "src/execution/frames-inl.h"
#include "src/execution/isolate-inl.h" #include "src/execution/isolate-inl.h"
...@@ -19,6 +18,10 @@ ...@@ -19,6 +18,10 @@
#include "src/objects/contexts.h" #include "src/objects/contexts.h"
#include "src/snapshot/snapshot.h" #include "src/snapshot/snapshot.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/debug/debug-wasm-objects.h"
#endif // V8_ENABLE_WEBASSEMBLY
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -77,26 +80,8 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate, ...@@ -77,26 +80,8 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate,
// Get the frame where the debugging is performed. // Get the frame where the debugging is performed.
StackTraceFrameIterator it(isolate, frame_id); StackTraceFrameIterator it(isolate, frame_id);
if (it.is_javascript()) { #if V8_ENABLE_WEBASSEMBLY
JavaScriptFrame* frame = it.javascript_frame(); if (it.is_wasm()) {
// This is not a lot different than DebugEvaluate::Global, except that
// variables accessible by the function we are evaluating from are
// materialized and included on top of the native context. Changes to
// the materialized object are written back afterwards.
// Note that the native context is taken from the original context chain,
// which may not be the current native context of the isolate.
ContextBuilder context_builder(isolate, frame, inlined_jsframe_index);
if (isolate->has_pending_exception()) return {};
Handle<Context> context = context_builder.evaluation_context();
Handle<JSObject> receiver(context->global_proxy(), isolate);
MaybeHandle<Object> maybe_result =
Evaluate(isolate, context_builder.outer_info(), context, receiver,
source, throw_on_side_effect);
if (!maybe_result.is_null()) context_builder.UpdateValues();
return maybe_result;
} else {
CHECK(it.is_wasm());
WasmFrame* frame = WasmFrame::cast(it.frame()); WasmFrame* frame = WasmFrame::cast(it.frame());
Handle<SharedFunctionInfo> outer_info( Handle<SharedFunctionInfo> outer_info(
isolate->native_context()->empty_function().shared(), isolate); isolate->native_context()->empty_function().shared(), isolate);
...@@ -108,6 +93,26 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate, ...@@ -108,6 +93,26 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate,
return Evaluate(isolate, outer_info, context, context_extension, source, return Evaluate(isolate, outer_info, context, context_extension, source,
throw_on_side_effect); throw_on_side_effect);
} }
#endif // V8_ENABLE_WEBASSEMBLY
CHECK(it.is_javascript());
JavaScriptFrame* frame = it.javascript_frame();
// This is not a lot different than DebugEvaluate::Global, except that
// variables accessible by the function we are evaluating from are
// materialized and included on top of the native context. Changes to
// the materialized object are written back afterwards.
// Note that the native context is taken from the original context chain,
// which may not be the current native context of the isolate.
ContextBuilder context_builder(isolate, frame, inlined_jsframe_index);
if (isolate->has_pending_exception()) return {};
Handle<Context> context = context_builder.evaluation_context();
Handle<JSObject> receiver(context->global_proxy(), isolate);
MaybeHandle<Object> maybe_result =
Evaluate(isolate, context_builder.outer_info(), context, receiver, source,
throw_on_side_effect);
if (!maybe_result.is_null()) context_builder.UpdateValues();
return maybe_result;
} }
MaybeHandle<Object> DebugEvaluate::WithTopmostArguments(Isolate* isolate, MaybeHandle<Object> DebugEvaluate::WithTopmostArguments(Isolate* isolate,
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "src/builtins/accessors.h" #include "src/builtins/accessors.h"
#include "src/execution/frames-inl.h" #include "src/execution/frames-inl.h"
#include "src/wasm/wasm-objects-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -9,12 +9,16 @@ ...@@ -9,12 +9,16 @@
#include "src/debug/debug-evaluate.h" #include "src/debug/debug-evaluate.h"
#include "src/debug/debug-property-iterator.h" #include "src/debug/debug-property-iterator.h"
#include "src/debug/debug-type-profile.h" #include "src/debug/debug-type-profile.h"
#include "src/debug/debug-wasm-objects-inl.h"
#include "src/debug/debug.h" #include "src/debug/debug.h"
#include "src/execution/vm-state-inl.h" #include "src/execution/vm-state-inl.h"
#include "src/objects/js-generator-inl.h" #include "src/objects/js-generator-inl.h"
#include "src/regexp/regexp-stack.h" #include "src/regexp/regexp-stack.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/debug/debug-wasm-objects-inl.h"
#include "src/wasm/wasm-engine.h"
#endif // V8_ENABLE_WEBASSEMBLY
// Has to be the last include (doesn't have include guards): // Has to be the last include (doesn't have include guards):
#include "src/api/api-macros.h" #include "src/api/api-macros.h"
...@@ -374,11 +378,13 @@ bool Script::GetPossibleBreakpoints( ...@@ -374,11 +378,13 @@ bool Script::GetPossibleBreakpoints(
std::vector<BreakLocation>* locations) const { std::vector<BreakLocation>* locations) const {
CHECK(!start.IsEmpty()); CHECK(!start.IsEmpty());
i::Handle<i::Script> script = Utils::OpenHandle(this); i::Handle<i::Script> script = Utils::OpenHandle(this);
#if V8_ENABLE_WEBASSEMBLY
if (script->type() == i::Script::TYPE_WASM) { if (script->type() == i::Script::TYPE_WASM) {
i::wasm::NativeModule* native_module = script->wasm_native_module(); i::wasm::NativeModule* native_module = script->wasm_native_module();
return i::WasmScript::GetPossibleBreakpoints(native_module, start, end, return i::WasmScript::GetPossibleBreakpoints(native_module, start, end,
locations); locations);
} }
#endif // V8_ENABLE_WEBASSEMBLY
i::Isolate* isolate = script->GetIsolate(); i::Isolate* isolate = script->GetIsolate();
i::Script::InitLineEnds(isolate, script); i::Script::InitLineEnds(isolate, script);
...@@ -479,11 +485,13 @@ bool Script::SetBreakpoint(Local<String> condition, Location* location, ...@@ -479,11 +485,13 @@ bool Script::SetBreakpoint(Local<String> condition, Location* location,
bool Script::SetBreakpointOnScriptEntry(BreakpointId* id) const { bool Script::SetBreakpointOnScriptEntry(BreakpointId* id) const {
i::Handle<i::Script> script = Utils::OpenHandle(this); i::Handle<i::Script> script = Utils::OpenHandle(this);
i::Isolate* isolate = script->GetIsolate(); i::Isolate* isolate = script->GetIsolate();
#if V8_ENABLE_WEBASSEMBLY
if (script->type() == i::Script::TYPE_WASM) { if (script->type() == i::Script::TYPE_WASM) {
int position = i::WasmScript::kOnEntryBreakpointPosition; int position = i::WasmScript::kOnEntryBreakpointPosition;
return isolate->debug()->SetBreakPointForScript( return isolate->debug()->SetBreakPointForScript(
script, isolate->factory()->empty_string(), &position, id); script, isolate->factory()->empty_string(), &position, id);
} }
#endif // V8_ENABLE_WEBASSEMBLY
i::SharedFunctionInfo::ScriptIterator it(isolate, *script); i::SharedFunctionInfo::ScriptIterator it(isolate, *script);
for (i::SharedFunctionInfo sfi = it.Next(); !sfi.is_null(); sfi = it.Next()) { for (i::SharedFunctionInfo sfi = it.Next(); !sfi.is_null(); sfi = it.Next()) {
if (sfi.is_toplevel()) { if (sfi.is_toplevel()) {
...@@ -494,11 +502,13 @@ bool Script::SetBreakpointOnScriptEntry(BreakpointId* id) const { ...@@ -494,11 +502,13 @@ bool Script::SetBreakpointOnScriptEntry(BreakpointId* id) const {
return false; return false;
} }
#if V8_ENABLE_WEBASSEMBLY
void Script::RemoveWasmBreakpoint(BreakpointId id) { void Script::RemoveWasmBreakpoint(BreakpointId id) {
i::Handle<i::Script> script = Utils::OpenHandle(this); i::Handle<i::Script> script = Utils::OpenHandle(this);
i::Isolate* isolate = script->GetIsolate(); i::Isolate* isolate = script->GetIsolate();
isolate->debug()->RemoveBreakpointForWasmScript(script, id); isolate->debug()->RemoveBreakpointForWasmScript(script, id);
} }
#endif // V8_ENABLE_WEBASSEMBLY
void RemoveBreakpoint(Isolate* v8_isolate, BreakpointId id) { void RemoveBreakpoint(Isolate* v8_isolate, BreakpointId id) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
...@@ -516,6 +526,7 @@ void ForceGarbageCollection( ...@@ -516,6 +526,7 @@ void ForceGarbageCollection(
isolate->LowMemoryNotification(); isolate->LowMemoryNotification();
} }
#if V8_ENABLE_WEBASSEMBLY
WasmScript* WasmScript::Cast(Script* script) { WasmScript* WasmScript::Cast(Script* script) {
CHECK(script->IsWasm()); CHECK(script->IsWasm());
return static_cast<WasmScript*>(script); return static_cast<WasmScript*>(script);
...@@ -632,6 +643,7 @@ int WasmScript::CodeOffset() const { ...@@ -632,6 +643,7 @@ int WasmScript::CodeOffset() const {
module->code.offset() != 0); module->code.offset() != 0);
return module->code.offset(); return module->code.offset();
} }
#endif // V8_ENABLE_WEBASSEMBLY
Location::Location(int line_number, int column_number) Location::Location(int line_number, int column_number)
: line_number_(line_number), : line_number_(line_number),
...@@ -698,6 +710,7 @@ MaybeLocal<UnboundScript> CompileInspectorScript(Isolate* v8_isolate, ...@@ -698,6 +710,7 @@ MaybeLocal<UnboundScript> CompileInspectorScript(Isolate* v8_isolate,
RETURN_ESCAPED(ToApiHandle<UnboundScript>(result)); RETURN_ESCAPED(ToApiHandle<UnboundScript>(result));
} }
#if V8_ENABLE_WEBASSEMBLY
void TierDownAllModulesPerIsolate(Isolate* v8_isolate) { void TierDownAllModulesPerIsolate(Isolate* v8_isolate) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
isolate->wasm_engine()->TierDownAllModulesPerIsolate(isolate); isolate->wasm_engine()->TierDownAllModulesPerIsolate(isolate);
...@@ -707,6 +720,7 @@ void TierUpAllModulesPerIsolate(Isolate* v8_isolate) { ...@@ -707,6 +720,7 @@ void TierUpAllModulesPerIsolate(Isolate* v8_isolate) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
isolate->wasm_engine()->TierUpAllModulesPerIsolate(isolate); isolate->wasm_engine()->TierUpAllModulesPerIsolate(isolate);
} }
#endif // V8_ENABLE_WEBASSEMBLY
void SetDebugDelegate(Isolate* v8_isolate, DebugDelegate* delegate) { void SetDebugDelegate(Isolate* v8_isolate, DebugDelegate* delegate) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
...@@ -746,12 +760,19 @@ void AccessorPair::CheckCast(Value* that) { ...@@ -746,12 +760,19 @@ void AccessorPair::CheckCast(Value* that) {
"Value is not a v8::debug::AccessorPair"); "Value is not a v8::debug::AccessorPair");
} }
#if V8_ENABLE_WEBASSEMBLY
void WasmValueObject::CheckCast(Value* that) { void WasmValueObject::CheckCast(Value* that) {
i::Handle<i::Object> obj = Utils::OpenHandle(that); i::Handle<i::Object> obj = Utils::OpenHandle(that);
Utils::ApiCheck(obj->IsWasmValueObject(), "v8::debug::WasmValueObject::Cast", Utils::ApiCheck(obj->IsWasmValueObject(), "v8::debug::WasmValueObject::Cast",
"Value is not a v8::debug::WasmValueObject"); "Value is not a v8::debug::WasmValueObject");
} }
bool WasmValueObject::IsWasmValueObject(Local<Value> that) {
i::Handle<i::Object> obj = Utils::OpenHandle(*that);
return obj->IsWasmValueObject();
}
#endif // V8_ENABLE_WEBASSEMBLY
Local<Function> GetBuiltin(Isolate* v8_isolate, Builtin builtin) { Local<Function> GetBuiltin(Isolate* v8_isolate, Builtin builtin) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
...@@ -1114,11 +1135,6 @@ bool AccessorPair::IsAccessorPair(Local<Value> that) { ...@@ -1114,11 +1135,6 @@ bool AccessorPair::IsAccessorPair(Local<Value> that) {
return obj->IsAccessorPair(); return obj->IsAccessorPair();
} }
bool WasmValueObject::IsWasmValueObject(Local<Value> that) {
i::Handle<i::Object> obj = Utils::OpenHandle(*that);
return obj->IsWasmValueObject();
}
MaybeLocal<Message> GetMessageFromPromise(Local<Promise> p) { MaybeLocal<Message> GetMessageFromPromise(Local<Promise> p) {
i::Handle<i::JSPromise> promise = Utils::OpenHandle(*p); i::Handle<i::JSPromise> promise = Utils::OpenHandle(*p);
i::Isolate* isolate = promise->GetIsolate(); i::Isolate* isolate = promise->GetIsolate();
......
...@@ -166,10 +166,13 @@ class V8_EXPORT_PRIVATE Script { ...@@ -166,10 +166,13 @@ class V8_EXPORT_PRIVATE Script {
LiveEditResult* result) const; LiveEditResult* result) const;
bool SetBreakpoint(v8::Local<v8::String> condition, debug::Location* location, bool SetBreakpoint(v8::Local<v8::String> condition, debug::Location* location,
BreakpointId* id) const; BreakpointId* id) const;
#if V8_ENABLE_WEBASSEMBLY
void RemoveWasmBreakpoint(BreakpointId id); void RemoveWasmBreakpoint(BreakpointId id);
#endif // V8_ENABLE_WEBASSEMBLY
bool SetBreakpointOnScriptEntry(BreakpointId* id) const; bool SetBreakpointOnScriptEntry(BreakpointId* id) const;
}; };
#if V8_ENABLE_WEBASSEMBLY
// Specialization for wasm Scripts. // Specialization for wasm Scripts.
class WasmScript : public Script { class WasmScript : public Script {
public: public:
...@@ -190,6 +193,7 @@ class WasmScript : public Script { ...@@ -190,6 +193,7 @@ class WasmScript : public Script {
int CodeOffset() const; int CodeOffset() const;
int CodeLength() const; int CodeLength() const;
}; };
#endif // V8_ENABLE_WEBASSEMBLY
V8_EXPORT_PRIVATE void GetLoadedScripts( V8_EXPORT_PRIVATE void GetLoadedScripts(
Isolate* isolate, Isolate* isolate,
...@@ -228,8 +232,10 @@ class DebugDelegate { ...@@ -228,8 +232,10 @@ class DebugDelegate {
V8_EXPORT_PRIVATE void SetDebugDelegate(Isolate* isolate, V8_EXPORT_PRIVATE void SetDebugDelegate(Isolate* isolate,
DebugDelegate* listener); DebugDelegate* listener);
#if V8_ENABLE_WEBASSEMBLY
V8_EXPORT_PRIVATE void TierDownAllModulesPerIsolate(Isolate* isolate); V8_EXPORT_PRIVATE void TierDownAllModulesPerIsolate(Isolate* isolate);
V8_EXPORT_PRIVATE void TierUpAllModulesPerIsolate(Isolate* isolate); V8_EXPORT_PRIVATE void TierUpAllModulesPerIsolate(Isolate* isolate);
#endif // V8_ENABLE_WEBASSEMBLY
class AsyncEventDelegate { class AsyncEventDelegate {
public: public:
...@@ -616,15 +622,22 @@ class PropertyIterator { ...@@ -616,15 +622,22 @@ class PropertyIterator {
virtual bool is_array_index() = 0; virtual bool is_array_index() = 0;
}; };
#if V8_ENABLE_WEBASSEMBLY
class V8_EXPORT_PRIVATE WasmValueObject : public v8::Object { class V8_EXPORT_PRIVATE WasmValueObject : public v8::Object {
public: public:
WasmValueObject() = delete; WasmValueObject() = delete;
static bool IsWasmValueObject(v8::Local<v8::Value> obj); static bool IsWasmValueObject(v8::Local<v8::Value> obj);
V8_INLINE static WasmValueObject* Cast(v8::Value* obj); static WasmValueObject* Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
#endif
return static_cast<WasmValueObject*>(value);
}
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
#endif // V8_ENABLE_WEBASSEMBLY
AccessorPair* AccessorPair::Cast(v8::Value* value) { AccessorPair* AccessorPair::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS #ifdef V8_ENABLE_CHECKS
...@@ -633,13 +646,6 @@ AccessorPair* AccessorPair::Cast(v8::Value* value) { ...@@ -633,13 +646,6 @@ AccessorPair* AccessorPair::Cast(v8::Value* value) {
return static_cast<AccessorPair*>(value); return static_cast<AccessorPair*>(value);
} }
WasmValueObject* WasmValueObject::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
#endif
return static_cast<WasmValueObject*>(value);
}
MaybeLocal<Message> GetMessageFromPromise(Local<Promise> promise); MaybeLocal<Message> GetMessageFromPromise(Local<Promise> promise);
} // namespace debug } // namespace debug
......
...@@ -7,12 +7,15 @@ ...@@ -7,12 +7,15 @@
#include "src/api/api-inl.h" #include "src/api/api-inl.h"
#include "src/debug/debug-evaluate.h" #include "src/debug/debug-evaluate.h"
#include "src/debug/debug-scope-iterator.h" #include "src/debug/debug-scope-iterator.h"
#include "src/debug/debug-wasm-objects.h"
#include "src/debug/debug.h" #include "src/debug/debug.h"
#include "src/debug/liveedit.h" #include "src/debug/liveedit.h"
#include "src/execution/frames-inl.h" #include "src/execution/frames-inl.h"
#include "src/execution/isolate.h" #include "src/execution/isolate.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/debug/debug-wasm-objects.h"
#endif // V8_ENABLE_WEBASSEMBLY
namespace v8 { namespace v8 {
std::unique_ptr<debug::StackTraceIterator> debug::StackTraceIterator::Create( std::unique_ptr<debug::StackTraceIterator> debug::StackTraceIterator::Create(
...@@ -159,10 +162,11 @@ v8::Local<v8::Function> DebugStackTraceIterator::GetFunction() const { ...@@ -159,10 +162,11 @@ v8::Local<v8::Function> DebugStackTraceIterator::GetFunction() const {
std::unique_ptr<v8::debug::ScopeIterator> std::unique_ptr<v8::debug::ScopeIterator>
DebugStackTraceIterator::GetScopeIterator() const { DebugStackTraceIterator::GetScopeIterator() const {
DCHECK(!Done()); DCHECK(!Done());
CommonFrame* frame = iterator_.frame(); #if V8_ENABLE_WEBASSEMBLY
if (frame->is_wasm()) { if (iterator_.frame()->is_wasm()) {
return GetWasmScopeIterator(WasmFrame::cast(frame)); return GetWasmScopeIterator(WasmFrame::cast(iterator_.frame()));
} }
#endif // V8_ENABLE_WEBASSEMBLY
return std::make_unique<DebugScopeIterator>(isolate_, frame_inspector_.get()); return std::make_unique<DebugScopeIterator>(isolate_, frame_inspector_.get());
} }
......
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#if !V8_ENABLE_WEBASSEMBLY
#error This header should only be included if WebAssembly is enabled.
#endif // !V8_ENABLE_WEBASSEMBLY
#ifndef V8_DEBUG_DEBUG_WASM_OBJECTS_H_ #ifndef V8_DEBUG_DEBUG_WASM_OBJECTS_H_
#define V8_DEBUG_DEBUG_WASM_OBJECTS_H_ #define V8_DEBUG_DEBUG_WASM_OBJECTS_H_
......
...@@ -36,8 +36,11 @@ ...@@ -36,8 +36,11 @@
#include "src/objects/js-promise-inl.h" #include "src/objects/js-promise-inl.h"
#include "src/objects/slots.h" #include "src/objects/slots.h"
#include "src/snapshot/snapshot.h" #include "src/snapshot/snapshot.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/wasm/wasm-debug.h" #include "src/wasm/wasm-debug.h"
#include "src/wasm/wasm-objects-inl.h" #include "src/wasm/wasm-objects-inl.h"
#endif // V8_ENABLE_WEBASSEMBLY
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -562,7 +565,6 @@ bool Debug::IsMutedAtCurrentLocation(JavaScriptFrame* frame) { ...@@ -562,7 +565,6 @@ bool Debug::IsMutedAtCurrentLocation(JavaScriptFrame* frame) {
// break location, we also do not trigger one for debugger statements, nor // break location, we also do not trigger one for debugger statements, nor
// an exception event on exception at this location. // an exception event on exception at this location.
FrameSummary summary = FrameSummary::GetTop(frame); FrameSummary summary = FrameSummary::GetTop(frame);
DCHECK(!summary.IsWasm());
Handle<JSFunction> function = summary.AsJavaScript().function(); Handle<JSFunction> function = summary.AsJavaScript().function();
if (!function->shared().HasBreakInfo()) return false; if (!function->shared().HasBreakInfo()) return false;
Handle<DebugInfo> debug_info(function->shared().GetDebugInfo(), isolate_); Handle<DebugInfo> debug_info(function->shared().GetDebugInfo(), isolate_);
...@@ -644,10 +646,12 @@ bool Debug::SetBreakPointForScript(Handle<Script> script, ...@@ -644,10 +646,12 @@ bool Debug::SetBreakPointForScript(Handle<Script> script,
*id = ++thread_local_.last_breakpoint_id_; *id = ++thread_local_.last_breakpoint_id_;
Handle<BreakPoint> break_point = Handle<BreakPoint> break_point =
isolate_->factory()->NewBreakPoint(*id, condition); isolate_->factory()->NewBreakPoint(*id, condition);
#if V8_ENABLE_WEBASSEMBLY
if (script->type() == Script::TYPE_WASM) { if (script->type() == Script::TYPE_WASM) {
RecordWasmScriptWithBreakpoints(script); RecordWasmScriptWithBreakpoints(script);
return WasmScript::SetBreakPoint(script, source_position, break_point); return WasmScript::SetBreakPoint(script, source_position, break_point);
} }
#endif // V8_ENABLE_WEBASSEMBLY
HandleScope scope(isolate_); HandleScope scope(isolate_);
...@@ -750,6 +754,7 @@ bool Debug::SetBreakpointForFunction(Handle<SharedFunctionInfo> shared, ...@@ -750,6 +754,7 @@ bool Debug::SetBreakpointForFunction(Handle<SharedFunctionInfo> shared,
Handle<BreakPoint> breakpoint = Handle<BreakPoint> breakpoint =
isolate_->factory()->NewBreakPoint(*id, condition); isolate_->factory()->NewBreakPoint(*id, condition);
int source_position = 0; int source_position = 0;
#if V8_ENABLE_WEBASSEMBLY
// Handle wasm function. // Handle wasm function.
if (shared->HasWasmExportedFunctionData()) { if (shared->HasWasmExportedFunctionData()) {
int func_index = shared->wasm_exported_function_data().function_index(); int func_index = shared->wasm_exported_function_data().function_index();
...@@ -760,6 +765,7 @@ bool Debug::SetBreakpointForFunction(Handle<SharedFunctionInfo> shared, ...@@ -760,6 +765,7 @@ bool Debug::SetBreakpointForFunction(Handle<SharedFunctionInfo> shared,
return WasmScript::SetBreakPointOnFirstBreakableForFunction( return WasmScript::SetBreakPointOnFirstBreakableForFunction(
script, func_index, breakpoint); script, func_index, breakpoint);
} }
#endif // V8_ENABLE_WEBASSEMBLY
return SetBreakpoint(shared, breakpoint, &source_position); return SetBreakpoint(shared, breakpoint, &source_position);
} }
...@@ -769,6 +775,7 @@ void Debug::RemoveBreakpoint(int id) { ...@@ -769,6 +775,7 @@ void Debug::RemoveBreakpoint(int id) {
ClearBreakPoint(breakpoint); ClearBreakPoint(breakpoint);
} }
#if V8_ENABLE_WEBASSEMBLY
void Debug::RemoveBreakpointForWasmScript(Handle<Script> script, int id) { void Debug::RemoveBreakpointForWasmScript(Handle<Script> script, int id) {
if (script->type() == Script::TYPE_WASM) { if (script->type() == Script::TYPE_WASM) {
WasmScript::ClearBreakPointById(script, id); WasmScript::ClearBreakPointById(script, id);
...@@ -802,6 +809,7 @@ void Debug::RecordWasmScriptWithBreakpoints(Handle<Script> script) { ...@@ -802,6 +809,7 @@ void Debug::RecordWasmScriptWithBreakpoints(Handle<Script> script) {
isolate_->global_handles()->Create(*new_list); isolate_->global_handles()->Create(*new_list);
} }
} }
#endif // V8_ENABLE_WEBASSEMBLY
// Clear out all the debug break code. // Clear out all the debug break code.
void Debug::ClearAllBreakPoints() { void Debug::ClearAllBreakPoints() {
...@@ -809,6 +817,7 @@ void Debug::ClearAllBreakPoints() { ...@@ -809,6 +817,7 @@ void Debug::ClearAllBreakPoints() {
ClearBreakPoints(info); ClearBreakPoints(info);
info->ClearBreakInfo(isolate_); info->ClearBreakInfo(isolate_);
}); });
#if V8_ENABLE_WEBASSEMBLY
// Clear all wasm breakpoints. // Clear all wasm breakpoints.
if (!wasm_scripts_with_breakpoints_.is_null()) { if (!wasm_scripts_with_breakpoints_.is_null()) {
DisallowGarbageCollection no_gc; DisallowGarbageCollection no_gc;
...@@ -825,6 +834,7 @@ void Debug::ClearAllBreakPoints() { ...@@ -825,6 +834,7 @@ void Debug::ClearAllBreakPoints() {
} }
wasm_scripts_with_breakpoints_ = Handle<WeakArrayList>{}; wasm_scripts_with_breakpoints_ = Handle<WeakArrayList>{};
} }
#endif // V8_ENABLE_WEBASSEMBLY
} }
void Debug::FloodWithOneShot(Handle<SharedFunctionInfo> shared, void Debug::FloodWithOneShot(Handle<SharedFunctionInfo> shared,
...@@ -1070,6 +1080,7 @@ void Debug::PrepareStep(StepAction step_action) { ...@@ -1070,6 +1080,7 @@ void Debug::PrepareStep(StepAction step_action) {
// No longer perform the current async step. // No longer perform the current async step.
clear_suspended_generator(); clear_suspended_generator();
} else if (frame->is_wasm() && step_action != StepOut) { } else if (frame->is_wasm() && step_action != StepOut) {
#if V8_ENABLE_WEBASSEMBLY
// Handle stepping in wasm. // Handle stepping in wasm.
WasmFrame* wasm_frame = WasmFrame::cast(frame); WasmFrame* wasm_frame = WasmFrame::cast(frame);
auto* debug_info = wasm_frame->native_module()->GetDebugInfo(); auto* debug_info = wasm_frame->native_module()->GetDebugInfo();
...@@ -1077,6 +1088,7 @@ void Debug::PrepareStep(StepAction step_action) { ...@@ -1077,6 +1088,7 @@ void Debug::PrepareStep(StepAction step_action) {
UpdateHookOnFunctionCall(); UpdateHookOnFunctionCall();
return; return;
} }
#endif // V8_ENABLE_WEBASSEMBLY
// If the wasm code is not debuggable or will return after this step // If the wasm code is not debuggable or will return after this step
// (indicated by {PrepareStep} returning false), then step out of that frame // (indicated by {PrepareStep} returning false), then step out of that frame
// instead. // instead.
...@@ -1104,6 +1116,7 @@ void Debug::PrepareStep(StepAction step_action) { ...@@ -1104,6 +1116,7 @@ void Debug::PrepareStep(StepAction step_action) {
// and deoptimize every frame along the way. // and deoptimize every frame along the way.
bool in_current_frame = true; bool in_current_frame = true;
for (; !frames_it.done(); frames_it.Advance()) { for (; !frames_it.done(); frames_it.Advance()) {
#if V8_ENABLE_WEBASSEMBLY
if (frames_it.frame()->is_wasm()) { if (frames_it.frame()->is_wasm()) {
if (in_current_frame) { if (in_current_frame) {
in_current_frame = false; in_current_frame = false;
...@@ -1115,6 +1128,7 @@ void Debug::PrepareStep(StepAction step_action) { ...@@ -1115,6 +1128,7 @@ void Debug::PrepareStep(StepAction step_action) {
debug_info->PrepareStepOutTo(wasm_frame); debug_info->PrepareStepOutTo(wasm_frame);
return; return;
} }
#endif // V8_ENABLE_WEBASSEMBLY
JavaScriptFrame* frame = JavaScriptFrame::cast(frames_it.frame()); JavaScriptFrame* frame = JavaScriptFrame::cast(frames_it.frame());
if (last_step_action() == StepIn) { if (last_step_action() == StepIn) {
// Deoptimize frame to ensure calls are checked for step-in. // Deoptimize frame to ensure calls are checked for step-in.
......
...@@ -245,9 +245,11 @@ class V8_EXPORT_PRIVATE Debug { ...@@ -245,9 +245,11 @@ class V8_EXPORT_PRIVATE Debug {
bool SetBreakpointForFunction(Handle<SharedFunctionInfo> shared, bool SetBreakpointForFunction(Handle<SharedFunctionInfo> shared,
Handle<String> condition, int* id); Handle<String> condition, int* id);
void RemoveBreakpoint(int id); void RemoveBreakpoint(int id);
#if V8_ENABLE_WEBASSEMBLY
void RemoveBreakpointForWasmScript(Handle<Script> script, int id); void RemoveBreakpointForWasmScript(Handle<Script> script, int id);
void RecordWasmScriptWithBreakpoints(Handle<Script> script); void RecordWasmScriptWithBreakpoints(Handle<Script> script);
#endif // V8_ENABLE_WEBASSEMBLY
// Find breakpoints from the debug info and the break location and check // Find breakpoints from the debug info and the break location and check
// whether they are hit. Return an empty handle if not, or a FixedArray with // whether they are hit. Return an empty handle if not, or a FixedArray with
...@@ -554,8 +556,10 @@ class V8_EXPORT_PRIVATE Debug { ...@@ -554,8 +556,10 @@ class V8_EXPORT_PRIVATE Debug {
// Storage location for registers when handling debug break calls // Storage location for registers when handling debug break calls
ThreadLocal thread_local_; ThreadLocal thread_local_;
#if V8_ENABLE_WEBASSEMBLY
// This is a global handle, lazily initialized. // This is a global handle, lazily initialized.
Handle<WeakArrayList> wasm_scripts_with_breakpoints_; Handle<WeakArrayList> wasm_scripts_with_breakpoints_;
#endif // V8_ENABLE_WEBASSEMBLY
Isolate* isolate_; Isolate* isolate_;
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "src/codegen/assembler-inl.h" #include "src/codegen/assembler-inl.h"
#include "src/common/globals.h" #include "src/common/globals.h"
#include "src/date/date.h" #include "src/date/date.h"
#include "src/debug/debug-wasm-objects-inl.h"
#include "src/diagnostics/disasm.h" #include "src/diagnostics/disasm.h"
#include "src/diagnostics/disassembler.h" #include "src/diagnostics/disassembler.h"
#include "src/heap/combined-heap.h" #include "src/heap/combined-heap.h"
...@@ -78,6 +77,10 @@ ...@@ -78,6 +77,10 @@
#include "src/wasm/wasm-objects-inl.h" #include "src/wasm/wasm-objects-inl.h"
#include "torque-generated/class-verifiers.h" #include "torque-generated/class-verifiers.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/debug/debug-wasm-objects-inl.h"
#endif // V8_ENABLE_WEBASSEMBLY
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -229,9 +232,11 @@ void HeapObject::HeapObjectVerify(Isolate* isolate) { ...@@ -229,9 +232,11 @@ void HeapObject::HeapObjectVerify(Isolate* isolate) {
case WASM_INSTANCE_OBJECT_TYPE: case WASM_INSTANCE_OBJECT_TYPE:
WasmInstanceObject::cast(*this).WasmInstanceObjectVerify(isolate); WasmInstanceObject::cast(*this).WasmInstanceObjectVerify(isolate);
break; break;
#if V8_ENABLE_WEBASSEMBLY
case WASM_VALUE_OBJECT_TYPE: case WASM_VALUE_OBJECT_TYPE:
WasmValueObject::cast(*this).WasmValueObjectVerify(isolate); WasmValueObject::cast(*this).WasmValueObjectVerify(isolate);
break; break;
#endif // V8_ENABLE_WEBASSEMBLY
case JS_SET_KEY_VALUE_ITERATOR_TYPE: case JS_SET_KEY_VALUE_ITERATOR_TYPE:
case JS_SET_VALUE_ITERATOR_TYPE: case JS_SET_VALUE_ITERATOR_TYPE:
JSSetIterator::cast(*this).JSSetIteratorVerify(isolate); JSSetIterator::cast(*this).JSSetIteratorVerify(isolate);
...@@ -1614,10 +1619,12 @@ void WasmInstanceObject::WasmInstanceObjectVerify(Isolate* isolate) { ...@@ -1614,10 +1619,12 @@ void WasmInstanceObject::WasmInstanceObjectVerify(Isolate* isolate) {
} }
} }
#if V8_ENABLE_WEBASSEMBLY
void WasmValueObject::WasmValueObjectVerify(Isolate* isolate) { void WasmValueObject::WasmValueObjectVerify(Isolate* isolate) {
JSObjectVerify(isolate); JSObjectVerify(isolate);
CHECK(IsWasmValueObject()); CHECK(IsWasmValueObject());
} }
#endif // V8_ENABLE_WEBASSEMBLY
void WasmExportedFunctionData::WasmExportedFunctionDataVerify( void WasmExportedFunctionData::WasmExportedFunctionDataVerify(
Isolate* isolate) { Isolate* isolate) {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <memory> #include <memory>
#include "src/common/globals.h" #include "src/common/globals.h"
#include "src/debug/debug-wasm-objects-inl.h"
#include "src/diagnostics/disasm.h" #include "src/diagnostics/disasm.h"
#include "src/diagnostics/disassembler.h" #include "src/diagnostics/disassembler.h"
#include "src/heap/heap-inl.h" // For InOldSpace. #include "src/heap/heap-inl.h" // For InOldSpace.
...@@ -22,6 +21,10 @@ ...@@ -22,6 +21,10 @@
#include "src/wasm/wasm-engine.h" #include "src/wasm/wasm-engine.h"
#include "src/wasm/wasm-objects-inl.h" #include "src/wasm/wasm-objects-inl.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/debug/debug-wasm-objects-inl.h"
#endif // V8_ENABLE_WEBASSEMBLY
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -175,9 +178,11 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT ...@@ -175,9 +178,11 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
case WASM_INSTANCE_OBJECT_TYPE: case WASM_INSTANCE_OBJECT_TYPE:
WasmInstanceObject::cast(*this).WasmInstanceObjectPrint(os); WasmInstanceObject::cast(*this).WasmInstanceObjectPrint(os);
break; break;
#if V8_ENABLE_WEBASSEMBLY
case WASM_VALUE_OBJECT_TYPE: case WASM_VALUE_OBJECT_TYPE:
WasmValueObject::cast(*this).WasmValueObjectPrint(os); WasmValueObject::cast(*this).WasmValueObjectPrint(os);
break; break;
#endif // V8_ENABLE_WEBASSEMBLY
case CODE_TYPE: case CODE_TYPE:
Code::cast(*this).CodePrint(os); Code::cast(*this).CodePrint(os);
break; break;
...@@ -1962,11 +1967,13 @@ void WasmTableObject::WasmTableObjectPrint(std::ostream& os) { // NOLINT ...@@ -1962,11 +1967,13 @@ void WasmTableObject::WasmTableObjectPrint(std::ostream& os) { // NOLINT
os << "\n"; os << "\n";
} }
#if V8_ENABLE_WEBASSEMBLY
void WasmValueObject::WasmValueObjectPrint(std::ostream& os) { // NOLINT void WasmValueObject::WasmValueObjectPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "WasmValueObject"); PrintHeader(os, "WasmValueObject");
os << "\n - value: " << Brief(value()); os << "\n - value: " << Brief(value());
os << "\n"; os << "\n";
} }
#endif // V8_ENABLE_WEBASSEMBLY
void WasmGlobalObject::WasmGlobalObjectPrint(std::ostream& os) { // NOLINT void WasmGlobalObject::WasmGlobalObjectPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "WasmGlobalObject"); PrintHeader(os, "WasmGlobalObject");
......
...@@ -66,6 +66,7 @@ static const intptr_t kBreakpointHintMaxSearchOffset = 80 * 10; ...@@ -66,6 +66,7 @@ static const intptr_t kBreakpointHintMaxSearchOffset = 80 * 10;
// the maximum length of a message in mojo (see https://crbug.com/1105172). // the maximum length of a message in mojo (see https://crbug.com/1105172).
static const size_t kMaxNumBreakpoints = 1000; static const size_t kMaxNumBreakpoints = 1000;
#if V8_ENABLE_WEBASSEMBLY
// TODO(1099680): getScriptSource and getWasmBytecode return Wasm wire bytes // TODO(1099680): getScriptSource and getWasmBytecode return Wasm wire bytes
// as protocol::Binary, which is encoded as JSON string in the communication // as protocol::Binary, which is encoded as JSON string in the communication
// to the DevTools front-end and hence leads to either crashing the renderer // to the DevTools front-end and hence leads to either crashing the renderer
...@@ -73,9 +74,11 @@ static const size_t kMaxNumBreakpoints = 1000; ...@@ -73,9 +74,11 @@ static const size_t kMaxNumBreakpoints = 1000;
// allow arbitrarily big Wasm byte sequences here. Ideally we would find a // allow arbitrarily big Wasm byte sequences here. Ideally we would find a
// different way to transfer the wire bytes (middle- to long-term), but as a // different way to transfer the wire bytes (middle- to long-term), but as a
// short-term solution, we should at least not crash. // short-term solution, we should at least not crash.
static const size_t kWasmBytecodeMaxLength = (v8::String::kMaxLength / 4) * 3; static constexpr size_t kWasmBytecodeMaxLength =
static const char kWasmBytecodeExceedsTransferLimit[] = (v8::String::kMaxLength / 4) * 3;
static constexpr const char kWasmBytecodeExceedsTransferLimit[] =
"WebAssembly bytecode exceeds the transfer limit"; "WebAssembly bytecode exceeds the transfer limit";
#endif // V8_ENABLE_WEBASSEMBLY
namespace { namespace {
...@@ -706,9 +709,11 @@ void V8DebuggerAgentImpl::removeBreakpointImpl( ...@@ -706,9 +709,11 @@ void V8DebuggerAgentImpl::removeBreakpointImpl(
return; return;
} }
for (const auto& id : debuggerBreakpointIdsIterator->second) { for (const auto& id : debuggerBreakpointIdsIterator->second) {
#if V8_ENABLE_WEBASSEMBLY
for (auto& script : scripts) { for (auto& script : scripts) {
script->removeWasmBreakpoint(id); script->removeWasmBreakpoint(id);
} }
#endif // V8_ENABLE_WEBASSEMBLY
v8::debug::RemoveBreakpoint(m_isolate, id); v8::debug::RemoveBreakpoint(m_isolate, id);
m_debuggerBreakpointIdToBreakpointId.erase(id); m_debuggerBreakpointIdToBreakpointId.erase(id);
} }
...@@ -1043,6 +1048,7 @@ Response V8DebuggerAgentImpl::getScriptSource( ...@@ -1043,6 +1048,7 @@ Response V8DebuggerAgentImpl::getScriptSource(
if (it == m_scripts.end()) if (it == m_scripts.end())
return Response::ServerError("No script for id: " + scriptId.utf8()); return Response::ServerError("No script for id: " + scriptId.utf8());
*scriptSource = it->second->source(0); *scriptSource = it->second->source(0);
#if V8_ENABLE_WEBASSEMBLY
v8::MemorySpan<const uint8_t> span; v8::MemorySpan<const uint8_t> span;
if (it->second->wasmBytecode().To(&span)) { if (it->second->wasmBytecode().To(&span)) {
if (span.size() > kWasmBytecodeMaxLength) { if (span.size() > kWasmBytecodeMaxLength) {
...@@ -1050,11 +1056,13 @@ Response V8DebuggerAgentImpl::getScriptSource( ...@@ -1050,11 +1056,13 @@ Response V8DebuggerAgentImpl::getScriptSource(
} }
*bytecode = protocol::Binary::fromSpan(span.data(), span.size()); *bytecode = protocol::Binary::fromSpan(span.data(), span.size());
} }
#endif // V8_ENABLE_WEBASSEMBLY
return Response::Success(); return Response::Success();
} }
Response V8DebuggerAgentImpl::getWasmBytecode(const String16& scriptId, Response V8DebuggerAgentImpl::getWasmBytecode(const String16& scriptId,
protocol::Binary* bytecode) { protocol::Binary* bytecode) {
#if V8_ENABLE_WEBASSEMBLY
if (!enabled()) return Response::ServerError(kDebuggerNotEnabled); if (!enabled()) return Response::ServerError(kDebuggerNotEnabled);
ScriptsMap::iterator it = m_scripts.find(scriptId); ScriptsMap::iterator it = m_scripts.find(scriptId);
if (it == m_scripts.end()) if (it == m_scripts.end())
...@@ -1068,6 +1076,9 @@ Response V8DebuggerAgentImpl::getWasmBytecode(const String16& scriptId, ...@@ -1068,6 +1076,9 @@ Response V8DebuggerAgentImpl::getWasmBytecode(const String16& scriptId,
} }
*bytecode = protocol::Binary::fromSpan(span.data(), span.size()); *bytecode = protocol::Binary::fromSpan(span.data(), span.size());
return Response::Success(); return Response::Success();
#else
return Response::ServerError("WebAssembly is disabled");
#endif // V8_ENABLE_WEBASSEMBLY
} }
void V8DebuggerAgentImpl::pushBreakDetails( void V8DebuggerAgentImpl::pushBreakDetails(
...@@ -1505,6 +1516,7 @@ static String16 getScriptLanguage(const V8DebuggerScript& script) { ...@@ -1505,6 +1516,7 @@ static String16 getScriptLanguage(const V8DebuggerScript& script) {
} }
} }
#if V8_ENABLE_WEBASSEMBLY
static const char* getDebugSymbolTypeName( static const char* getDebugSymbolTypeName(
v8::debug::WasmScript::DebugSymbolsType type) { v8::debug::WasmScript::DebugSymbolsType type) {
switch (type) { switch (type) {
...@@ -1537,6 +1549,7 @@ static std::unique_ptr<protocol::Debugger::DebugSymbols> getDebugSymbols( ...@@ -1537,6 +1549,7 @@ static std::unique_ptr<protocol::Debugger::DebugSymbols> getDebugSymbols(
} }
return debugSymbols; return debugSymbols;
} }
#endif // V8_ENABLE_WEBASSEMBLY
void V8DebuggerAgentImpl::didParseSource( void V8DebuggerAgentImpl::didParseSource(
std::unique_ptr<V8DebuggerScript> script, bool success) { std::unique_ptr<V8DebuggerScript> script, bool success) {
...@@ -1571,10 +1584,12 @@ void V8DebuggerAgentImpl::didParseSource( ...@@ -1571,10 +1584,12 @@ void V8DebuggerAgentImpl::didParseSource(
String16 embedderName = script->embedderName(); String16 embedderName = script->embedderName();
String16 scriptLanguage = getScriptLanguage(*script); String16 scriptLanguage = getScriptLanguage(*script);
Maybe<int> codeOffset; Maybe<int> codeOffset;
std::unique_ptr<protocol::Debugger::DebugSymbols> debugSymbols;
#if V8_ENABLE_WEBASSEMBLY
if (script->getLanguage() == V8DebuggerScript::Language::WebAssembly) if (script->getLanguage() == V8DebuggerScript::Language::WebAssembly)
codeOffset = script->codeOffset(); codeOffset = script->codeOffset();
std::unique_ptr<protocol::Debugger::DebugSymbols> debugSymbols = debugSymbols = getDebugSymbols(*script);
getDebugSymbols(*script); #endif // V8_ENABLE_WEBASSEMBLY
m_scripts[scriptId] = std::move(script); m_scripts[scriptId] = std::move(script);
// Release the strong reference to get notified when debugger is the only // Release the strong reference to get notified when debugger is the only
......
...@@ -116,13 +116,16 @@ class ActualScript : public V8DebuggerScript { ...@@ -116,13 +116,16 @@ class ActualScript : public V8DebuggerScript {
static_cast<int>(pos), static_cast<int>(substringLength)); static_cast<int>(pos), static_cast<int>(substringLength));
return String16(buffer.get(), substringLength); return String16(buffer.get(), substringLength);
} }
Language getLanguage() const override { return m_language; }
#if V8_ENABLE_WEBASSEMBLY
v8::Maybe<v8::MemorySpan<const uint8_t>> wasmBytecode() const override { v8::Maybe<v8::MemorySpan<const uint8_t>> wasmBytecode() const override {
v8::HandleScope scope(m_isolate); v8::HandleScope scope(m_isolate);
auto script = this->script(); auto script = this->script();
if (!script->IsWasm()) return v8::Nothing<v8::MemorySpan<const uint8_t>>(); if (!script->IsWasm()) return v8::Nothing<v8::MemorySpan<const uint8_t>>();
return v8::Just(v8::debug::WasmScript::Cast(*script)->Bytecode()); return v8::Just(v8::debug::WasmScript::Cast(*script)->Bytecode());
} }
Language getLanguage() const override { return m_language; }
v8::Maybe<v8::debug::WasmScript::DebugSymbolsType> getDebugSymbolsType() v8::Maybe<v8::debug::WasmScript::DebugSymbolsType> getDebugSymbolsType()
const override { const override {
auto script = this->script(); auto script = this->script();
...@@ -130,6 +133,7 @@ class ActualScript : public V8DebuggerScript { ...@@ -130,6 +133,7 @@ class ActualScript : public V8DebuggerScript {
return v8::Nothing<v8::debug::WasmScript::DebugSymbolsType>(); return v8::Nothing<v8::debug::WasmScript::DebugSymbolsType>();
return v8::Just(v8::debug::WasmScript::Cast(*script)->GetDebugSymbolType()); return v8::Just(v8::debug::WasmScript::Cast(*script)->GetDebugSymbolType());
} }
v8::Maybe<String16> getExternalDebugSymbolsURL() const override { v8::Maybe<String16> getExternalDebugSymbolsURL() const override {
auto script = this->script(); auto script = this->script();
if (!script->IsWasm()) return v8::Nothing<String16>(); if (!script->IsWasm()) return v8::Nothing<String16>();
...@@ -138,22 +142,29 @@ class ActualScript : public V8DebuggerScript { ...@@ -138,22 +142,29 @@ class ActualScript : public V8DebuggerScript {
if (external_url.size() == 0) return v8::Nothing<String16>(); if (external_url.size() == 0) return v8::Nothing<String16>();
return v8::Just(String16(external_url.data(), external_url.size())); return v8::Just(String16(external_url.data(), external_url.size()));
} }
#endif // V8_ENABLE_WEBASSEMBLY
int startLine() const override { return m_startLine; } int startLine() const override { return m_startLine; }
int startColumn() const override { return m_startColumn; } int startColumn() const override { return m_startColumn; }
int endLine() const override { return m_endLine; } int endLine() const override { return m_endLine; }
int endColumn() const override { return m_endColumn; } int endColumn() const override { return m_endColumn; }
int codeOffset() const override { int codeOffset() const override {
auto script = this->script(); #if V8_ENABLE_WEBASSEMBLY
if (!script->IsWasm()) return 0; if (script()->IsWasm()) {
return v8::debug::WasmScript::Cast(*script)->CodeOffset(); return v8::debug::WasmScript::Cast(*script())->CodeOffset();
}
#endif // V8_ENABLE_WEBASSEMBLY
return 0;
} }
bool isSourceLoadedLazily() const override { return false; } bool isSourceLoadedLazily() const override { return false; }
int length() const override { int length() const override {
auto script = this->script(); auto script = this->script();
#if V8_ENABLE_WEBASSEMBLY
if (script->IsWasm()) { if (script->IsWasm()) {
return static_cast<int>( return static_cast<int>(
v8::debug::WasmScript::Cast(*script)->Bytecode().size()); v8::debug::WasmScript::Cast(*script)->Bytecode().size());
} }
#endif // V8_ENABLE_WEBASSEMBLY
v8::HandleScope scope(m_isolate); v8::HandleScope scope(m_isolate);
v8::Local<v8::String> v8Source; v8::Local<v8::String> v8Source;
return script->Source().ToLocal(&v8Source) ? v8Source->Length() : 0; return script->Source().ToLocal(&v8Source) ? v8Source->Length() : 0;
...@@ -305,23 +316,26 @@ class ActualScript : public V8DebuggerScript { ...@@ -305,23 +316,26 @@ class ActualScript : public V8DebuggerScript {
} else { } else {
m_endColumn = source_length + m_startColumn; m_endColumn = source_length + m_startColumn;
} }
#if V8_ENABLE_WEBASSEMBLY
} else if (script->IsWasm()) { } else if (script->IsWasm()) {
DCHECK_EQ(0, m_startLine); DCHECK_EQ(0, m_startLine);
DCHECK_EQ(0, m_startColumn); DCHECK_EQ(0, m_startColumn);
m_endLine = 0; m_endLine = 0;
m_endColumn = static_cast<int>( m_endColumn = static_cast<int>(
v8::debug::WasmScript::Cast(*script)->Bytecode().size()); v8::debug::WasmScript::Cast(*script)->Bytecode().size());
#endif // V8_ENABLE_WEBASSEMBLY
} else { } else {
m_endLine = m_startLine; m_endLine = m_startLine;
m_endColumn = m_startColumn; m_endColumn = m_startColumn;
} }
USE(script->ContextId().To(&m_executionContextId)); USE(script->ContextId().To(&m_executionContextId));
m_language = V8DebuggerScript::Language::JavaScript;
#if V8_ENABLE_WEBASSEMBLY
if (script->IsWasm()) { if (script->IsWasm()) {
m_language = V8DebuggerScript::Language::WebAssembly; m_language = V8DebuggerScript::Language::WebAssembly;
} else {
m_language = V8DebuggerScript::Language::JavaScript;
} }
#endif // V8_ENABLE_WEBASSEMBLY
m_isModule = script->IsModule(); m_isModule = script->IsModule();
...@@ -387,9 +401,11 @@ bool V8DebuggerScript::setBreakpoint(const String16& condition, ...@@ -387,9 +401,11 @@ bool V8DebuggerScript::setBreakpoint(const String16& condition,
return script()->SetBreakpoint(toV8String(m_isolate, condition), loc, id); return script()->SetBreakpoint(toV8String(m_isolate, condition), loc, id);
} }
#if V8_ENABLE_WEBASSEMBLY
void V8DebuggerScript::removeWasmBreakpoint(int id) { void V8DebuggerScript::removeWasmBreakpoint(int id) {
v8::HandleScope scope(m_isolate); v8::HandleScope scope(m_isolate);
script()->RemoveWasmBreakpoint(id); script()->RemoveWasmBreakpoint(id);
} }
#endif // V8_ENABLE_WEBASSEMBLY
} // namespace v8_inspector } // namespace v8_inspector
...@@ -62,11 +62,7 @@ class V8DebuggerScript { ...@@ -62,11 +62,7 @@ class V8DebuggerScript {
virtual const String16& sourceMappingURL() const = 0; virtual const String16& sourceMappingURL() const = 0;
virtual String16 source(size_t pos, size_t len = UINT_MAX) const = 0; virtual String16 source(size_t pos, size_t len = UINT_MAX) const = 0;
virtual v8::Maybe<v8::MemorySpan<const uint8_t>> wasmBytecode() const = 0;
virtual Language getLanguage() const = 0; virtual Language getLanguage() const = 0;
virtual v8::Maybe<String16> getExternalDebugSymbolsURL() const = 0;
virtual v8::Maybe<v8::debug::WasmScript::DebugSymbolsType>
getDebugSymbolsType() const = 0;
virtual const String16& hash() const = 0; virtual const String16& hash() const = 0;
virtual int startLine() const = 0; virtual int startLine() const = 0;
virtual int startColumn() const = 0; virtual int startColumn() const = 0;
...@@ -96,10 +92,17 @@ class V8DebuggerScript { ...@@ -96,10 +92,17 @@ class V8DebuggerScript {
virtual bool setBreakpoint(const String16& condition, virtual bool setBreakpoint(const String16& condition,
v8::debug::Location* location, int* id) const = 0; v8::debug::Location* location, int* id) const = 0;
void removeWasmBreakpoint(int id);
virtual void MakeWeak() = 0; virtual void MakeWeak() = 0;
virtual bool setBreakpointOnRun(int* id) const = 0; virtual bool setBreakpointOnRun(int* id) const = 0;
#if V8_ENABLE_WEBASSEMBLY
virtual v8::Maybe<v8::MemorySpan<const uint8_t>> wasmBytecode() const = 0;
virtual v8::Maybe<v8::debug::WasmScript::DebugSymbolsType>
getDebugSymbolsType() const = 0;
virtual v8::Maybe<String16> getExternalDebugSymbolsURL() const = 0;
void removeWasmBreakpoint(int id);
#endif // V8_ENABLE_WEBASSEMBLY
protected: protected:
V8DebuggerScript(v8::Isolate*, String16 id, String16 url, V8DebuggerScript(v8::Isolate*, String16 id, String16 url,
String16 embedderName); String16 embedderName);
......
...@@ -90,7 +90,9 @@ void V8Debugger::enable() { ...@@ -90,7 +90,9 @@ void V8Debugger::enable() {
m_isolate->AddNearHeapLimitCallback(&V8Debugger::nearHeapLimitCallback, this); m_isolate->AddNearHeapLimitCallback(&V8Debugger::nearHeapLimitCallback, this);
v8::debug::ChangeBreakOnException(m_isolate, v8::debug::NoBreakOnException); v8::debug::ChangeBreakOnException(m_isolate, v8::debug::NoBreakOnException);
m_pauseOnExceptionsState = v8::debug::NoBreakOnException; m_pauseOnExceptionsState = v8::debug::NoBreakOnException;
#if V8_ENABLE_WEBASSEMBLY
v8::debug::TierDownAllModulesPerIsolate(m_isolate); v8::debug::TierDownAllModulesPerIsolate(m_isolate);
#endif // V8_ENABLE_WEBASSEMBLY
} }
void V8Debugger::disable() { void V8Debugger::disable() {
...@@ -113,7 +115,9 @@ void V8Debugger::disable() { ...@@ -113,7 +115,9 @@ void V8Debugger::disable() {
m_taskWithScheduledBreakPauseRequested = false; m_taskWithScheduledBreakPauseRequested = false;
m_pauseOnNextCallRequested = false; m_pauseOnNextCallRequested = false;
m_pauseOnAsyncCall = false; m_pauseOnAsyncCall = false;
#if V8_ENABLE_WEBASSEMBLY
v8::debug::TierUpAllModulesPerIsolate(m_isolate); v8::debug::TierUpAllModulesPerIsolate(m_isolate);
#endif // V8_ENABLE_WEBASSEMBLY
v8::debug::SetDebugDelegate(m_isolate, nullptr); v8::debug::SetDebugDelegate(m_isolate, nullptr);
m_isolate->RemoveNearHeapLimitCallback(&V8Debugger::nearHeapLimitCallback, m_isolate->RemoveNearHeapLimitCallback(&V8Debugger::nearHeapLimitCallback,
m_originalHeapLimit); m_originalHeapLimit);
......
...@@ -793,8 +793,10 @@ bool getPropertiesForPreview(v8::Local<v8::Context> context, ...@@ -793,8 +793,10 @@ bool getPropertiesForPreview(v8::Local<v8::Context> context,
if (object->IsArray() || isArrayLike(context, object, &length) || if (object->IsArray() || isArrayLike(context, object, &length) ||
object->IsStringObject()) { object->IsStringObject()) {
blocklist.push_back("length"); blocklist.push_back("length");
#if V8_ENABLE_WEBASSEMBLY
} else if (v8::debug::WasmValueObject::IsWasmValueObject(object)) { } else if (v8::debug::WasmValueObject::IsWasmValueObject(object)) {
blocklist.push_back("type"); blocklist.push_back("type");
#endif // V8_ENABLE_WEBASSEMBLY
} else { } else {
auto clientSubtype = clientFor(context)->valueSubtype(object); auto clientSubtype = clientFor(context)->valueSubtype(object);
if (clientSubtype && toString16(clientSubtype->string()) == "array") { if (clientSubtype && toString16(clientSubtype->string()) == "array") {
...@@ -1693,6 +1695,7 @@ std::unique_ptr<ValueMirror> ValueMirror::create(v8::Local<v8::Context> context, ...@@ -1693,6 +1695,7 @@ std::unique_ptr<ValueMirror> ValueMirror::create(v8::Local<v8::Context> context,
descriptionForCollection( descriptionForCollection(
isolate, memory, memory->Buffer()->ByteLength() / kWasmPageSize)); isolate, memory, memory->Buffer()->ByteLength() / kWasmPageSize));
} }
#if V8_ENABLE_WEBASSEMBLY
if (v8::debug::WasmValueObject::IsWasmValueObject(value)) { if (v8::debug::WasmValueObject::IsWasmValueObject(value)) {
v8::Local<v8::debug::WasmValueObject> object = v8::Local<v8::debug::WasmValueObject> object =
value.As<v8::debug::WasmValueObject>(); value.As<v8::debug::WasmValueObject>();
...@@ -1700,6 +1703,7 @@ std::unique_ptr<ValueMirror> ValueMirror::create(v8::Local<v8::Context> context, ...@@ -1700,6 +1703,7 @@ std::unique_ptr<ValueMirror> ValueMirror::create(v8::Local<v8::Context> context,
value, RemoteObject::SubtypeEnum::Wasmvalue, value, RemoteObject::SubtypeEnum::Wasmvalue,
descriptionForObject(isolate, object)); descriptionForObject(isolate, object));
} }
#endif // V8_ENABLE_WEBASSEMBLY
V8InternalValueType internalType = V8InternalValueType internalType =
v8InternalValueTypeFrom(context, value.As<v8::Object>()); v8InternalValueTypeFrom(context, value.As<v8::Object>());
if (value->IsArray() && internalType == V8InternalValueType::kScopeList) { if (value->IsArray() && internalType == V8InternalValueType::kScopeList) {
......
...@@ -614,7 +614,9 @@ bool CanSubclassHaveInobjectProperties(InstanceType instance_type) { ...@@ -614,7 +614,9 @@ bool CanSubclassHaveInobjectProperties(InstanceType instance_type) {
case WASM_MEMORY_OBJECT_TYPE: case WASM_MEMORY_OBJECT_TYPE:
case WASM_MODULE_OBJECT_TYPE: case WASM_MODULE_OBJECT_TYPE:
case WASM_TABLE_OBJECT_TYPE: case WASM_TABLE_OBJECT_TYPE:
#if V8_ENABLE_WEBASSEMBLY
case WASM_VALUE_OBJECT_TYPE: case WASM_VALUE_OBJECT_TYPE:
#endif // V8_ENABLE_WEBASSEMBLY
return true; return true;
case BIGINT_TYPE: case BIGINT_TYPE:
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "src/api/api-arguments-inl.h" #include "src/api/api-arguments-inl.h"
#include "src/common/globals.h" #include "src/common/globals.h"
#include "src/date/date.h" #include "src/date/date.h"
#include "src/debug/debug-wasm-objects.h"
#include "src/execution/arguments.h" #include "src/execution/arguments.h"
#include "src/execution/frames.h" #include "src/execution/frames.h"
#include "src/execution/isolate.h" #include "src/execution/isolate.h"
...@@ -72,6 +71,10 @@ ...@@ -72,6 +71,10 @@
#include "src/utils/ostreams.h" #include "src/utils/ostreams.h"
#include "src/wasm/wasm-objects.h" #include "src/wasm/wasm-objects.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/debug/debug-wasm-objects.h"
#endif // V8_ENABLE_WEBASSEMBLY
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -2299,8 +2302,10 @@ int JSObject::GetHeaderSize(InstanceType type, ...@@ -2299,8 +2302,10 @@ int JSObject::GetHeaderSize(InstanceType type,
return WasmModuleObject::kHeaderSize; return WasmModuleObject::kHeaderSize;
case WASM_TABLE_OBJECT_TYPE: case WASM_TABLE_OBJECT_TYPE:
return WasmTableObject::kHeaderSize; return WasmTableObject::kHeaderSize;
#if V8_ENABLE_WEBASSEMBLY
case WASM_VALUE_OBJECT_TYPE: case WASM_VALUE_OBJECT_TYPE:
return WasmValueObject::kHeaderSize; return WasmValueObject::kHeaderSize;
#endif // V8_ENABLE_WEBASSEMBLY
case WASM_EXCEPTION_OBJECT_TYPE: case WASM_EXCEPTION_OBJECT_TYPE:
return WasmExceptionObject::kHeaderSize; return WasmExceptionObject::kHeaderSize;
default: default:
......
...@@ -311,7 +311,9 @@ VisitorId Map::GetVisitorId(Map map) { ...@@ -311,7 +311,9 @@ VisitorId Map::GetVisitorId(Map map) {
case WASM_MEMORY_OBJECT_TYPE: case WASM_MEMORY_OBJECT_TYPE:
case WASM_MODULE_OBJECT_TYPE: case WASM_MODULE_OBJECT_TYPE:
case WASM_TABLE_OBJECT_TYPE: case WASM_TABLE_OBJECT_TYPE:
#if V8_ENABLE_WEBASSEMBLY
case WASM_VALUE_OBJECT_TYPE: case WASM_VALUE_OBJECT_TYPE:
#endif // V8_ENABLE_WEBASSEMBLY
case JS_BOUND_FUNCTION_TYPE: { case JS_BOUND_FUNCTION_TYPE: {
const bool has_raw_data_fields = const bool has_raw_data_fields =
COMPRESS_POINTERS_BOOL && JSObject::GetEmbedderFieldCount(map) > 0; COMPRESS_POINTERS_BOOL && JSObject::GetEmbedderFieldCount(map) > 0;
......
...@@ -224,7 +224,7 @@ class ZoneForwardList; ...@@ -224,7 +224,7 @@ class ZoneForwardList;
V(WasmStruct) \ V(WasmStruct) \
V(WasmTypeInfo) \ V(WasmTypeInfo) \
V(WasmTableObject) \ V(WasmTableObject) \
V(WasmValueObject) \ IF_WASM(V, WasmValueObject) \
V(WeakFixedArray) \ V(WeakFixedArray) \
V(WeakArrayList) \ V(WeakArrayList) \
V(WeakCell) \ V(WeakCell) \
......
...@@ -1002,7 +1002,9 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3, T4 p4) { ...@@ -1002,7 +1002,9 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3, T4 p4) {
case WASM_MEMORY_OBJECT_TYPE: case WASM_MEMORY_OBJECT_TYPE:
case WASM_MODULE_OBJECT_TYPE: case WASM_MODULE_OBJECT_TYPE:
case WASM_TABLE_OBJECT_TYPE: case WASM_TABLE_OBJECT_TYPE:
#if V8_ENABLE_WEBASSEMBLY
case WASM_VALUE_OBJECT_TYPE: case WASM_VALUE_OBJECT_TYPE:
#endif // V8_ENABLE_WEBASSEMBLY
return Op::template apply<JSObject::BodyDescriptor>(p1, p2, p3, p4); return Op::template apply<JSObject::BodyDescriptor>(p1, p2, p3, p4);
case WASM_INSTANCE_OBJECT_TYPE: case WASM_INSTANCE_OBJECT_TYPE:
return Op::template apply<WasmInstanceObject::BodyDescriptor>(p1, p2, p3, return Op::template apply<WasmInstanceObject::BodyDescriptor>(p1, p2, p3,
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "src/debug/debug-evaluate.h" #include "src/debug/debug-evaluate.h"
#include "src/debug/debug-frames.h" #include "src/debug/debug-frames.h"
#include "src/debug/debug-scopes.h" #include "src/debug/debug-scopes.h"
#include "src/debug/debug-wasm-objects.h"
#include "src/debug/debug.h" #include "src/debug/debug.h"
#include "src/debug/liveedit.h" #include "src/debug/liveedit.h"
#include "src/execution/arguments-inl.h" #include "src/execution/arguments-inl.h"
...@@ -32,6 +31,10 @@ ...@@ -32,6 +31,10 @@
#include "src/snapshot/snapshot.h" #include "src/snapshot/snapshot.h"
#include "src/wasm/wasm-objects-inl.h" #include "src/wasm/wasm-objects-inl.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/debug/debug-wasm-objects.h"
#endif // V8_ENABLE_WEBASSEMBLY
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -221,13 +224,16 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate, ...@@ -221,13 +224,16 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate,
factory->NewJSArrayWithElements(bound_arguments); factory->NewJSArrayWithElements(bound_arguments);
result->set(5, *arguments_array); result->set(5, *arguments_array);
return factory->NewJSArrayWithElements(result); return factory->NewJSArrayWithElements(result);
} else if (object->IsJSMapIterator()) { }
if (object->IsJSMapIterator()) {
Handle<JSMapIterator> iterator = Handle<JSMapIterator>::cast(object); Handle<JSMapIterator> iterator = Handle<JSMapIterator>::cast(object);
return GetIteratorInternalProperties(isolate, iterator); return GetIteratorInternalProperties(isolate, iterator);
} else if (object->IsJSSetIterator()) { }
if (object->IsJSSetIterator()) {
Handle<JSSetIterator> iterator = Handle<JSSetIterator>::cast(object); Handle<JSSetIterator> iterator = Handle<JSSetIterator>::cast(object);
return GetIteratorInternalProperties(isolate, iterator); return GetIteratorInternalProperties(isolate, iterator);
} else if (object->IsJSGeneratorObject()) { }
if (object->IsJSGeneratorObject()) {
Handle<JSGeneratorObject> generator = Handle<JSGeneratorObject> generator =
Handle<JSGeneratorObject>::cast(object); Handle<JSGeneratorObject>::cast(object);
...@@ -257,7 +263,8 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate, ...@@ -257,7 +263,8 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate,
result->set(4, *receiver); result->set(4, *receiver);
result->set(5, generator->receiver()); result->set(5, generator->receiver());
return factory->NewJSArrayWithElements(result); return factory->NewJSArrayWithElements(result);
} else if (object->IsJSPromise()) { }
if (object->IsJSPromise()) {
Handle<JSPromise> promise = Handle<JSPromise>::cast(object); Handle<JSPromise> promise = Handle<JSPromise>::cast(object);
const char* status = JSPromise::Status(promise->status()); const char* status = JSPromise::Status(promise->status());
Handle<FixedArray> result = factory->NewFixedArray(2 * 2); Handle<FixedArray> result = factory->NewFixedArray(2 * 2);
...@@ -276,7 +283,8 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate, ...@@ -276,7 +283,8 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate,
result->set(2, *promise_value); result->set(2, *promise_value);
result->set(3, *value_obj); result->set(3, *value_obj);
return factory->NewJSArrayWithElements(result); return factory->NewJSArrayWithElements(result);
} else if (object->IsJSProxy()) { }
if (object->IsJSProxy()) {
Handle<JSProxy> js_proxy = Handle<JSProxy>::cast(object); Handle<JSProxy> js_proxy = Handle<JSProxy>::cast(object);
Handle<FixedArray> result = factory->NewFixedArray(3 * 2); Handle<FixedArray> result = factory->NewFixedArray(3 * 2);
...@@ -295,7 +303,8 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate, ...@@ -295,7 +303,8 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate,
result->set(4, *is_revoked_str); result->set(4, *is_revoked_str);
result->set(5, isolate->heap()->ToBoolean(js_proxy->IsRevoked())); result->set(5, isolate->heap()->ToBoolean(js_proxy->IsRevoked()));
return factory->NewJSArrayWithElements(result); return factory->NewJSArrayWithElements(result);
} else if (object->IsJSPrimitiveWrapper()) { }
if (object->IsJSPrimitiveWrapper()) {
Handle<JSPrimitiveWrapper> js_value = Handle<JSPrimitiveWrapper> js_value =
Handle<JSPrimitiveWrapper>::cast(object); Handle<JSPrimitiveWrapper>::cast(object);
...@@ -305,7 +314,8 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate, ...@@ -305,7 +314,8 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate,
result->set(0, *primitive_value); result->set(0, *primitive_value);
result->set(1, js_value->value()); result->set(1, js_value->value());
return factory->NewJSArrayWithElements(result); return factory->NewJSArrayWithElements(result);
} else if (object->IsJSArrayBuffer()) { }
if (object->IsJSArrayBuffer()) {
Handle<JSArrayBuffer> js_array_buffer = Handle<JSArrayBuffer>::cast(object); Handle<JSArrayBuffer> js_array_buffer = Handle<JSArrayBuffer>::cast(object);
if (js_array_buffer->was_detached()) { if (js_array_buffer->was_detached()) {
// Mark a detached JSArrayBuffer and such and don't even try to // Mark a detached JSArrayBuffer and such and don't even try to
...@@ -379,13 +389,17 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate, ...@@ -379,13 +389,17 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate,
} }
return factory->NewJSArrayWithElements(result, PACKED_ELEMENTS, index); return factory->NewJSArrayWithElements(result, PACKED_ELEMENTS, index);
} else if (object->IsWasmInstanceObject()) { }
#if V8_ENABLE_WEBASSEMBLY
if (object->IsWasmInstanceObject()) {
return GetWasmInstanceObjectInternalProperties( return GetWasmInstanceObjectInternalProperties(
Handle<WasmInstanceObject>::cast(object)); Handle<WasmInstanceObject>::cast(object));
} else if (object->IsWasmModuleObject()) { }
if (object->IsWasmModuleObject()) {
return GetWasmModuleObjectInternalProperties( return GetWasmModuleObjectInternalProperties(
Handle<WasmModuleObject>::cast(object)); Handle<WasmModuleObject>::cast(object));
} }
#endif // V8_ENABLE_WEBASSEMBLY
return factory->NewJSArray(0); return factory->NewJSArray(0);
} }
......
...@@ -99,6 +99,7 @@ def MakeClangCommandLine(plugin, plugin_args, arch_cfg, clang_bin_dir, ...@@ -99,6 +99,7 @@ def MakeClangCommandLine(plugin, plugin_args, arch_cfg, clang_bin_dir,
arch_cfg.arch_define, arch_cfg.arch_define,
"-DENABLE_DEBUGGER_SUPPORT", "-DENABLE_DEBUGGER_SUPPORT",
"-DV8_INTL_SUPPORT", "-DV8_INTL_SUPPORT",
"-DV8_ENABLE_WEBASSEMBLY",
"-I./", "-I./",
"-Iinclude/", "-Iinclude/",
"-Iout/build/gen", "-Iout/build/gen",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment