|
| 1 | +Import-Module (Join-Path $PSScriptRoot "..\utils.psm1") |
| 2 | + |
| 3 | +function Patch { |
| 4 | + param([string]$Content) |
| 5 | + |
| 6 | + $Content = Edit-FunctionBody -Content $Content ` |
| 7 | + -FunctionName "void SharedFunctionInfo::SharedFunctionInfoPrint" ` |
| 8 | + -Converter { |
| 9 | + param($Body) |
| 10 | + $Body = Set-CommentLine -Content $Body -Pattern "\s*PrintSourceCode\(os\);" |
| 11 | + $Body += "`n" |
| 12 | + $Body += @" |
| 13 | + os << "\nStart BytecodeArray\n"; |
| 14 | + this->GetActiveBytecodeArray(isolate)->Disassemble(os); |
| 15 | + os << "\nEnd BytecodeArray\n"; |
| 16 | + os << std::flush; |
| 17 | +"@ |
| 18 | + return $Body |
| 19 | + } |
| 20 | + |
| 21 | + $Content = Edit-FunctionBody -Content $Content ` |
| 22 | + -FunctionName "void HeapObject::HeapObjectShortPrint" ` |
| 23 | + -Converter { |
| 24 | + param($Body) |
| 25 | + $Body = Add-LineBefore -Content $Body ` |
| 26 | + -Pattern '\s*switch \(map\(cage_base\)->instance_type\(\)\) {' ` |
| 27 | + -Insert @" |
| 28 | + if (map(cage_base).instance_type() == ASM_WASM_DATA_TYPE) { |
| 29 | + os << "<ArrayBoilerplateDescription> "; |
| 30 | + Cast<ArrayBoilerplateDescription>(*this) |
| 31 | + ->constant_elements() |
| 32 | + ->HeapObjectShortPrint(os); |
| 33 | + return; |
| 34 | + } |
| 35 | +"@ |
| 36 | + $Body = Add-LineBelow -Content $Body ` |
| 37 | + -Patterns @('case FIXED_ARRAY_TYPE:', ';') ` |
| 38 | + -Insert @" |
| 39 | + os << "\nStart FixedArray\n"; |
| 40 | + Cast<FixedArray>(*this)->FixedArrayPrint(os); |
| 41 | + os << "\nEnd FixedArray\n"; |
| 42 | +"@ |
| 43 | + $Body = Add-LineBelow -Content $Body ` |
| 44 | + -Patterns @('case OBJECT_BOILERPLATE_DESCRIPTION_TYPE:', ';') ` |
| 45 | + -Insert @" |
| 46 | + os << "\nStart ObjectBoilerplateDescription\n"; |
| 47 | + Cast<ObjectBoilerplateDescription>(*this) |
| 48 | + ->ObjectBoilerplateDescriptionPrint(os); |
| 49 | + os << "\nEnd ObjectBoilerplateDescription\n"; |
| 50 | +"@ |
| 51 | + $Body = Add-LineBelow -Content $Body ` |
| 52 | + -Patterns @('case FIXED_DOUBLE_ARRAY_TYPE:', ';') ` |
| 53 | + -Insert @" |
| 54 | + os << "\nStart FixedDoubleArray\n"; |
| 55 | + Cast<FixedDoubleArray>(*this)->FixedDoubleArrayPrint(os); |
| 56 | + os << "\nEnd FixedDoubleArray\n"; |
| 57 | +"@ |
| 58 | + $Body = Add-LineBelow -Content $Body ` |
| 59 | + -Patterns @('case SHARED_FUNCTION_INFO_TYPE:', 'else', '}') ` |
| 60 | + -Insert @" |
| 61 | + os << "\nStart SharedFunctionInfo\n"; |
| 62 | + shared->SharedFunctionInfoPrint(os); |
| 63 | + os << "\nEnd SharedFunctionInfo\n"; |
| 64 | +"@ |
| 65 | + return $Body |
| 66 | + } |
| 67 | + |
| 68 | + return $Content |
| 69 | +} |
0 commit comments