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

29 Commits

Author SHA1 Message Date
Robert Krimen
ad8a97c028 New parser
* Faster, more straightforward, etc.
* More advanced object literals (get ..., set ...)
* More tests using JavaScript from the wild (http://cdnjs.com/)
2014-04-10 20:42:25 -07:00
Robert Krimen
3ba06f003c Fix NaN/+0/-0 comparison in Array.prototype.indexOf 2014-01-24 21:20:22 -08: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
83c56dd73d Add Otto.Call 2013-05-19 19:03:05 -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
3f54041eb6 Make sure to evaluate (compare) in the proper order 2013-04-20 19:39:52 -07:00
Robert Krimen
7d0ac026ea Unary postfix operation: return primitive value, not object (or otherwise) 2013-04-17 10:46:00 -07:00
Robert Krimen
bada1b6b24 Fix passing the wrong value to calculateBinaryOperation
Was passing left instead of leftValue
2013-03-05 18:10:14 -08:00
Robert Krimen
283dffe841 Can delete an undefined reference 2013-03-05 17:49:15 -08:00
Robert Krimen
16a30ee951 Differentiate between direct and indirect eval 2013-02-27 21:23:21 -08:00
Robert Krimen
c5f05dd873 Rework _reference interface to correspond to ECMA more closely 2013-02-25 13:26:12 -08:00
Robert Krimen
321cc0dca8 Add _argumentsStash, with better conforming arguments behavior:
1. Can not delete a function parameter
    2. Deleting the index of an arguments object simply
       removes the link to that function parameter
2013-02-24 14:28:07 -08:00
Robert Krimen
ed8569f1ad Use math.Copysign for unary negation 2013-02-22 11:49:41 -08:00
Robert Krimen
bdaa00884d toU16/U32/I32 => toUint16/Uint32/Int32 2013-02-18 15:58:48 -08:00
Robert Krimen
aaa90bf65c Fix HasInstace (instanceof) to return false
Should not TypeError panic on a non-Object
2013-02-04 15:21:00 -08:00
Robert Krimen
20d2e8bba6 gofmt
Ugh.
2013-01-25 09:59:42 -08:00
Robert Krimen
0498f06be0 Fix trying to delete non-reference 2012-11-14 11:09:52 -08:00
Robert Krimen
aa3109f8db typeof null === "object" 2012-11-05 13:57:18 -08:00
Robert Krimen
7ab5365515 Pass back result of "delete ..." (true or false) 2012-11-05 13:46:54 -08:00
Robert Krimen
6d132f8fe5 Pass in base value as-is, ...? 2012-11-05 13:44:04 -08:00
Robert Krimen
efc94517dd _objectReference => _propertyReference 2012-11-05 13:33:29 -08:00
Robert Krimen
3c93384f5c Cleanup of stash, property, and object
Use octal to designate write/enumerate/configure (experimental)
Move extensibility responsibility into the stash
Rename propertyStash => objectStash (be congruent with arrayStash, etc.)
Get rid of a bunch of useless methods
Privatize everything ([A-Z] => [a-z_])
gofmt
2012-10-26 15:47:19 -07:00
Robert Krimen
c1a21812fe Fix trying to call a non-function as a function 2012-10-22 14:29:14 -07:00
Robert Krimen
a31375b07b Adjusted commentary on evaluateIdentifier 2012-10-09 17:49:33 -07:00
Robert Krimen
c6e45a7118 Change getIdentifierReference to accept a node argument
To track/report where errors are coming from
2012-10-09 17:26:08 -07:00
Robert Krimen
ade6a169be Partially fix ReferenceError origin reporting 2012-10-09 17:19:29 -07:00
Robert Krimen
979a87a79d Fix casing on evaluateNew 2012-10-07 18:39:12 -07:00
Robert Krimen
4a8c7ffc00 Initial commit 2012-10-05 18:47:53 -07:00