[Webkit-unassigned] [Bug 40970] New: [PATCH] Add equivalent of one-argument Array constructor functionality to JSC C API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 21 22:54:51 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=40970

           Summary: [PATCH] Add equivalent of one-argument Array
                    constructor functionality to JSC C API
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: caio.oliveira at openbossa.org
                CC: kent.hansen at nokia.com


When passing just one argument to the Array constructor in JavaScript, and its argument is an integer number, it'll create an array with the length equal to the argument, and all the values will be empty. This is implemented internally as a JSArray constructor that takes the length and preallocate part of the internal vector in the array. 

This behaviour is not available for the JSObjectMakeArray in C API, and the alternative of just setting the length property doesn't necessarily will give us the same behaviour as the JavaScript ctor (in this case it seems it doesn't preallocate the internal vector).

We could reuse an invalid input of JSObjectMakeArray, which is argumentsCount > 0 but arguments = NULL (a previously invalid, but not checked, input), to get this functionality. It would mean that one wants to construct an Array with length of argumentCount but since no arguments were given, it would be filled with empty values.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list