Skip to content

Commit

Permalink
builtins/string: repeat empty special case
Browse files Browse the repository at this point in the history
test262: 55.44% | 🧪 50257 | 🤠 27862 (+1) | ❌ 7132 | 💀 14044 | 🏗️ 32 | 💥 177 | ⏰ 11 (-1) | 📝 999
  • Loading branch information
CanadaHonk committed Dec 24, 2024
1 parent c1512ed commit 611600b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions compiler/builtins/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,8 @@ export const __String_prototype_repeat = (_this: string, cnt: any) => {

let out: string = Porffor.allocate();
const thisLen: i32 = _this.length * 2;
if (thisLen == 0) return '';

for (let i: i32 = 0; i < count; i++) {
Porffor.wasm`
;; dst = out + 4 + i * thisLen
Expand Down Expand Up @@ -1194,6 +1196,8 @@ export const __ByteString_prototype_repeat = (_this: string, cnt: any) => {

let out: bytestring = Porffor.allocate();
const thisLen: i32 = _this.length;
if (thisLen == 0) return '';

for (let i: i32 = 0; i < count; i++) {
Porffor.wasm`
;; dst = out + 4 + i * thisLen
Expand Down
6 changes: 3 additions & 3 deletions compiler/builtins_precompiled.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "porffor",
"description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
"version": "0.55.10",
"version": "0.55.11",
"author": "CanadaHonk",
"license": "MIT",
"scripts": {},
Expand Down
2 changes: 1 addition & 1 deletion runner/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import fs from 'node:fs';
globalThis.version = '0.55.10';
globalThis.version = '0.55.11';

// deno compat
if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion test262/history.json

Large diffs are not rendered by default.

0 comments on commit 611600b

Please sign in to comment.