We'd really like the LiveSavedFrameCache to be able to assert that, if a frame
has its hasCachedSavedFrame bit set, there is indeed a cache entry for it (if
the cache hasn't been cleared completely for a compartment mismatch). See the
explanation of LiveSavedFrameCache in Stack.h, and the comments in
LiveSavedFrameCache::find.
Sometimes we do find a cache entry for the frame, but execution in that frame
has progressed to a different source position since we cached it, so the
SavedFrame in that cache entry isn't useful. When this occurs, we used to simply
pop the cache entry, and report a miss: although this did create a situation
where a frame with its bit set had no cache entry, that was only temporary: we
would push a new entry for the frame as we build the new SavedFrame chain.
Unless, of course, SavedFrame construction encounters an OOM and the whole
process aborts early.
This patch clears a frame's hasCachedSavedFrame bit when we report a cache miss
due to a pc mismatch. Under normal circumstances, the frame will soon be cached
again and its bit re-set. If an OOM does occur, the absence of the cache entry
is accurately reported.
OOM tests often depend on invoking a function repeatedly, failing a different
allocation each time. Flushing the caches helps ensure consistent behavior from
one invocation to the next.
This crate contains a parser generator as a Rust crate. The parser generator is used to generate
BinSource-auto.h, BinSource-auto.cpp, BinToken.h. As of this changeset, to limit yak shaving,
the parser generator is not part of the build system. Making it part of the build system
is delegated to bug 1439645.
MozReview-Commit-ID: 1lODDSIsz8W
This patch is a nearly complete reimplementation of BinASTReader, with the following changes:
- Files BinToken.h, BinSource-auto.h (new), BinSource-auto.cpp (new) are now autogenerated by the generator in js/src/frontend/binsouce from the webidl specifications of BinAST and a small
configuration file.
- Optional fields have been removed. Rather, some specific fields may, if so marked in the specifications, contain a Null constant.
- `hasDirectEval` is now checked for consistency (NOT completeness).
- `varDeclaredNames` is now checked for consistency (NOT completeness).
- `lexicallyDeclaredNames` is now checked for consistency (NOT completeness).
- `parameterNames` is now checked for consistency (NOT completeness).
- `capturedNames` is NOT checked.
- Atoms read are now properly expected to be UTF8.
This patch does not implement the entire specifications, but should implement most of ES5. In particular, it is sufficient to parse the source code of:
- Facebook;
- jQuery;
- mootools;
- Underscore;
- Backbone;
- Angular.
MozReview-Commit-ID: HwkVB5dliZv
At least some non-zero payloads confuse GDB and make it iloop on the
breakpoint instruction rather than break to the command line as it
should. There seems to be no reason not to use a zero payload.
By opposition to the built-in SpiderMonkey parser, the out of tree parser used as part of the BinAST encoder does not make a difference between
```js
{
foo: 1
}
```
and
```js
{
"foo": 1
}
```
SpiderMonkey considers that the former example has a literal property name, while the latter has a computed property name. By opposition,
the BinAST encoder considers that both are literal property names.
While the runtime behavior is identical, this caused SpiderMonkey to print different ASTs when text-parsing both source files,
but the same AST when bin-parsing both source files.
This patch addresses the issue by changing the behavior of ParseNode::dump() to display names for ObjectPropertyNames instead of
the string `ObjectPropertyName`.
MozReview-Commit-ID: IPZBl5eglIJ