diff --git a/ecmascript/compiler/stub_builder.cpp b/ecmascript/compiler/stub_builder.cpp index 394e47316b..6f49c3f964 100644 --- a/ecmascript/compiler/stub_builder.cpp +++ b/ecmascript/compiler/stub_builder.cpp @@ -3946,7 +3946,7 @@ GateRef StubBuilder::ShouldTransToDict(GateRef capacity, GateRef index) Label isLessThanMax(env); Label notLessThanMax(env); BRANCH(Int32LessThanOrEqual(Int32Sub(index, capacity), - Int32(JSObject::MAX_GAP)), &isLessThanMax, ¬LessThanMax); + Int32(JSObject::MAX_GAP)), &isLessThanMax, ¬LessThanMax); Bind(&isLessThanMax); { Label isLessThanInt32Max(env); diff --git a/ecmascript/js_thread.h b/ecmascript/js_thread.h index 8d5f77d05c..086b1afcdc 100644 --- a/ecmascript/js_thread.h +++ b/ecmascript/js_thread.h @@ -55,7 +55,6 @@ class VmThreadControl; class GlobalEnvConstants; enum class ElementsKind : uint8_t; -// NOTE: remove class MachineCode; using JitCodeVector = std::vector>; using JitCodeMapVisitor = std::function&)>; @@ -904,7 +903,7 @@ public: { glueData_.taskInfo_ = taskInfo; } - + uintptr_t GetTaskInfo() const { return glueData_.taskInfo_; diff --git a/ecmascript/stubs/runtime_stubs.cpp b/ecmascript/stubs/runtime_stubs.cpp index 149000ed4b..044680f0fb 100644 --- a/ecmascript/stubs/runtime_stubs.cpp +++ b/ecmascript/stubs/runtime_stubs.cpp @@ -281,8 +281,8 @@ void RuntimeStubs::CopyTypedArrayBuffer(JSTypedArray *srcArray, JSTypedArray *ta } JSTaggedValue srcBuffer = srcArray->GetViewedArrayBufferOrByteArray(); JSTaggedValue targetBuffer = targetArray->GetViewedArrayBufferOrByteArray(); - uint32_t srcByteIndex = static_cast(srcStartPos * elementSize + srcArray->GetByteOffset()); - uint32_t targetByteIndex = static_cast(tarStartPos * elementSize + targetArray->GetByteOffset()); + uint32_t srcByteIndex = static_cast(srcStartPos * elementSize) + srcArray->GetByteOffset(); + uint32_t targetByteIndex = static_cast(tarStartPos * elementSize) + targetArray->GetByteOffset(); uint8_t *srcBuf = (uint8_t *)builtins::BuiltinsArrayBuffer::GetDataPointFromBuffer(srcBuffer, srcByteIndex); uint8_t *targetBuf = (uint8_t *)builtins::BuiltinsArrayBuffer::GetDataPointFromBuffer(targetBuffer, targetByteIndex); diff --git a/tools/circuit_viewer/src/engine/control/XScroll.js b/tools/circuit_viewer/src/engine/control/XScroll.js index fefcbec963..0a64864dfd 100644 --- a/tools/circuit_viewer/src/engine/control/XScroll.js +++ b/tools/circuit_viewer/src/engine/control/XScroll.js @@ -17,8 +17,8 @@ const { X2DFast } = require('../graphics/X2DFast'); class XScroll { constructor(options) { - if (options['type']) { - this.type_ = options['type']; + if (options.type) { + this.type_ = options.type; } else { this.type_ = 'right'; diff --git a/tools/circuit_viewer/src/engine/graphics/X2DFast.js b/tools/circuit_viewer/src/engine/graphics/X2DFast.js index 23e2bb87b4..6941727819 100644 --- a/tools/circuit_viewer/src/engine/graphics/X2DFast.js +++ b/tools/circuit_viewer/src/engine/graphics/X2DFast.js @@ -119,16 +119,36 @@ export class X2DFast { static testTransform(x, y, sw, sh, ra, ox, oy, realw, realh) { X2DFast.tmpMat.unit(); - if (ox === -1) ox = 0; - if (ox === -2) ox = Math.floor(realw / 2); - if (ox === -3) ox = realw; - if (oy === -1) oy = 0; - if (oy === -2) oy = Math.floor(realh / 2); - if (oy === -3) oy = realh; - if (ox !== 0 || oy !== 0) X2DFast.tmpMat.move(-ox, -oy, 0); - if (sw !== 1 || sh !== 1) X2DFast.tmpMat.scale(sw, sh, 1); - if (ra !== 0) X2DFast.tmpMat.rotate(0, 0, ra); - if (x !== 0 || y !== 0) X2DFast.tmpMat.move(x, y, 0); + if (ox === -1) { + ox = 0; + } + if (ox === -2) { + ox = Math.floor(realw / 2); + } + if (ox === -3) { + ox = realw; + } + if (oy === -1) { + oy = 0; + } + if (oy === -2) { + oy = Math.floor(realh / 2); + } + if (oy === -3) { + oy = realh; + } + if (ox !== 0 || oy !== 0) { + X2DFast.tmpMat.move(-ox, -oy, 0); + } + if (sw !== 1 || sh !== 1) { + X2DFast.tmpMat.scale(sw, sh, 1); + } + if (ra !== 0) { + X2DFast.tmpMat.rotate(0, 0, ra); + } + if (x !== 0 || y !== 0) { + X2DFast.tmpMat.move(x, y, 0); + } } clearBuffer() { this.ridDict = {}; @@ -182,7 +202,9 @@ export class X2DFast { let intX = parseInt(x); let intY = parseInt(y); let pcut = XTexture.gi().allCuts[cid]; - if (pcut === null) return; + if (pcut === null) { + return; + } if (!(pcut.rid in this.ridDict)) { if (this.ridPoint >= 16) { this.freshBuffer(); @@ -208,7 +230,9 @@ export class X2DFast { } freshBuffer() { XTexture.gi()._FreshText(); - if (this.drawCount === 0) return; + if (this.drawCount === 0) { + return; + } let ps = XShader.gi().use(XShader.ID_SHADER_FAST); for (let rid in this.ridDict) { gl.activeTexture(gl.TEXTURE0 + this.ridDict[rid]); diff --git a/tools/circuit_viewer/src/engine/graphics/XTexture.js b/tools/circuit_viewer/src/engine/graphics/XTexture.js index aa5ef9e74e..ca691bbf03 100644 --- a/tools/circuit_viewer/src/engine/graphics/XTexture.js +++ b/tools/circuit_viewer/src/engine/graphics/XTexture.js @@ -17,7 +17,9 @@ import { gl } from '../GLFrame.js'; export class XTexture { static gi() { - if (XTexture.pinstance_ === null) XTexture.pinstance_ = new XTexture(); + if (XTexture.pinstance_ === null) { + XTexture.pinstance_ = new XTexture(); + } return XTexture.pinstance_; } constructor() { @@ -103,10 +105,16 @@ export class XTexture { } } TmpCut(rid, x = 0, y = 0, w = -1, h = -1, ww = 1024, hh = 1024) { - if (this.ximages[rid].stat !== 1) return -1; + if (this.ximages[rid].stat !== 1) { + return -1; + } - if (w === -1) w = ww; - if (h === -1) h = hh; + if (w === -1) { + w = ww; + } + if (h === -1) { + h = hh; + } this.allCuts[this.tmpCutid] = { rid: rid, x: x, @@ -126,10 +134,18 @@ export class XTexture { return this.tmpCutid - 1; } makeCut(rid, x = 0, y = 0, w = -1, h = -1, ww = -1, hh = -1) { - if (ww === -1) ww = this.ximages[rid].w; - if (hh === -1) hh = this.ximages[rid].h; - if (w ===-1) w = ww; - if (h === -1) h = hh; + if (ww === -1) { + ww = this.ximages[rid].w; + } + if (hh === -1) { + hh = this.ximages[rid].h; + } + if (w ===-1) { + w = ww; + } + if (h === -1) { + h = hh; + } this.allCuts[this.aiCutid] = { rid: rid, x: x, @@ -198,7 +214,9 @@ export class XTexture { h -= 1; for (x = 0; x < 128; x++) { let p = (h * 1024 + x) * 4; - if (imgd[p] !== 0) break; + if (imgd[p] !== 0) { + break; + } } } let y = h; @@ -206,7 +224,9 @@ export class XTexture { w -= 1; for (y = 0; y < h; y++) { let p = (y * 1024 + w) * 4; - if (imgd[p] !== 0) break; + if (imgd[p] !== 0) { + break; + } } } return this.textCtx.getImageData(0, 0, w + 1, h + 1); diff --git a/tools/circuit_viewer/src/index.js b/tools/circuit_viewer/src/index.js index dfd3fd8b86..0be0310404 100644 --- a/tools/circuit_viewer/src/index.js +++ b/tools/circuit_viewer/src/index.js @@ -26,8 +26,8 @@ canvas.height = window.innerHeight; function myDraw() { if ( - canvas.width != window.innerWidth - sideWidth || - canvas.height != window.innerHeight + canvas.width !== window.innerWidth - sideWidth || + canvas.height !== window.innerHeight ) { canvas.width = window.innerWidth - sideWidth; canvas.height = window.innerHeight; diff --git a/tools/circuit_viewer/src/ir/IrToPicture.js b/tools/circuit_viewer/src/ir/IrToPicture.js index 7c506d05c9..de813021d3 100644 --- a/tools/circuit_viewer/src/ir/IrToPicture.js +++ b/tools/circuit_viewer/src/ir/IrToPicture.js @@ -94,8 +94,8 @@ class IrToPicture { static toPicture(irList, type, isBlock) { let nodes = {}; let entry = -1; - for (let ir of irList) { //用于生成图的所有节点 - if (type === 0) { //仅控制流 + for (let ir of irList) {//用于生成图的所有节点 + if (type === 0) {//仅控制流 if (this.nodeType(ir) !== 'control') { continue; } diff --git a/tools/circuit_viewer/src/ir/IrViewer.js b/tools/circuit_viewer/src/ir/IrViewer.js index 6f1680ebd9..f64cc15866 100644 --- a/tools/circuit_viewer/src/ir/IrViewer.js +++ b/tools/circuit_viewer/src/ir/IrViewer.js @@ -694,7 +694,7 @@ class IrViewer { this.offx_ = (-this.scrollX_.getBarOff()) * this.dragScoll.ww - this.dragScoll.x1; } - checkMsgAndDrapSelect_(msg, x, y){ + checkMsgAndDrapSelect_(msg, x, y) { if (msg === 3 && this.drapSelect_) { let nodes = this.visable_.nodes; for (let k of this.selectPoint_) { @@ -705,7 +705,7 @@ class IrViewer { } } - checkDrapBackground_(msg, x, y){ + checkDrapBackground_(msg, x, y) { if (this.drapBackground_) { if (msg === 2) { this.offx_ -= this.drapBackground_.x - x; @@ -715,9 +715,10 @@ class IrViewer { } return true; } + return false; } - checkDrapSelect_(msg, x, y){ + checkDrapSelect_(msg, x, y) { if (this.drapSelect_) { if (msg === 2) { if (Math.abs(this.drapSelect_.x - x) > 10 || @@ -732,9 +733,10 @@ class IrViewer { } return true; } + return false; } - checkSearchInput(msg, x, y){ + checkSearchInput(msg, x, y) { if (this.searchInput) { if (XTools.InRect(x, y, ...this.searchInput.pos)) { if (this.searchInput.btnUp.onTouch(msg, x, y)) { @@ -759,10 +761,12 @@ class IrViewer { } return true; } + return false; } + return false; } - checkMsg(msg, x, y){ + checkMsg(msg, x, y) { if (msg === 1) { let nodes = this.visable_.nodes; for (let k in nodes) { @@ -790,6 +794,7 @@ class IrViewer { } this.selectPoint_ = []; } + return false; } onTouch(msg, x, y) {