Bug 1639073 - Update jsparagus and use stencil crate. r=yulia

Differential Revision: https://phabricator.services.mozilla.com/D75881
This commit is contained in:
Tooru Fujisawa 2020-05-20 17:34:02 +00:00
Родитель 6c471e1747
Коммит fb93b18ec1
56 изменённых файлов: 540 добавлений и 520 удалений

Просмотреть файл

@ -30,7 +30,7 @@ rev = "77a7f5eb12a8d93f2bd71bd4d844405e06743365"
[source."https://github.com/mozilla-spidermonkey/jsparagus"]
git = "https://github.com/mozilla-spidermonkey/jsparagus"
replace-with = "vendored-sources"
rev = "ce731ef6014c41b1691a9be3480fbc43e5e9a396"
rev = "5a49cf936b073da15ba67ce3700fed616960dfb8"
[source."https://github.com/kvark/spirv_cross"]
branch = "wgpu3"

25
Cargo.lock сгенерированный
Просмотреть файл

@ -2367,7 +2367,7 @@ dependencies = [
[[package]]
name = "jsparagus"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=ce731ef6014c41b1691a9be3480fbc43e5e9a396#ce731ef6014c41b1691a9be3480fbc43e5e9a396"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=5a49cf936b073da15ba67ce3700fed616960dfb8#5a49cf936b073da15ba67ce3700fed616960dfb8"
dependencies = [
"jsparagus-ast",
"jsparagus-emitter",
@ -2375,12 +2375,13 @@ dependencies = [
"jsparagus-json-log",
"jsparagus-parser",
"jsparagus-scope",
"jsparagus-stencil",
]
[[package]]
name = "jsparagus-ast"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=ce731ef6014c41b1691a9be3480fbc43e5e9a396#ce731ef6014c41b1691a9be3480fbc43e5e9a396"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=5a49cf936b073da15ba67ce3700fed616960dfb8#5a49cf936b073da15ba67ce3700fed616960dfb8"
dependencies = [
"bumpalo",
"indexmap",
@ -2391,19 +2392,20 @@ dependencies = [
[[package]]
name = "jsparagus-emitter"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=ce731ef6014c41b1691a9be3480fbc43e5e9a396#ce731ef6014c41b1691a9be3480fbc43e5e9a396"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=5a49cf936b073da15ba67ce3700fed616960dfb8#5a49cf936b073da15ba67ce3700fed616960dfb8"
dependencies = [
"bumpalo",
"byteorder",
"indexmap",
"jsparagus-ast",
"jsparagus-scope",
"jsparagus-stencil",
]
[[package]]
name = "jsparagus-generated-parser"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=ce731ef6014c41b1691a9be3480fbc43e5e9a396#ce731ef6014c41b1691a9be3480fbc43e5e9a396"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=5a49cf936b073da15ba67ce3700fed616960dfb8#5a49cf936b073da15ba67ce3700fed616960dfb8"
dependencies = [
"bumpalo",
"jsparagus-ast",
@ -2413,12 +2415,12 @@ dependencies = [
[[package]]
name = "jsparagus-json-log"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=ce731ef6014c41b1691a9be3480fbc43e5e9a396#ce731ef6014c41b1691a9be3480fbc43e5e9a396"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=5a49cf936b073da15ba67ce3700fed616960dfb8#5a49cf936b073da15ba67ce3700fed616960dfb8"
[[package]]
name = "jsparagus-parser"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=ce731ef6014c41b1691a9be3480fbc43e5e9a396#ce731ef6014c41b1691a9be3480fbc43e5e9a396"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=5a49cf936b073da15ba67ce3700fed616960dfb8#5a49cf936b073da15ba67ce3700fed616960dfb8"
dependencies = [
"bumpalo",
"jsparagus-ast",
@ -2430,10 +2432,19 @@ dependencies = [
[[package]]
name = "jsparagus-scope"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=ce731ef6014c41b1691a9be3480fbc43e5e9a396#ce731ef6014c41b1691a9be3480fbc43e5e9a396"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=5a49cf936b073da15ba67ce3700fed616960dfb8#5a49cf936b073da15ba67ce3700fed616960dfb8"
dependencies = [
"indexmap",
"jsparagus-ast",
"jsparagus-stencil",
]
[[package]]
name = "jsparagus-stencil"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=5a49cf936b073da15ba67ce3700fed616960dfb8#5a49cf936b073da15ba67ce3700fed616960dfb8"
dependencies = [
"jsparagus-ast",
]
[[package]]

Просмотреть файл

@ -12,12 +12,12 @@ log = "0.4"
# Disable regex feature for code size.
env_logger = {version = "0.6", default-features = false}
# For non-jsparagus developers.
jsparagus = { git = "https://github.com/mozilla-spidermonkey/jsparagus", rev = "ce731ef6014c41b1691a9be3480fbc43e5e9a396" }
jsparagus = { git = "https://github.com/mozilla-spidermonkey/jsparagus", rev = "5a49cf936b073da15ba67ce3700fed616960dfb8" }
# For local development, replace above with
# jsparagus = { path = "{path to jsparagus}" }
[build-dependencies]
# For non-jsparagus developers.
jsparagus = { git = "https://github.com/mozilla-spidermonkey/jsparagus", rev = "ce731ef6014c41b1691a9be3480fbc43e5e9a396" }
jsparagus = { git = "https://github.com/mozilla-spidermonkey/jsparagus", rev = "5a49cf936b073da15ba67ce3700fed616960dfb8" }
# For local development, replace above with
# jsparagus = { path = "{path to jsparagus}" }

Просмотреть файл

@ -1,4 +1,4 @@
use jsparagus::emitter::opcode_info;
use jsparagus::stencil::opcode_info;
fn compare(name: &str, orig: &str, copied: &str) {
if copied != orig {

Просмотреть файл

@ -20,11 +20,13 @@ use env_logger;
use jsparagus::ast::source_atom_set::SourceAtomSet;
use jsparagus::ast::source_slice_list::SourceSliceList;
use jsparagus::ast::types::Program;
use jsparagus::emitter::{
emit, EmitError, EmitOptions, EmitResult, GCThing, RegExpItem, ScopeNote,
};
use jsparagus::emitter::{emit, EmitError, EmitOptions};
use jsparagus::parser::{parse_module, parse_script, ParseError, ParseOptions};
use jsparagus::scope::data::{BindingName, ScopeData};
use jsparagus::stencil::gcthings::GCThing;
use jsparagus::stencil::regexp::RegExpItem;
use jsparagus::stencil::result::EmitResult;
use jsparagus::stencil::scope::{BindingName, ScopeData};
use jsparagus::stencil::scope_notes::ScopeNote;
use std::boxed::Box;
use std::cell::RefCell;
use std::os::raw::{c_char, c_void};

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"44e966f17baf603f83e2c5ea05563744d1d564471a837ff025218c65c5de0b93","scripts/update_opcodes.py":"5db429c128f8dfe67218f6097c0ebfce31dc0e0403e21453766216e35fdf9625","src/array_emitter.rs":"bbc6528321f1d11d7c86c4f2bfdcfc9dced8f0b8b1c30c9f0a5355f300d196b6","src/ast_emitter.rs":"3664a7417328e1bb400e6cc0e6a0a8b916068c67036aadb0d0616340518eee1a","src/block_emitter.rs":"a95e553b667990fb585d4186588b0b976a5a477649ab7b9ddf01b26a3ddc5918","src/bytecode_offset.rs":"2aa7ba8c3cfbbd832092e65b599ab1c5a28d784ccc65d9e351bba656421b9a69","src/compilation_info.rs":"259d16ed7580c973cc0bb24a1ff4c9e8a3ca37aab328d946aa7deeb832d46b4f","src/control_structures.rs":"6c746f18d6f84859ba1989635f343307acad4982f1e0b94092d2473a5ad451d4","src/copy/AsyncFunctionResolveKind.h":"3851ecbb4728257595dd6e900749d1d8e02558574c00424a7ff0e3ca007fa6ec","src/copy/BytecodeFormatFlags.h":"7dc2932321cf7cf874cd92b6d8076ebd4139492730f3ee5a3b6ed7fc57a0c685","src/copy/CheckIsCallableKind.h":"66556f922d403cb46d4ad03a97a6795bcf22505eb9733cbfacd3f2cdd5f39463","src/copy/CheckIsObjectKind.h":"8f0e112396d966c9221a743d353f62671e04cdace7dd49a59898d94ba0f621b7","src/copy/FunctionFlags.h":"4376653f70711d916bc36c2096165f0be9a50c487b9d471821da1cad80daa3a3","src/copy/FunctionPrefixKind.h":"f540a5c646a519b2d61aa27e4be865e08a31438def00ad5ba4ba2982ad1f2275","src/copy/GeneratorAndAsyncKind.h":"301668ce705970a51abfa94f89fd5db29ef5f129525110860e9e9bf7586ef187","src/copy/GeneratorResumeKind.h":"9e3cd9dc9c7f50937c6c45d73ec092dbfd92c4b56818ae6d1504bcd77078d0a6","src/copy/Opcodes.h":"72e0faa4eb0ed4e59ee2205d0ed6734fc4e7383552545d605eef2201e69d4c99","src/copy/SourceNotes.h":"1e467f4e63d6f40a428e257fecd210bd14664516adf75a45cb17ab02ccd65fd8","src/copy/StencilEnums.h":"1c4d1a2c8b365c5dd01bbf09e921a0ef73f5614e5bfb1551cd7147def92ecdf9","src/copy/Symbol.h":"f68b32e1b7add89931a1fa82a6888ebf6d875d03b05872469de426844532bf33","src/copy/ThrowMsgKind.h":"da805756961d81a2b50aeb391a02fd59a0aa39a9e3eb6aae21b423b15875ab30","src/dis.rs":"4da6c62ce04093d0deda035c1cf4289e026fb6c1aab1b11ff4c0542b84d219b2","src/emitter.rs":"72338bd777152fec3f7e49d6e399a3aafa7ffbb7ffd4643d94579aa36ba71cd1","src/emitter_scope.rs":"481139d52dcac11dbc75e91c5b815943545e959378e29ec4699b083323a1b399","src/expression_emitter.rs":"f8e02785dffb179bbe9fe58e45bbfccc08adc3ad0a071a0073bed0feedc8ed9a","src/function.rs":"5866f0a5d41b6bfa8f7d205cafcc2a3c2a20facdab4b98a1bd6c8c474dc82ad3","src/function_declaration_emitter.rs":"c75c4986322f98f870fb70ab1bea29321ad76a1c36555bcd8cfee7b7c79145ac","src/gcthings.rs":"1513cf94c0ceb002708f6a2ba6c642ae244763b708eb42991855d33c730290ef","src/lib.rs":"335e0e26909313b094a59c05c27ccdb69fc7fa7a51a45cc15bd7522b094bd3e2","src/object_emitter.rs":"998423b3d6ef8797fadef6763803627df72fde292b1b34d6a41b2e66a331a181","src/opcode.rs":"4434a36d70387c5897f3349361e0010be08cf9d9499b47b22c0b4dbdb2ad4522","src/opcode_info.rs":"3475f87581ce05c301b915aca584577d15df3e1d7d4096c31546462d4ee1ece5","src/reference_op_emitter.rs":"753c25b3ae16613b7e0efb3c79637d62ef4c61f54ee64c83c5f694d331a609e3","src/regexp.rs":"7436cf545b990bec7dcc51ff28d67deaca9d4ce894468fdad0dd44b25c571cf2","src/scope_notes.rs":"9947ba5aba3097321c76adcb5648a478e4a67e088fdc1e01511e51c4ad41a9f3","src/script_emitter.rs":"44a6be5ecdcde3c32d78d100a205d38be2591c7c2cc109967579af7393e09fe8","src/stencil.rs":"d578398c6c211f88fd932545b482eb13c5692dc4b2c919e64c202b7b2e411274"},"package":null}
{"files":{"Cargo.toml":"fb09624f3c97bd2e872572b5ffd80751fbf8dd0b31155dc7855c9999a3c7a838","src/array_emitter.rs":"bbc6528321f1d11d7c86c4f2bfdcfc9dced8f0b8b1c30c9f0a5355f300d196b6","src/ast_emitter.rs":"cb4b0b89d4b35d370efb318d882339bded457bf95c4adc05091b09e37e2b94b0","src/block_emitter.rs":"2aad01fd24b4165fe11d0f05949690d6a4010aa52d59203c0b7a923001cb540c","src/compilation_info.rs":"1f8571c8b9956b9f3336b768c5359236d783ead5710869c1a211367f65f0c99a","src/control_structures.rs":"5d7ec0cc3234cba80d27d2f298eb39cefa135a6d0cb66247ebdd0711269867aa","src/dis.rs":"4a335d813fa965482ca0f20a7b9295a55ce7625b577d42bd8b33b156b81c6306","src/emitter.rs":"51ac047b1953bfdaac3fc2d4d1e98f57c1c9fc4c22de3bc87808183ed1389b35","src/emitter_scope.rs":"0908a6a1587dc2eeb63115c483c4b126e214cd0a2bb390b399f5083ba7c48218","src/expression_emitter.rs":"f8e02785dffb179bbe9fe58e45bbfccc08adc3ad0a071a0073bed0feedc8ed9a","src/function_declaration_emitter.rs":"d8d620f66f33bc4be6573d91e1cc1080208b11ce4fac6ba673099ea0ae5b0fb3","src/lib.rs":"48a1d5dd2242d0f308b4349266d72301f27c8ecc91171a45401759d81f4123fb","src/object_emitter.rs":"998423b3d6ef8797fadef6763803627df72fde292b1b34d6a41b2e66a331a181","src/reference_op_emitter.rs":"f3641a7c94f648b146d2e93321a9a1968a5bcedcccdd325c834d4a62eddbb173","src/script_emitter.rs":"44a6be5ecdcde3c32d78d100a205d38be2591c7c2cc109967579af7393e09fe8"},"package":null}

Просмотреть файл

@ -13,6 +13,7 @@ byteorder = "1.3.2"
indexmap = "1.0"
jsparagus-ast = { path = "../ast" }
jsparagus-scope = { path = "../scope" }
jsparagus-stencil = { path = "../stencil" }
[dev-dependencies]
jsparagus-parser = { path = "../parser" }

Просмотреть файл

@ -10,18 +10,19 @@ use crate::emitter_scope::{EmitterScopeStack, NameLocation};
use crate::expression_emitter::*;
use crate::function_declaration_emitter::{DummyFunctionScriptEmitter, FunctionDeclarationEmitter};
use crate::object_emitter::*;
use crate::opcode::Opcode;
use crate::reference_op_emitter::{
AssignmentEmitter, CallEmitter, DeclarationEmitter, ElemReferenceEmitter, GetElemEmitter,
GetNameEmitter, GetPropEmitter, GetSuperElemEmitter, GetSuperPropEmitter, NameReferenceEmitter,
NewEmitter, PropReferenceEmitter,
};
use crate::regexp::RegExpItem;
use crate::script_emitter::ScriptEmitter;
use crate::stencil::{EmitResult, ScriptStencilIndex, ScriptStencilList};
use ast::source_atom_set::{CommonSourceAtomSetIndices, SourceAtomSetIndex};
use ast::types::*;
use std::collections::HashSet;
use stencil::opcode::Opcode;
use stencil::regexp::RegExpItem;
use stencil::result::EmitResult;
use stencil::script::{ScriptStencilIndex, ScriptStencilList};
use crate::control_structures::{
BreakEmitter, CForEmitter, ContinueEmitter, ControlStructureStack, DoWhileEmitter,
@ -46,7 +47,12 @@ pub fn emit_program<'alloc>(
}
}
Ok(EmitResult::new(compilation_info, scripts.into()))
Ok(EmitResult::new(
compilation_info.atoms.into(),
compilation_info.slices.into(),
compilation_info.scope_data_map.into(),
scripts.into(),
))
}
pub struct AstEmitter<'alloc, 'opt> {

Просмотреть файл

@ -1,6 +1,6 @@
use crate::ast_emitter::AstEmitter;
use crate::emitter::EmitError;
use scope::data::ScopeIndex;
use stencil::scope::ScopeIndex;
pub struct BlockEmitter<'a, StmtT, StmtF>
where

Просмотреть файл

@ -2,7 +2,7 @@ use ast::associated_data::AssociatedData;
use ast::source_atom_set::SourceAtomSet;
use ast::source_slice_list::SourceSliceList;
use ast::types::Function;
use scope::data::ScopeDataMap;
use stencil::scope::ScopeDataMap;
pub struct CompilationInfo<'alloc> {
pub atoms: SourceAtomSet<'alloc>,

Просмотреть файл

@ -1,9 +1,9 @@
use crate::ast_emitter::AstEmitter;
use crate::bytecode_offset::{BytecodeOffset, BytecodeOffsetDiff};
use crate::emitter::EmitError;
use crate::emitter::InstructionWriter;
use crate::emitter_scope::EmitterScopeDepth;
use ast::source_atom_set::SourceAtomSetIndex;
use stencil::bytecode_offset::{BytecodeOffset, BytecodeOffsetDiff};
// Control structures

Просмотреть файл

@ -1,18 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: set ts=8 sts=2 et sw=2 tw=80:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef vm_CheckIsCallableKind_h
#define vm_CheckIsCallableKind_h
#include <stdint.h> // uint8_t
namespace js {
enum class CheckIsCallableKind : uint8_t { IteratorReturn };
} // namespace js
#endif /* vm_CheckIsCallableKind_h */

Просмотреть файл

@ -1,6 +1,6 @@
use crate::opcode::Opcode;
use std::convert::TryFrom;
use std::fmt::Write;
use stencil::opcode::Opcode;
/// Return a string form of the given bytecode.
pub fn dis(bc: &[u8]) -> String {

Просмотреть файл

@ -5,26 +5,25 @@
// Most of this functionality isn't used yet.
#![allow(dead_code)]
use crate::bytecode_offset::{BytecodeOffset, BytecodeOffsetDiff};
use crate::function::{FunctionCreationData, FunctionCreationDataList};
use crate::gcthings::{GCThingIndex, GCThingList};
use crate::opcode::Opcode;
use crate::regexp::{RegExpItem, RegExpList};
use crate::scope_notes::{ScopeNoteIndex, ScopeNoteList};
use crate::stencil::ScriptStencil;
use ast::source_atom_set::SourceAtomSetIndex;
use byteorder::{ByteOrder, LittleEndian};
use scope::data::ScopeIndex;
use scope::frame_slot::FrameSlot;
use std::cmp;
use std::collections::HashMap;
use std::convert::TryFrom;
use std::convert::TryInto;
use std::fmt;
use stencil::bytecode_offset::{BytecodeOffset, BytecodeOffsetDiff};
use stencil::frame_slot::FrameSlot;
use stencil::function::{FunctionCreationData, FunctionCreationDataList};
use stencil::gcthings::{GCThingIndex, GCThingList};
use stencil::opcode::Opcode;
use stencil::regexp::{RegExpItem, RegExpList};
use stencil::scope::ScopeIndex;
use stencil::scope_notes::{ScopeNoteIndex, ScopeNoteList};
use stencil::script::ScriptStencil;
// WARNING
// The following section is generated by
// crates/emitter/scripts/update_opcodes.py.
// The following section is generated by update_opcodes.py.
// Do mot modify manually.
//
// @@@@ BEGIN TYPES @@@@

Просмотреть файл

@ -2,14 +2,14 @@
//! the program.
//!
//! EmitterScopes exist only while the bytecode emitter is working.
//! Longer-lived scope information is stored in `scope::ScopeDataMap`.
//! Longer-lived scope information is stored in `ScopeDataMap`.
use crate::emitter::InstructionWriter;
use crate::scope_notes::ScopeNoteIndex;
use ast::source_atom_set::SourceAtomSetIndex;
use scope::data::{BindingKind, GlobalScopeData, LexicalScopeData, ScopeDataMap, ScopeIndex};
use scope::frame_slot::FrameSlot;
use std::collections::HashMap;
use stencil::frame_slot::FrameSlot;
use stencil::scope::{BindingKind, GlobalScopeData, LexicalScopeData, ScopeDataMap, ScopeIndex};
use stencil::scope_notes::ScopeNoteIndex;
/// Result of looking up a name.
///

Просмотреть файл

@ -1,8 +1,8 @@
use crate::ast_emitter::AstEmitter;
use crate::emitter::EmitError;
use crate::function::{FunctionCreationData, FunctionFlags};
use crate::gcthings::GCThingIndex;
use ast::source_atom_set::SourceAtomSetIndex;
use stencil::function::{FunctionCreationData, FunctionFlags};
use stencil::gcthings::GCThingIndex;
/// Create a dummy function with empty script, to implement
/// FunctionDeclarationEmitter without implementing FunctionScriptEmitter.

16
third_party/rust/jsparagus-emitter/src/lib.rs поставляемый
Просмотреть файл

@ -1,33 +1,22 @@
mod array_emitter;
mod ast_emitter;
mod block_emitter;
mod bytecode_offset;
mod compilation_info;
mod control_structures;
mod dis;
mod emitter;
mod emitter_scope;
mod expression_emitter;
mod function;
mod function_declaration_emitter;
mod gcthings;
mod object_emitter;
pub mod opcode;
pub mod opcode_info;
mod reference_op_emitter;
mod regexp;
mod scope_notes;
mod script_emitter;
mod stencil;
extern crate jsparagus_ast as ast;
extern crate jsparagus_scope as scope;
extern crate jsparagus_stencil as stencil;
pub use crate::emitter::{EmitError, EmitOptions};
pub use crate::gcthings::GCThing;
pub use crate::regexp::RegExpItem;
pub use crate::scope_notes::ScopeNote;
pub use crate::stencil::{EmitResult, ScriptStencil};
pub use dis::dis;
use crate::compilation_info::CompilationInfo;
@ -35,6 +24,7 @@ use crate::compilation_info::CompilationInfo;
use ast::source_atom_set::SourceAtomSet;
use ast::source_slice_list::SourceSliceList;
use scope::ScopeDataMapAndFunctionMap;
use stencil::result::EmitResult;
pub fn emit<'alloc>(
ast: &'alloc ast::types::Program<'alloc>,
@ -56,13 +46,13 @@ mod tests {
use super::{emit, EmitOptions};
use crate::dis::*;
use crate::opcode::*;
use ast::source_atom_set::SourceAtomSet;
use ast::source_slice_list::SourceSliceList;
use bumpalo::Bump;
use parser::{parse_script, ParseOptions};
use std::cell::RefCell;
use std::rc::Rc;
use stencil::opcode::*;
fn bytecode(source: &str) -> Vec<u8> {
let alloc = &Bump::new();

Просмотреть файл

@ -1,10 +1,10 @@
use crate::ast_emitter::AstEmitter;
use crate::emitter::EmitError;
use crate::emitter_scope::NameLocation;
use crate::gcthings::GCThingIndex;
use ast::source_atom_set::SourceAtomSetIndex;
use scope::data::BindingKind;
use scope::frame_slot::FrameSlot;
use stencil::frame_slot::FrameSlot;
use stencil::gcthings::GCThingIndex;
use stencil::scope::BindingKind;
#[derive(Debug, PartialEq)]
enum AssignmentReferenceKind {

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"8e424d01abd384e3d5f13bf921c8f4bc58306b3f41825dc821e60c5220efb7e0","src/ast_builder.rs":"8b10743ebbc3390d1158cb44ff5c87fbb653d62521f3e1274565d0061eebe095","src/context_stack.rs":"29331d03cd4c8ee9283cb426ebe893b7ba6ad6d8a69016399c4d92a81cb1363b","src/declaration_kind.rs":"fdfda2fe408cce1c637d17fee0813160619450472c6de9befc36ebeed892cc3c","src/early_error_checker.rs":"150a106a8f0901b72ae40581f0c12f785983514cbc9042404ed6cf4315693d60","src/early_errors.rs":"8674454af7ac5efe51eb6a8e2abe088aad5560e0a0bd88a3eae66c90f1527149","src/error.rs":"507e4dd9c66720f3da2db135c3024392d8aaac5ccdb90c7f7463ccb2eff7efa8","src/lib.rs":"a40b11e1dda1afcccef5fc86a2030c326d38feb31e24596e602930dcad28f1ec","src/parser_tables_generated.rs":"a99bc928a0ac9ffc44564e5c086fee1b195c6be5e05cfc4bf92946fdc963631e","src/stack_value_generated.rs":"d8696a671368e2565d589922e3a46d20667ed3e17e29953e69b970470e9639ee","src/token.rs":"479f4cb97d2e6bc654a70634f3809817cc73eaf749c845643beb3556b9ead383","src/traits/mod.rs":"bcc2fa63444ba4c763dc996f410a6871f2cdc3bde54e1924ca8cc25cba92674a"},"package":null}
{"files":{"Cargo.toml":"8e424d01abd384e3d5f13bf921c8f4bc58306b3f41825dc821e60c5220efb7e0","src/ast_builder.rs":"8b10743ebbc3390d1158cb44ff5c87fbb653d62521f3e1274565d0061eebe095","src/context_stack.rs":"29331d03cd4c8ee9283cb426ebe893b7ba6ad6d8a69016399c4d92a81cb1363b","src/declaration_kind.rs":"fdfda2fe408cce1c637d17fee0813160619450472c6de9befc36ebeed892cc3c","src/early_error_checker.rs":"150a106a8f0901b72ae40581f0c12f785983514cbc9042404ed6cf4315693d60","src/early_errors.rs":"8674454af7ac5efe51eb6a8e2abe088aad5560e0a0bd88a3eae66c90f1527149","src/error.rs":"507e4dd9c66720f3da2db135c3024392d8aaac5ccdb90c7f7463ccb2eff7efa8","src/lib.rs":"a40b11e1dda1afcccef5fc86a2030c326d38feb31e24596e602930dcad28f1ec","src/parser_tables_generated.rs":"7fca5ebbe071c9a7beb01dc273e844267094d3f865a16e1ab55d63d96258ed32","src/stack_value_generated.rs":"d8696a671368e2565d589922e3a46d20667ed3e17e29953e69b970470e9639ee","src/token.rs":"479f4cb97d2e6bc654a70634f3809817cc73eaf749c845643beb3556b9ead383","src/traits/mod.rs":"bcc2fa63444ba4c763dc996f410a6871f2cdc3bde54e1924ca8cc25cba92674a"},"package":null}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"2891ffd0f80fa04bddf4fd281ca7c80554bf04a65ae11ba2e729d1c4a074656b","src/builder.rs":"f3a905712185d8d617ee574f5c57dc3af504a2ead1e976c072cbf66e031a5d36","src/data.rs":"71f5acf81a54a92d8ec9ec1531808a92a3a93c81e09af1a6cd27a1fd23f38a30","src/frame_slot.rs":"b20c81d67c572f20d06d493b211cd3eaa0432a8294541583643b82df3af2f813","src/free_name_tracker.rs":"c29a7f7b53282233e54a28f49aa8ab90fa8f13553da39599f21ffb3a82a29867","src/lib.rs":"254ff9dd051937914225a6f96231db2c6e16fad7ff5c7a3016f82f4d3dc912c4","src/pass.rs":"fcf387ede9ed8ec496961bc68e0f9ce60a213a6553a252f0285671313336f904"},"package":null}
{"files":{"Cargo.toml":"500dc18629fd32dd7019a7967535d6fc53bf94dc7e6c305be46f4040d47cac9e","src/builder.rs":"a377550736265f384a38122de15d3e2dff17340128e5eb0f58c4793d610b9873","src/free_name_tracker.rs":"c29a7f7b53282233e54a28f49aa8ab90fa8f13553da39599f21ffb3a82a29867","src/lib.rs":"3cc23130470dd1dad0a57e3932352ee347d3a88351d41120a7310e960e40ad06","src/pass.rs":"861eb6cb15e93e6e0606d3bc1cbdfae337bcc286208ec29caa6ca33de6c2e506"},"package":null}

1
third_party/rust/jsparagus-scope/Cargo.toml поставляемый
Просмотреть файл

@ -8,3 +8,4 @@ license = "MIT/Apache-2.0"
[dependencies]
indexmap = "1.0"
jsparagus-ast = { path = "../ast" }
jsparagus-stencil = { path = "../stencil" }

Просмотреть файл

@ -33,10 +33,6 @@
//!
//! [1]: https://tc39.es/ecma262/#sec-globaldeclarationinstantiation
use crate::data::{
BindingName, FunctionScopeData, GlobalScopeData, LexicalScopeData, ScopeData, ScopeDataList,
ScopeDataMap, ScopeIndex, VarScopeData,
};
use crate::free_name_tracker::FreeNameTracker;
use ast::associated_data::{AssociatedData, Key as AssociatedDataKey};
use ast::source_atom_set::{CommonSourceAtomSetIndices, SourceAtomSetIndex};
@ -44,6 +40,10 @@ use ast::source_location_accessor::SourceLocationAccessor;
use ast::type_id::NodeTypeIdAccessor;
use indexmap::set::IndexSet;
use std::collections::HashSet;
use stencil::scope::{
BindingName, FunctionScopeData, GlobalScopeData, LexicalScopeData, ScopeData, ScopeDataList,
ScopeDataMap, ScopeIndex, VarScopeData,
};
/// The kind of items inside the result of VarScopedDeclarations.
///

3
third_party/rust/jsparagus-scope/src/lib.rs поставляемый
Просмотреть файл

@ -10,12 +10,11 @@
//! describing each scope, binding, and function in the AST.
mod builder;
pub mod data;
pub mod frame_slot;
pub mod free_name_tracker;
mod pass;
extern crate jsparagus_ast as ast;
extern crate jsparagus_stencil as stencil;
use ast::visit::Pass;

Просмотреть файл

@ -8,10 +8,10 @@
//! no AST is built. So we try to keep AST use separate from the analysis code.
use crate::builder::ScopeDataMapBuilder;
use crate::data::ScopeDataMap;
use ast::arena;
use ast::associated_data::AssociatedData;
use ast::{types::*, visit::Pass};
use stencil::scope::ScopeDataMap;
/// The result of scope analysis.
pub struct ScopeDataMapAndFunctionMap<'alloc> {

1
third_party/rust/jsparagus-stencil/.cargo-checksum.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
{"files":{"Cargo.toml":"f5439990185662ab31de12c07ef0c842438e3207bdfecc4fa6a9e4d4bea8a0d3","src/bytecode_offset.rs":"2aa7ba8c3cfbbd832092e65b599ab1c5a28d784ccc65d9e351bba656421b9a69","src/copy/AsyncFunctionResolveKind.h":"3851ecbb4728257595dd6e900749d1d8e02558574c00424a7ff0e3ca007fa6ec","src/copy/BytecodeFormatFlags.h":"7dc2932321cf7cf874cd92b6d8076ebd4139492730f3ee5a3b6ed7fc57a0c685","src/copy/CheckIsObjectKind.h":"8f0e112396d966c9221a743d353f62671e04cdace7dd49a59898d94ba0f621b7","src/copy/FunctionFlags.h":"4376653f70711d916bc36c2096165f0be9a50c487b9d471821da1cad80daa3a3","src/copy/FunctionPrefixKind.h":"f540a5c646a519b2d61aa27e4be865e08a31438def00ad5ba4ba2982ad1f2275","src/copy/GeneratorAndAsyncKind.h":"301668ce705970a51abfa94f89fd5db29ef5f129525110860e9e9bf7586ef187","src/copy/GeneratorResumeKind.h":"9e3cd9dc9c7f50937c6c45d73ec092dbfd92c4b56818ae6d1504bcd77078d0a6","src/copy/Opcodes.h":"72e0faa4eb0ed4e59ee2205d0ed6734fc4e7383552545d605eef2201e69d4c99","src/copy/SourceNotes.h":"1e467f4e63d6f40a428e257fecd210bd14664516adf75a45cb17ab02ccd65fd8","src/copy/StencilEnums.h":"e5a1db4af868fd65591ed97594f7aa9a4cde79194da0cabd62b34e950b3b10b4","src/copy/Symbol.h":"f68b32e1b7add89931a1fa82a6888ebf6d875d03b05872469de426844532bf33","src/copy/ThrowMsgKind.h":"da805756961d81a2b50aeb391a02fd59a0aa39a9e3eb6aae21b423b15875ab30","src/frame_slot.rs":"b20c81d67c572f20d06d493b211cd3eaa0432a8294541583643b82df3af2f813","src/function.rs":"ffd2ccce0b8940d281fea1e1294e27b5a943a4b1983bdf5330ccdec2241e1fde","src/gcthings.rs":"5f86caa759785b4961c9fb76e87001d58aa2a30ddf35d339beaa95db5fbdb877","src/lib.rs":"731842a46c397bee8dd06543dab435e8f7465a15e51301de5bca9bc67faa7d36","src/opcode.rs":"2b966f2c5f274a37463e8e932b00cefa160261fe011aea8b0ea1f86e921b8044","src/opcode_info.rs":"a27c6d5602f5ecdcc882a0167614bc7a7754d958124941b4c1c0cdc2b0a894f1","src/regexp.rs":"7436cf545b990bec7dcc51ff28d67deaca9d4ce894468fdad0dd44b25c571cf2","src/result.rs":"6c71556917833498bff1a1419b48d9bea73e4df77b1c3328320aea70f317d1cd","src/scope.rs":"71f5acf81a54a92d8ec9ec1531808a92a3a93c81e09af1a6cd27a1fd23f38a30","src/scope_notes.rs":"9947ba5aba3097321c76adcb5648a478e4a67e088fdc1e01511e51c4ad41a9f3","src/script.rs":"3f25dfef5a4c5aa796387145cab53a7009d15dafde1e1a6f0086b609bccffa84"},"package":null}

9
third_party/rust/jsparagus-stencil/Cargo.toml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,9 @@
[package]
name = "jsparagus-stencil"
version = "0.1.0"
authors = ["The jsparagus Project Developers"]
edition = "2018"
license = "MIT/Apache-2.0"
[dependencies]
jsparagus-ast = { path = "../ast" }

Просмотреть файл

Просмотреть файл

@ -194,19 +194,22 @@ enum class ImmutableScriptFlagsEnum : uint32_t {
// uses the `extends` syntax.
IsDerivedClassConstructor = 1 << 19,
// This function is a field initializer lambda for a class.
IsFieldInitializer = 1 << 20,
// This function has a rest (`...`) parameter.
HasRest = 1 << 20,
HasRest = 1 << 21,
// This function needs a call object or named lambda environment to be created
// in order to execute the function. This is done in the Stack or JIT frame
// setup code _before_ the bytecode prologue starts.
NeedsFunctionEnvironmentObjects = 1 << 21,
NeedsFunctionEnvironmentObjects = 1 << 22,
// An extra VarScope is used as the body scope instead of the normal
// FunctionScope. This is needed when parameter expressions are used AND the
// function has var bindings or a sloppy-direct-eval. For example,
// `function(x = eval("")) { var y; }`
FunctionHasExtraBodyVarScope = 1 << 22,
FunctionHasExtraBodyVarScope = 1 << 23,
// This function must define the implicit `arguments` binding on the function
// scope. If there are no free uses or an appropriate explicit binding exists,
@ -215,7 +218,7 @@ enum class ImmutableScriptFlagsEnum : uint32_t {
// Note: Parameter expressions will not see an explicit `var arguments;`
// binding in the body and an implicit binding on the function-scope must
// still be used in that case.
ShouldDeclareArguments = 1 << 23,
ShouldDeclareArguments = 1 << 24,
// This function has a local (implicit or explicit) `arguments` binding. This
// binding is initialized by the JSOp::Arguments bytecode.
@ -238,23 +241,23 @@ enum class ImmutableScriptFlagsEnum : uint32_t {
// // Implicit use in parameter expression
// function f(a = arguments) { return a; }
// ```
ArgumentsHasVarBinding = 1 << 24,
ArgumentsHasVarBinding = 1 << 25,
// This function requires the `arguments` binding to be initialized with the
// real arguments object. If unset, but ArgumentsHasVarBinding is set then an
// analysis pass will determine if an efficient placeholder value can be used
// instead.
// See the implementation of JSOp::Arguments opcode.
AlwaysNeedsArgsObj = 1 << 25,
AlwaysNeedsArgsObj = 1 << 26,
// This function must use the "mapped" form of an arguments object. This flag
// is set independently of whether we actually use an `arguments` binding. The
// conditions are specified in the ECMAScript spec.
HasMappedArgsObj = 1 << 26,
HasMappedArgsObj = 1 << 27,
// All of 'this', 'arguments' and f.apply() are used. This is likely to be a
// wrapper. This is a heuristic that affects Type Inference.
IsLikelyConstructorWrapper = 1 << 27,
IsLikelyConstructorWrapper = 1 << 28,
};
enum class MutableScriptFlagsEnum : uint32_t {

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,4 +1,4 @@
use crate::stencil::ScriptStencilIndex;
use crate::script::ScriptStencilIndex;
use ast::source_atom_set::SourceAtomSetIndex;
#[derive(Debug)]
@ -7,8 +7,7 @@ pub struct FunctionFlags {
}
// WARNING
// The following section is generated by
// crates/emitter/scripts/update_opcodes.py.
// The following section is generated by update_opcodes.py.
// Do mot modify manually.
//
// @@@@ BEGIN TYPES @@@@

Просмотреть файл

@ -1,7 +1,7 @@
use crate::function::FunctionCreationDataIndex;
use crate::regexp::RegExpIndex;
use crate::scope::ScopeIndex;
use ast::source_atom_set::SourceAtomSetIndex;
use scope::data::ScopeIndex;
/// Corresponds to js::frontend::GCThingList::ListType
/// in m-c/js/src/frontend/BytecodeSection.h.

13
third_party/rust/jsparagus-stencil/src/lib.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,13 @@
pub mod bytecode_offset;
pub mod frame_slot;
pub mod function;
pub mod gcthings;
pub mod opcode;
pub mod opcode_info;
pub mod regexp;
pub mod result;
pub mod scope;
pub mod scope_notes;
pub mod script;
extern crate jsparagus_ast as ast;

Просмотреть файл

@ -5,8 +5,7 @@ macro_rules! using_opcode_database {
$macro! {
[
// WARNING
// The following section is generated by
// crates/emitter/scripts/update_opcodes.py.
// The following section is generated by update_opcodes.py.
// Do mot modify manually.
//
// @@@@ BEGIN OPCODES @@@@
@ -278,8 +277,7 @@ macro_rules! count_rows {
const JSOP_LIMIT: usize = using_opcode_database!(count_rows!());
// WARNING
// The following section is generated by
// crates/emitter/scripts/update_opcodes.py.
// The following section is generated by update_opcodes.py.
// Do mot modify manually.
//
// @@@@ BEGIN FLAGS @@@@

Просмотреть файл

@ -6,10 +6,6 @@ pub fn get_bytecode_format_flags() -> &'static str {
include_str!("copy/BytecodeFormatFlags.h")
}
pub fn get_check_is_callable_kind() -> &'static str {
include_str!("copy/CheckIsCallableKind.h")
}
pub fn get_check_is_object_kind() -> &'static str {
include_str!("copy/CheckIsObjectKind.h")
}

Просмотреть файл

30
third_party/rust/jsparagus-stencil/src/result.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,30 @@
use crate::scope::ScopeData;
use crate::script::ScriptStencil;
/// The result of emitter.
pub struct EmitResult<'alloc> {
pub atoms: Vec<&'alloc str>,
pub slices: Vec<&'alloc str>,
pub scopes: Vec<ScopeData>,
/// Emitted scripts.
/// The first item corresponds to the global script, and the remaining
/// items correspond to inner functions.
pub scripts: Vec<ScriptStencil>,
}
impl<'alloc> EmitResult<'alloc> {
pub fn new(
atoms: Vec<&'alloc str>,
slices: Vec<&'alloc str>,
scopes: Vec<ScopeData>,
scripts: Vec<ScriptStencil>,
) -> Self {
Self {
atoms,
slices,
scopes,
scripts,
}
}
}

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,37 +1,11 @@
//! The result of emitter
use crate::compilation_info::CompilationInfo;
use crate::frame_slot::FrameSlot;
use crate::function::FunctionCreationData;
use crate::gcthings::GCThing;
use crate::regexp::RegExpItem;
use crate::scope_notes::ScopeNote;
use scope::data::ScopeData;
use scope::frame_slot::FrameSlot;
/// The result of emitter.
pub struct EmitResult<'alloc> {
pub atoms: Vec<&'alloc str>,
pub slices: Vec<&'alloc str>,
pub scopes: Vec<ScopeData>,
/// Emitted scripts.
/// The first item corresponds to the global script, and the remaining
/// items correspond to inner functions.
pub scripts: Vec<ScriptStencil>,
}
impl<'alloc> EmitResult<'alloc> {
pub fn new(compilation_info: CompilationInfo<'alloc>, scripts: Vec<ScriptStencil>) -> Self {
Self {
atoms: compilation_info.atoms.into(),
slices: compilation_info.slices.into(),
scopes: compilation_info.scope_data_map.into(),
scripts,
}
}
}
/// Data used to instantiate the non-lazy script.
/// Maps to js::frontend::ScriptStencil in m-c/js/src/frontend/Stencil.h.
#[derive(Debug)]

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

1
third_party/rust/jsparagus/Cargo.toml поставляемый
Просмотреть файл

@ -21,6 +21,7 @@ jsparagus-interpreter = { path = "crates/interpreter", optional = true }
jsparagus-json-log = { path = "crates/json-log" }
jsparagus-parser = { path = "crates/parser" }
jsparagus-scope = { path = "crates/scope" }
jsparagus-stencil = { path = "crates/stencil" }
[features]
default = []

2
third_party/rust/jsparagus/Makefile поставляемый
Просмотреть файл

@ -96,7 +96,7 @@ jsdemo: $(PY_OUT)
$(PYTHON) -m js_parser.try_it
update-opcodes-m-u:
$(PYTHON) crates/emitter/scripts/update_opcodes.py \
$(PYTHON) update_opcodes.py \
../mozilla-unified ./
.PHONY: all check static-check dyn-check jsdemo rust update-opcodes-m-u

5
third_party/rust/jsparagus/src/lib.rs поставляемый
Просмотреть файл

@ -17,3 +17,8 @@ pub mod scope {
extern crate jsparagus_scope;
pub use self::jsparagus_scope::*;
}
pub mod stencil {
extern crate jsparagus_stencil;
pub use self::jsparagus_stencil::*;
}

Просмотреть файл

@ -59,19 +59,19 @@ input_paths = ensure_input_files([
])
def get_emitter_source_path(name):
def get_source_path(crate, name):
path = os.path.join(args.PATH_TO_JSPARAGUS,
'crates', 'emitter', 'src', name)
'crates', crate, 'src', name)
ensure_exists(path)
return path
opcode_dest_path = get_emitter_source_path('opcode.rs')
emitter_dest_path = get_emitter_source_path('emitter.rs')
function_dest_path = get_emitter_source_path('function.rs')
opcode_dest_path = get_source_path('stencil', 'opcode.rs')
emitter_dest_path = get_source_path('emitter', 'emitter.rs')
function_dest_path = get_source_path('stencil', 'function.rs')
copy_dir = os.path.join(args.PATH_TO_JSPARAGUS,
'crates', 'emitter', 'src', 'copy')
'crates', 'stencil', 'src', 'copy')
if not os.path.exists(copy_dir):
os.makedirs(copy_dir)