Update spec document file

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
HyukWoo Park 2021-04-09 16:25:33 +09:00 committed by Patrick Kim
commit a847cf50ee
2 changed files with 32 additions and 94 deletions

View file

@ -1,31 +0,0 @@
# Public APIs
## The Name of public API header
1) Escargot.h
We need to rename former Escargot.h to EscargotDef.h. Current Escargot.h is not the api header. It is collection of macros like LIKELY, COMPILER.
2) EscargotAPI.h
JerryScript uses the name api, exactly jerry-api.h
3) EscargotPublic.h
Pando uses this convention.
## The Name of global utilities
Like `v8::V8::Initialize`, we sometimes want to initialize or get or set something belongs into global.
Here, by `global', I means it does not belong to a specific VMInstance.
For example, ICU or Heap is initialized and used by all VMInstances. I want to put them in a class.
In v8, it uses V8. Please notify v is capitalized. What would be suitable to us ?
1) ~~Escargot::Escargot2~~
2) Escargot::Globals
3) Escargot::Public
# Isolate or Not Isolate
We don't support isolation. We share many things including heap.We use globally unique JS heap space backing by boehm gc.
So Escargot had not needed a pointer to JS heap. Besides, in typical JavaScript Engines, all the function that may allocate memory from JavaScript heap must provides a way to access to JS heap. Should we prepare the situation of isolate support? If so, we need to design almost all APis accepts VMInstace as the first parameter.

View file

@ -1,73 +1,42 @@
# Specification
Escargot is lightweight JavaScript engine used in Pando.
Escargot implements full of [ECMAScript 5.1 specification](http://www.ecma-international.org/ecma-262/5.1/) and part of [ECMAScript 6.0 specification](http://www.ecma-international.org/ecma-262/6.0/).
## ES5
ES5 specification is fully supported with Escargot.
## ES6
### supported
| Object type | Implemented Feature | Property Type | Note |
| -------- | ---- | ------------------- | ---- |
| [TypedArray Objects](http://www.ecma-international.org/ecma-262/6.0/#sec-typedarray-objects) | TypedArray () | constructor | Currently it works expectedly only with arraylength less than 210000000 |
| | TypedArray (length) | constructor | |
| | TypedArray (buffer [, byteOffset [, length]]) | constructor | |
| | TypedArray.prototype.indexOf (searchElement [, fromIndex]) | method | |
| | TypedArray.prototype.lastIndexOf (searchElement [, fromIndex]) | method | |
| | TypedArray.prototype.set (array [, offset]) | method | |
| | TypedArray.prototype.set (typedArray [, offset]) | method | |
| | TypedArray.prototype.subarray ([begin [, end]]) | method | |
| | TypedArray.BYTES_PER_ELEMENT | data property | |
| | TypedArray.prototype.BYTES_PER_ELEMENT | data property | |
| | TypedArray.prototype.constructor | data property | |
| | TypedArray.prototype.copyWithin (target, start [, end]) | method | |
| | TypedArray.prototype.every (callbackfn [, thisArg]) | method | |
| | getter of TypedArray.prototype.byteLength | accessor property | |
| | getter of TypedArray.prototype.byteOffset | accessor property | |
| | getter of TypedArray.prototype.length | accessor property | |
| | getter of TypedArray.prototype.buffer | accessor property | |
| [ArrayBuffer Objects](http://www.ecma-international.org/ecma-262/6.0/#sec-arraybuffer-objects) | ArrayBuffer (length) | constructor | |
| | ArrayBuffer.isView (arg) | function | |
| | getter of ArrayBuffer.prototype.byteLength | accessor property | |
| | ArrayBuffer.prototype.constructor | data property | |
| | ArrayBuffer.prototype.slice (start, end) | method | |
| [DataView Objects](http://www.ecma-international.org/ecma-262/6.0/#sec-dataview-objects) | DataView (buffer [, byteOffset [, byteLength]]) | constructor | |
| | getter of DataView.prototype.buffer | accessor property | |
| | getter of DataView.prototype.byteLength | accessor property | |
| | getter of DataView.prototype.byteOffset | accessor property | |
| | DataView.prototype.constructor | data property | |
| | DataView.prototype.[get &#124; set][Float32 &#124; Float64 &#124; Int8 &#124; Int16 &#124; Int32 &#124; Uint8 &#124; Uint16 &#124; Uint32] \(byteOffset [, littleEndian)) | method | |
| [Promise Objects](http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects) | Promise (executor) | constructor | |
| | Promise.all (iterable) | function | |
| | Promise.race (iterable) | function | |
| | Promise.reject (r) | function | |
| | Promise.resolve (x) | function | |
| | Promise.prototype.catch (onRejected) | method | |
| | Promise.prototype.then (onFulfilled, onRejected) | method | |
Escargot is a lightweight JavaScript engine.
Escargot supports [ECMAScript 2020 Specification](https://262.ecma-international.org/11.0/) and [WebAssembly JavaScript Interface](https://www.w3.org/TR/wasm-js-api-1/).
## Etc.
Even though the features below are not included in ES5 or ES6 specification, Escargot supports them for your usability.
## ECMAScript 2020 Specification
Implement ECMAScript 2020 standard (https://262.ecma-international.org/11.0/).
### Legacy features
| Implemented Feature | Note |
| ------------------- | ---- |
| Object.prototype.\_\_proto\_\_ | |
| Object.prototype.\_\_defineGetter\_\_ (prop, func) | |
| Object.prototype.\_\_defineSetter\_\_ (prop, func) | |
| Object.prototype.\_\_lookupGetter\_\_ (prop) | |
| Object.prototype.\_\_lookupSetter\_\_ (prop) | |
| escape (str) | |
| unescape (str) | |
#### Unimplemented Features
* [Atomics Object](https://tc39.es/ecma262/#sec-atomics-object)
* [SharedArrayBuffer Object](https://tc39.es/ecma262/#sec-sharedarraybuffer-objects)
* [look-behind assertions](https://tc39.es/ecma262/#sec-assertion)
### Escargot-specific features
#### Escargot-Specific Features
Even though the features below are not part of ECMAScript standards, Escargot supports them for usability.
(These features are enabled only for standalone binary build)
| Implemented Feature | Function | Note |
| ------------------- | -------- | ---- |
| print (arg) | prints `arg` on stdout | standalone binary only |
| load (fileName) | opens a file named `fileName` and executes the contents as source code | standalone binary only |
| read (fileName) | opens a file named `fileName` and returns the contents as string | standalone binary only |
| run (fileName) | opens a file named `fileName`, executes the contents as source code, and returns the time spent to execute the code | standalone binary only |
| gc() | invokes garbage collector | |
| Feature | Function |
| ------- | -------- |
| print (arg) | prints `arg` on stdout |
| load (fileName) | opens a file named `fileName` and executes the contents as source code |
| read (fileName) | opens a file named `fileName` and returns the contents as string |
| run (fileName) | opens a file named `fileName`, executes the contents as source code, and returns the time spent to execute the code |
| gc() | invokes garbage collector |
## WebAssembly JavaScript Interface
Implement WebAssembly JavaScript Interface (https://www.w3.org/TR/wasm-js-api-1/).
#### WebAssembly Core
Import [WABT](https://github.com/WebAssembly/wabt) for WebAssembly core engine.
WABT supports [WebAssembly Core Specification](https://www.w3.org/TR/wasm-core-1/).
#### Unimplemented Features
* [Module.customSections](https://www.w3.org/TR/wasm-js-api-1/#dom-module-customsections)
## Code Caching Optimization
Support Code Caching method to accelerate the loading performance.
Code Caching stores the bytecode for the first time and reuses it when the same JavaScript code is executed again.
By reusing the bytecode, Code Caching could skip the parsing and compilation process which leads to fast loading time.