diff --git a/es2panda/compiler/core/pandagen.cpp b/es2panda/compiler/core/pandagen.cpp index c138f1c32361313775621666baabf702eb947f53..23f13899ccb29d7fb9c51a24086b26dc0b5c427e 100644 --- a/es2panda/compiler/core/pandagen.cpp +++ b/es2panda/compiler/core/pandagen.cpp @@ -1903,13 +1903,6 @@ void PandaGen::PopLexEnv(const ir::AstNode *node) ra_.Emit(node); } -void PandaGen::GenDebugger(const ir::AstNode *node) -{ - if (IsDebug()) { - ra_.Emit(node); - } -} - void PandaGen::CopyLexEnv(const ir::AstNode *node) { /* diff --git a/es2panda/compiler/core/pandagen.h b/es2panda/compiler/core/pandagen.h index a11ae280c6c0cb6eab304e8e55950ee3a7e0c6e9..82e45f1c603fbbf0bf4b53acb391032fec0335d1 100644 --- a/es2panda/compiler/core/pandagen.h +++ b/es2panda/compiler/core/pandagen.h @@ -439,7 +439,6 @@ public: void LoadSuperProperty(const ir::AstNode *node, VReg obj, const Operand &prop); void PopLexEnv(const ir::AstNode *node); - void GenDebugger(const ir::AstNode *node); void CopyLexEnv(const ir::AstNode *node); void NewLexicalEnv(const ir::AstNode *node, uint32_t num, binder::VariableScope *scope); void NewLexEnv(const ir::AstNode *node, uint32_t num); diff --git a/es2panda/ir/statements/debuggerStatement.cpp b/es2panda/ir/statements/debuggerStatement.cpp index b4893926db177a3a1b1f4603c2729ecd72346820..739aed9f4a7e4477ee84158170487bca3f3bbd29 100644 --- a/es2panda/ir/statements/debuggerStatement.cpp +++ b/es2panda/ir/statements/debuggerStatement.cpp @@ -14,7 +14,7 @@ */ #include "debuggerStatement.h" -#include + #include namespace panda::es2panda::ir { @@ -26,10 +26,7 @@ void DebuggerStatement::Dump(ir::AstDumper *dumper) const dumper->Add({{"type", "DebuggerStatement"}}); } -void DebuggerStatement::Compile(compiler::PandaGen *pg) const -{ - pg->GenDebugger(this); -} +void DebuggerStatement::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} checker::Type *DebuggerStatement::Check([[maybe_unused]] checker::Checker *checker) const { diff --git a/es2panda/ir/statements/debuggerStatement.h b/es2panda/ir/statements/debuggerStatement.h index 7159bab04270d174413f1d12c9e18f44f8d5b7e6..87c4a9d011282b57fcb1c71b105f1f20d259071c 100644 --- a/es2panda/ir/statements/debuggerStatement.h +++ b/es2panda/ir/statements/debuggerStatement.h @@ -35,7 +35,7 @@ public: void Iterate(const NodeTraverser &cb) const override; void Dump(ir::AstDumper *dumper) const override; - void Compile(compiler::PandaGen *pg) const override; + void Compile([[maybe_unused]] compiler::PandaGen *pg) const override; checker::Type *Check([[maybe_unused]] checker::Checker *checker) const override; void UpdateSelf([[maybe_unused]] const NodeUpdater &cb, [[maybe_unused]] binder::Binder *binder) override; diff --git a/es2panda/test/debugger/debugger-in-debug/base.js b/es2panda/test/debugger/debugger-in-debug/base.js deleted file mode 100644 index 66608271746acfb661387fffd3a9c4eb9770a5f9..0000000000000000000000000000000000000000 --- a/es2panda/test/debugger/debugger-in-debug/base.js +++ /dev/null @@ -1,7 +0,0 @@ -let b = 0; -debugger -function A () { - b = 100; - debugger - b = 200; -} \ No newline at end of file diff --git a/es2panda/test/debugger/debugger-in-debug/expected.txt b/es2panda/test/debugger/debugger-in-debug/expected.txt deleted file mode 100644 index f21421bb54b4cc00975221e1424c5d227cb174ef..0000000000000000000000000000000000000000 --- a/es2panda/test/debugger/debugger-in-debug/expected.txt +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -.language ECMAScript - -.function any .A(any a0, any a1, any a2) { - mov v0, a0 - mov v1, a1 - mov v2, a2 - ldai 0x64 - sta v4 - ldlexvar 0x0, 0x0 - throw.undefinedifholewithname b - lda v4 - sta v4 - lda v4 - stlexvar 0x0, 0x0 - debugger - ldai 0xc8 - sta v4 - ldlexvar 0x0, 0x0 - throw.undefinedifholewithname b - lda v4 - sta v4 - lda v4 - stlexvar 0x0, 0x0 - ldundefined - returnundefined -} - -.function any .func_main_0(any a0, any a1, any a2) { - newlexenvwithname 0x1, _1 - mov v0, a0 - mov v1, a1 - mov v2, a2 - definefunc 0x0, .A, 0x0 - sta v3 - ldai 0x0 - sta v5 - lda v5 - stlexvar 0x0, 0x0 - debugger - ldundefined - returnundefined -} - - diff --git a/es2panda/test/debugger/debugger-in-release/base.js b/es2panda/test/debugger/debugger-in-release/base.js deleted file mode 100644 index 66608271746acfb661387fffd3a9c4eb9770a5f9..0000000000000000000000000000000000000000 --- a/es2panda/test/debugger/debugger-in-release/base.js +++ /dev/null @@ -1,7 +0,0 @@ -let b = 0; -debugger -function A () { - b = 100; - debugger - b = 200; -} \ No newline at end of file diff --git a/es2panda/test/debugger/debugger-in-release/expected.txt b/es2panda/test/debugger/debugger-in-release/expected.txt deleted file mode 100644 index 120a56091e11d60230208afcb213d867ddf71855..0000000000000000000000000000000000000000 --- a/es2panda/test/debugger/debugger-in-release/expected.txt +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -.language ECMAScript - -.function any .A(any a0, any a1, any a2) { -label_1: -label_0: - ldlexvar 0x0, 0x0 - throw.undefinedifholewithname b - ldai 0x64 - stlexvar 0x0, 0x0 - ldlexvar 0x0, 0x0 - throw.undefinedifholewithname b - ldai 0xc8 - stlexvar 0x0, 0x0 - ldundefined - returnundefined -label_2: -} - -.function any .func_main_0(any a0, any a1, any a2) { -label_1: -label_0: - newlexenv 0x1 - definefunc 0x0, .A, 0x0 - ldai 0x0 - stlexvar 0x0, 0x0 - ldundefined - returnundefined -label_2: -} - - diff --git a/es2panda/test/runner.py b/es2panda/test/runner.py index 80a3c985ed1470e21cdc8c10119c643e4310c688..e710c43539869b9d6dcc07d08d32a685e102ade7 100755 --- a/es2panda/test/runner.py +++ b/es2panda/test/runner.py @@ -163,8 +163,6 @@ def get_args(): help='run base64 tests') parser.add_argument('--bytecode', dest='bytecode', action='store_true', default=False, help='run bytecode tests') - parser.add_argument('--debugger', dest='debugger', action='store_true', default=False, - help='run debugger tests') return parser.parse_args() @@ -1180,58 +1178,6 @@ class ColdfixRunner(PatchRunner): self.tests += list(map(lambda t: PatchTest(t, "coldfix"), self.tests_in_dirs)) -class DebuggerTest(Test): - def __init__(self, test_path, mode): - Test.__init__(self, test_path, "") - self.mode = mode - - def run(self, runner): - cmd = runner.cmd_prefix + [runner.es2panda, "--module"] - input_file_name = 'base.js' - if self.mode == "debug-mode": - cmd.extend(['--debug-info']) - cmd.extend([os.path.join(self.path, input_file_name)]) - cmd.extend(['--dump-assembly']) - - - self.log_cmd(cmd) - - process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = process.communicate(timeout=runner.args.es2panda_timeout) - if stderr: - self.passed = False - self.error = stderr.decode("utf-8", errors="ignore") - return self - - self.output = stdout.decode("utf-8", errors="ignore") - - expected_path = os.path.join(self.path, 'expected.txt') - try: - with open(expected_path, 'r') as fp: - expected = (''.join((fp.readlines()[12:]))).lstrip() - self.passed = expected == self.output - except Exception: - self.passed = False - - if not self.passed: - self.error = "expected output:" + os.linesep + expected + os.linesep + "actual output:" + os.linesep +\ - self.output - - return self - - -class DebuggerRunner(Runner): - def __init__(self, args): - Runner.__init__(self, args, "debugger") - self.test_directory = path.join(self.test_root, "debugger") - self.add_test() - - def add_test(self): - self.tests = [] - self.tests.append(DebuggerTest(os.path.join(self.test_directory, "debugger-in-debug"), "debug-mode")) - self.tests.append(DebuggerTest(os.path.join(self.test_directory, "debugger-in-release"), "release-mode")) - - class Base64Test(Test): def __init__(self, test_path, input_type): Test.__init__(self, test_path, "") @@ -1559,9 +1505,6 @@ def main(): if args.coldfix: runners.append(ColdfixRunner(args)) - if args.debugger: - runners.append(DebuggerRunner(args)) - if args.base64: runners.append(Base64Runner(args)) diff --git a/test262/skip_tests.json b/test262/skip_tests.json index 3a82fda381642b23271b64b0386d3285c6e1a2f3..e5480eab9c5489b56fcfdad83c4c98c530b079b7 100644 --- a/test262/skip_tests.json +++ b/test262/skip_tests.json @@ -252,6 +252,7 @@ "language/arguments-object/10.5-7-b-1-s.js", "language/comments/S7.4_A5.js", "language/comments/S7.4_A6.js", + "language/statements/debugger/statement.js", "language/eval-code/direct/cptn-nrml-empty-block.js", "language/eval-code/direct/cptn-nrml-empty-do-while.js", "language/eval-code/direct/cptn-nrml-empty-empty.js",