@@ -10319,10 +10319,16 @@ int debug::WasmValue::value_type() {
1031910319 return obj->value_type ();
1032010320}
1032110321
10322- v8::Local<v8::Value > debug::WasmValue::bytes () {
10322+ v8::Local<v8::Array > debug::WasmValue::bytes () {
1032310323 i::Handle<i::WasmValue> obj = Utils::OpenHandle (this );
10324+ // Should only be called on i32, i64, f32, f64, s128.
10325+ DCHECK_GE (1 , obj->value_type ());
10326+ DCHECK_LE (5 , obj->value_type ());
10327+
1032410328 i::Isolate* isolate = obj->GetIsolate ();
10325- i::Handle<i::ByteArray> bytes (obj->bytes (), isolate);
10329+ i::Handle<i::Object> bytes_or_ref (obj->bytes_or_ref (), isolate);
10330+ i::Handle<i::ByteArray> bytes (i::Handle<i::ByteArray>::cast (bytes_or_ref));
10331+
1032610332 int length = bytes->length ();
1032710333
1032810334 i::Handle<i::FixedArray> fa = isolate->factory ()->NewFixedArray (length);
@@ -10337,6 +10343,17 @@ v8::Local<v8::Value> debug::WasmValue::bytes() {
1033710343 return Utils::ToLocal (arr);
1033810344}
1033910345
10346+ v8::Local<v8::Value> debug::WasmValue::ref () {
10347+ i::Handle<i::WasmValue> obj = Utils::OpenHandle (this );
10348+ // Should only be called on anyref.
10349+ DCHECK_EQ (6 , obj->value_type ());
10350+
10351+ i::Isolate* isolate = obj->GetIsolate ();
10352+ i::Handle<i::Object> bytes_or_ref (obj->bytes_or_ref (), isolate);
10353+
10354+ return Utils::ToLocal (bytes_or_ref);
10355+ }
10356+
1034010357bool debug::WasmValue::IsWasmValue (Local<Value> that) {
1034110358 i::Handle<i::Object> obj = Utils::OpenHandle (*that);
1034210359 return obj->IsWasmValue ();
0 commit comments