<commit_before>function print() {
    __asmh__({},"#include <stdio.h>");
    for ( var i = 0, e = arguments.length; i < e; ++i ) {
        if (i > 0)
            __asm__({},[],[],[],"putchar(' ');");
        __asm__({},[],[["x", arguments[i]]],[],
                '%[x] = js::toString(%[%frame], %[x]);\n'+
                'printf("%s", %[x].raw.sval->getStr());'
        );
    }
    __asm__({},[],[],[],"putchar('\\n');");
}

var console = { log: print };

Function.prototype.call = function call (thisArg)
{
    return __asm__({},["result"],[["thisArg", thisArg]],[],
        '%[result] = %[%argc] > 1' +
            '? js::call(%[%frame], %[%argv][0], %[%argc]-1, %[%argv]+1)' +
            ': js::call(%[%frame], %[%argv][0], 1, &%[thisArg]);'
    );
};

Object.create = function Object_create (proto)
{
    return __asm__({},["result"],[["proto",proto]],[],
        "%[result] = js::makeObjectValue(js::objectCreate(%[%frame], %[proto]));"
    );
};

function Error (message)
{<commit_msg>runtime[core.js]: teach print() to print arrays<commit_after>function print() {
    __asmh__({},"#include <stdio.h>");

    function pr (x)
    {
        __asm__({},[],[["x", x]],[],
            '%[x] = js::toString(%[%frame], %[x]);\n'+
            'printf("%s", %[x].raw.sval->getStr());'
        );
    }

    function printVal (val)
    {
        if (val instanceof Array) {
            pr("[ ");
            for ( var i = 0, e = val.length; i < e; ++i ) {
                if (i > 0)
                    pr(", ");
                var elem = val[i];
                if (elem !== void 0)
                    printVal(elem);
            }
            pr(" ]");
        } else
            pr(val);
    }

    for ( var i = 0, e = arguments.length; i < e; ++i ) {
        if (i > 0)
            pr(" ");
        printVal(arguments[i]);
    }
    pr("\n");
}

var console = { log: print };

Function.prototype.call = function call (thisArg)
{
    return __asm__({},["result"],[["thisArg", thisArg]],[],
        '%[result] = %[%argc] > 1' +
            '? js::call(%[%frame], %[%argv][0], %[%argc]-1, %[%argv]+1)' +
            ': js::call(%[%frame], %[%argv][0], 1, &%[thisArg]);'
    );
};

Object.create = function Object_create (proto)
{
    return __asm__({},["result"],[["proto",proto]],[],
        "%[result] = js::makeObjectValue(js::objectCreate(%[%frame], %[proto]));"
    );
};

function Error (message)
{
{'fraction_non_alphanumeric': 0.26370431893687707, 'fraction_numerical': 0.007890365448504983, 'mean_word_length': 2.2335570469798656, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7105797', 'n_tokens_mistral': 872, 'n_tokens_neox': 861, 'n_words': 159}