1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-12 20:27:30 +08:00
Commit Graph

16 Commits

Author SHA1 Message Date
Robert Krimen
1df390a237 Fix String.prototype.lastIndexOf 2014-01-24 21:20:22 -08:00
Robert Krimen
60b6d1190f Fix String.prototype.indexOf to return the right index even with an offset 2014-01-24 21:20:22 -08:00
Robert Krimen
b49fd47f78 Fix special case in String.prototype.split 2014-01-24 21:20:22 -08:00
Robert Krimen
f0aa5da996 Fix off-by-one error with $' in String.prototype.replace 2014-01-24 21:20:22 -08:00
Robert Krimen
33672f5c98 Add String.toLocaleUpperCase 2013-07-14 14:38:59 -07:00
Robert Krimen
3d883a981e Add String.toLocaleLowerCase 2013-07-14 14:35:50 -07:00
Robert Krimen
1481c43476 Add String.trim (robertkrimen) 2013-07-14 14:20:01 -07:00
Robert Krimen
19360eafc4 Add String.localeCompare 2013-07-14 14:20:01 -07:00
Tim Jurcka
dd7d387420 Add String.prototype.trim(), and non-standard trimLeft(), trimRight()
This fixes #32
2013-07-14 14:19:06 -07: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
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
4c85422172 Make encodeURI correspond to the 15.1.3.3 algorithm and encodeURIComponent ito 15.1.3.4 2013-05-02 20:23:06 +02:00
Robert Krimen
3c9faa2810 Fix String.char*At to look at utf16 version 2013-02-21 14:25:04 -08: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