1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-26 20:28:49 +08:00
Commit Graph

26 Commits

Author SHA1 Message Date
Robert Krimen
56429ee75b Fix placement of elements during Array.prototype.concat
Increase the index even if the element at the index does not exist
2014-01-24 21:20:22 -08:00
Robert Krimen
c8dbfa3536 Fix inadvertent stringification in Array.prototype.concat 2014-01-24 21:20:22 -08:00
Robert Krimen
3ed7305787 Fix NaN/+0/-0 comparison in Array.prototype.lastIndexOf 2014-01-24 21:20:22 -08:00
Robert Krimen
3ba06f003c Fix NaN/+0/-0 comparison in Array.prototype.indexOf 2014-01-24 21:20:22 -08:00
Robert Krimen
81d91501f8 Handle non-numeric arguments to new Array properly 2014-01-22 20:30:10 -08:00
Robert Krimen
ca0a007083 RangeError if Array.length = 3.141, new Array(3.141), etc. 2013-08-11 14:59:31 -07:00
Robert Krimen
761b60eed6 Refine parts of builtin_array.go 2013-07-14 14:20:01 -07:00
Robert Krimen
40d01ced6e Add Array.reduceRight (sdgoij) 2013-06-23 15:29:33 +02:00
Robert Krimen
1b70913ef7 Add Array.reduce (sdgoij) 2013-06-23 14:56:26 +02:00
Robert Krimen
bbc7992385 Add Array.filter (sdgoij) 2013-06-23 14:44:41 +02:00
Robert Krimen
d4a09639a9 Add Array.map (sdgoij) 2013-06-23 14:37:26 +02:00
Robert Krimen
11d011e6a3 Add Array.forEach (sdgoij) 2013-06-23 14:00:01 +02:00
Robert Krimen
b800b809a2 Add Array.some (sdgoij) 2013-06-23 13:48:03 +02:00
Robert Krimen
a4c76f3818 Array.concat does not require length be a Uint32 2013-06-22 15:51:53 +02:00
Robert Krimen
4ebf6416d0 Fix Uint32 Array/String indexing
Also, a bunch of toValue_* streamlining
And maybe a few miscellaneous tweaks
2013-06-22 15:49:22 +02:00
Robert Krimen
48607926f1 Add Array.every (sdgoij) 2013-06-16 15:31:15 -07:00
Robert Krimen
e2eb18cd4c Add toValue_* for more straightforward value conversion
(When the type being converted is obvious.)
2013-06-16 15:12:46 -07:00
Robert Krimen
b95b59a11a Fix Array.indexOf to be compliant with 15.4.4.14 2013-06-16 14:55:30 -07:00
Robert Krimen
2479aa628b Add Array.lastIndexOf (sdgoij) 2013-06-16 14:55:12 -07:00
Robert Krimen
6b4c8ec2b2 Add Array.indexOf (sdgoij) 2013-06-16 14:13:43 -07:00
Robert Krimen
9fe41e1df9 Add Array.toLocaleString 2013-06-15 18:02:13 -07:00
Robert Krimen
c55510cb36 Inline context initialization & improve _object.value
* Context setup is now done via _newContext.
* _newContext is a function that resides in inline.go. _newContext is very flat,
resulting in almost no function calls (a 180 from the earlier status quo).
* inline.go is a Go source file that is built by Perl (via inline).
* Lots of crufty functions removed (along with all of their TODO & FIXME).
* In addition, before, the underlying value of _object.value was a pointer to
something. This made for extra work, since the type of _object.value is interface{},
which is already something of a pointer. Now, the underlying value of _object.value
in Function, Date, RegExp, ..., is a struct value.
* type_function.go was streamlined, removing superfluous struct fields and methods.
* There is now less "digging" to get to the actual value of a function, which is important
when makings lots of calls.

Before (without inline):

    PASS
    BenchmarkNew        2000           1067871 ns/op
    ok      github.com/robertkrimen/otto    3.336s
    PASS
    BenchmarkNew        2000           1077644 ns/op
    ok      github.com/robertkrimen/otto    3.367s

After (with inline):

    PASS
    BenchmarkNew       10000            364418 ns/op
    ok      github.com/robertkrimen/otto    4.616s
    PASS
    BenchmarkNew       10000            307241 ns/op
    ok      github.com/robertkrimen/otto    4.051s

This (partially) fixes #22
2013-06-09 18:28:18 -07:00
Robert Krimen
7e2b4f2063 Rewrite of property handling to be more robust and compliant
* No more _stash
* Now using a "virtual table" system via _objectClass
* Make Array.concat GoArray compatible (via .isArray())

Fix #16
2013-05-12 14:14:51 -07:00
Robert Krimen
0da0545485 Add Array.isArray 2013-04-17 11:05:32 -07:00
Robert Krimen
bf322e56ee Fix subtle range bug in String.substring (uint => int64)
Was looking for negative in the following calculation:

uint(0) - uint(3) => uint(0)
2013-02-20 16:24:01 -08:00
Robert Krimen
ec902a6452 Split builtin.go out to builtin_*.go 2013-02-20 15:58:45 -08:00