Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug489326 builtin objects (from 'ES5-Test262 progress' pull request) #46

Merged
merged 43 commits into from
Feb 10, 2015

Conversation

anba
Copy link
Contributor

@anba anba commented May 29, 2012

This part of #39 does not involve any public API changes but merely updates the built-in objects to work in a more spec-compliant way. For the most part this affects handling of undefined arguments, missing methods to change attributes in IdScriptableObjects instances (i.e. missing setInstanceIdAttributes() overrides) and wrong execution order of spec algorithm steps.

anba added 30 commits May 26, 2012 12:46
test cases:
- ch15/15.9/15.9.4/S15.9.4_A5
- ch15/15.9/15.9.5/15.9.5.1/S15.9.5.1_A2_T1
- ch15/15.9/15.9.4/15.9.4.3/S15.9.4.3_A2_T1
…luate all parameters)

Make sure all arguments to Date.prototype.set[UTC]{Milliseconds, Seconds, Minutes, Hours, Date, Month, FullYear} are fully evaluated b/c of possible side-effects. Code also re-sync'ed with jsdate.cpp.

test case:
- ecma_5/Date/setTime-argument-shortcircuiting.js
…Format with expanded year representation if necessary
… Format [15.9.1.15]

- don't use Java's DateFormat to parse/format dates from/into ISO-8601 Extended Format strings since DateFormat doesn't follow the syntax from 15.9.1.15  Date Time String Format
- add DaysInMonth method with same contract as DaysInMonth from jsdate.cpp
- add parseISOString method with same contract as in jsdate.cpp, but use a simple state machine since Java doesn't support macros
- parseISOString supports the following two deviations from the spec:
  1) time-only format, e.g. "08:00:00Z"
  2) timezone descriptor without ':' as separator, e.g. "08:00:00+0100" instead of "08:00:00+01:00"
- parseISOString also supports the same input validation as in jsdata.cpp, the spec isn't really clear what to do with invalid input data
… enumerable

test cases:
- ch15/15.11/15.11.4/15.11.4.2/15.11.4.2-1
- ch15/15.11/15.11.4/15.11.4.3/15.11.4.3-1
- handle `undefined` value for message in constructor
- follow spec for 15.11.4.4  Error.prototype.toString more closely

test cases:
- ch15/15.11/15.11.4/15.11.4.4/*
…perty, instead it inherits 'constructor' through its prototype

test:
`(function(){ return arguments.hasOwnProperty('constructor') })() === false`
test case:
- ch15/15.3/15.3.4/15.3.4.2/S15.3.4.2_A11
…ng/setting elements

ScriptRuntime#getObjectProp() reports undefined property warnings when the strict-mode feature is enabled.
- removed indexOfHelper method, indexOf and lastIndexOf now use seperate methods since the amount of shared lines was negliglible to justify the added non-uniformness compared to the other js_* methods
- 15.4.4.14  Array.prototype.indexOf uses [[Get]], therefore add search for prototype values in the dense-array case
- 15.4.4.15  Array.prototype.lastIndexOf uses [[Get]], therefore add search for prototype values in the dense-array case
- follow spec for 15.4.4.11  Array.prototype.sort more closely w.r.t undefined and not-defined properties
…followed more closely

- defineElem: helper method just like setElem(), but uses [[DefineOwnProperty]] instead of [[Put]]
- shift/pop: explicitely call deleteElem() because `thisObject` may not be an Array instance
- unshift: always call setLengthProperty() to ensure update to 'length' property b/c it may be implicitely updated due to call to ToUint32 in step 3 of 15.4.4.13  Array.prototype.unshift
- splice: add missing calls to [[Delete]], see step 12.d of 15.4.4.12  Array.prototype.splice
- concat: 15.4.4.4  Array.prototype.concat uses [[DefineOwnProperty]] instead of [[Put]]
- slice: handle case when first argument is `undefined`
- slice: 15.4.4.10  Array.prototype.slice uses [[DefineOwnProperty]] instead of [[Put]]
- filter/map: 'filter' and 'map' use [[DefineOwnProperty]] instead of [[Put]]
Add cache for native error objects to the TopLevel class for the very same reason we've got a cache for the other built-ins; But don't add helper methods to TopLevel to retrieve the prototype property of native errors since its always the same one; And finally use the new helper method to construct the error object in ScriptRuntime#newCatchScope()

Also remove "ConversionError" to pass ch15/15.11/15.11-1
…[[Get]] exactly once for each property entry
anba added 12 commits May 29, 2012 14:21
…ce,split}

- String.prototype.replace erroneously created a RegExp if the first argument was not already an instanceof RegExp
- move NativeRegExp creation out of matchOrReplace into a new method
- handle `undefined` arguments for String.prototype.{match, search, replace}
- follow String.prototype.split algorithm steps more closely
…ject inherits the 'constructor' property through its prototype
Fix bugs in octal escape sequences for regular expressions and make try to follow 'web reality' resp. Spidermonkey more closely
@anba anba mentioned this pull request May 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants