Backed out changeset d7cb07ecc30a (bug 1678170) for causing spidermonkey failures. CLOSED TREE

This commit is contained in:
Csoregi Natalia 2020-12-09 18:16:50 +02:00
Родитель 491d6b17d3
Коммит e85a77d963
23 изменённых файлов: 796 добавлений и 579 удалений

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

@ -40,7 +40,7 @@ rev = "fc5d1d33317b0fbd36725757f80a95127eff5109"
[source."https://github.com/mozilla-spidermonkey/jsparagus"]
git = "https://github.com/mozilla-spidermonkey/jsparagus"
replace-with = "vendored-sources"
rev = "d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24"
rev = "1dc60327164a3f64f87180147b1f3a2a9cc74276"
[source."https://github.com/kvark/spirv_cross"]
branch = "wgpu4"

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

@ -2512,7 +2512,7 @@ dependencies = [
[[package]]
name = "jsparagus"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24#d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=1dc60327164a3f64f87180147b1f3a2a9cc74276#1dc60327164a3f64f87180147b1f3a2a9cc74276"
dependencies = [
"jsparagus-ast",
"jsparagus-emitter",
@ -2526,7 +2526,7 @@ dependencies = [
[[package]]
name = "jsparagus-ast"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24#d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=1dc60327164a3f64f87180147b1f3a2a9cc74276#1dc60327164a3f64f87180147b1f3a2a9cc74276"
dependencies = [
"bumpalo",
"indexmap",
@ -2535,7 +2535,7 @@ dependencies = [
[[package]]
name = "jsparagus-emitter"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24#d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=1dc60327164a3f64f87180147b1f3a2a9cc74276#1dc60327164a3f64f87180147b1f3a2a9cc74276"
dependencies = [
"bumpalo",
"byteorder",
@ -2548,7 +2548,7 @@ dependencies = [
[[package]]
name = "jsparagus-generated-parser"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24#d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=1dc60327164a3f64f87180147b1f3a2a9cc74276#1dc60327164a3f64f87180147b1f3a2a9cc74276"
dependencies = [
"bumpalo",
"jsparagus-ast",
@ -2558,12 +2558,12 @@ dependencies = [
[[package]]
name = "jsparagus-json-log"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24#d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=1dc60327164a3f64f87180147b1f3a2a9cc74276#1dc60327164a3f64f87180147b1f3a2a9cc74276"
[[package]]
name = "jsparagus-parser"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24#d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=1dc60327164a3f64f87180147b1f3a2a9cc74276#1dc60327164a3f64f87180147b1f3a2a9cc74276"
dependencies = [
"arrayvec",
"bumpalo",
@ -2575,7 +2575,7 @@ dependencies = [
[[package]]
name = "jsparagus-scope"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24#d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=1dc60327164a3f64f87180147b1f3a2a9cc74276#1dc60327164a3f64f87180147b1f3a2a9cc74276"
dependencies = [
"indexmap",
"jsparagus-ast",
@ -2585,7 +2585,7 @@ dependencies = [
[[package]]
name = "jsparagus-stencil"
version = "0.1.0"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24#d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24"
source = "git+https://github.com/mozilla-spidermonkey/jsparagus?rev=1dc60327164a3f64f87180147b1f3a2a9cc74276#1dc60327164a3f64f87180147b1f3a2a9cc74276"
dependencies = [
"jsparagus-ast",
]

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

@ -12,12 +12,12 @@ log = "0.4"
# Disable regex feature for code size.
env_logger = {version = "0.8", default-features = false}
# For non-jsparagus developers.
jsparagus = { git = "https://github.com/mozilla-spidermonkey/jsparagus", rev = "d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24" }
jsparagus = { git = "https://github.com/mozilla-spidermonkey/jsparagus", rev = "1dc60327164a3f64f87180147b1f3a2a9cc74276" }
# 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 = "d910c7a0f2f836cc70ed14bb92b8d0437b4e4a24" }
jsparagus = { git = "https://github.com/mozilla-spidermonkey/jsparagus", rev = "1dc60327164a3f64f87180147b1f3a2a9cc74276" }
# For local development, replace above with
# jsparagus = { path = "{path to jsparagus}" }

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

@ -1 +1 @@
{"files":{"Cargo.toml":"00c740f44b5681e3277e519d2e143e6edfbff186ca31a07ddce2eb46b803ddd7","src/array_emitter.rs":"bbc6528321f1d11d7c86c4f2bfdcfc9dced8f0b8b1c30c9f0a5355f300d196b6","src/ast_emitter.rs":"deb40c78866eb094eda7e748ec8255ae6e4eda8b40cdcfe19b52389611d4e44c","src/block_emitter.rs":"78965260d87a66c5324d6f3bdfea0f1938f8037f70adde148dbb2db599d1b2c0","src/compilation_info.rs":"b0d91b0f8d6940cb7087b474c3c814b758c8ce8d9027c415b76ad4af78be6140","src/control_structures.rs":"bdb186e98c14fa4e769b23b3dee4376683e6c6530af0856d55c055aff4398b84","src/dis.rs":"4a335d813fa965482ca0f20a7b9295a55ce7625b577d42bd8b33b156b81c6306","src/emitter.rs":"07adf54bf9cb6e6ff045e7069ece650e212ba0b12b706e47ac2f833f7533fc9d","src/emitter_scope.rs":"93c2b2a324ccb46b74adb2a28f56360a32652088e59c03641b4f1b608549dc78","src/expression_emitter.rs":"f8e02785dffb179bbe9fe58e45bbfccc08adc3ad0a071a0073bed0feedc8ed9a","src/function_declaration_emitter.rs":"0e6ae706ced215882f3a45b6e13f022ec1effa8edf1026b7ba7988810646982b","src/lib.rs":"e256eceee1eb7ea66fe855fcc3fa2fff187977f9adca2754872d13e9bb788536","src/object_emitter.rs":"998423b3d6ef8797fadef6763803627df72fde292b1b34d6a41b2e66a331a181","src/reference_op_emitter.rs":"c0c0ddde1613ab843dd3ee82744513bdd4f574432a06d5a88978e7ff1ce08273","src/script_emitter.rs":"150a3d6330f40099ad1df8c52cd1831e3ef0fd4eecf44a20e3fff7acef2dd640"},"package":null}
{"files":{"Cargo.toml":"00c740f44b5681e3277e519d2e143e6edfbff186ca31a07ddce2eb46b803ddd7","src/array_emitter.rs":"bbc6528321f1d11d7c86c4f2bfdcfc9dced8f0b8b1c30c9f0a5355f300d196b6","src/ast_emitter.rs":"8326432205a0c05aa0c2def31a621c70a0365c05278d2392510ad48e782abfe6","src/block_emitter.rs":"78965260d87a66c5324d6f3bdfea0f1938f8037f70adde148dbb2db599d1b2c0","src/compilation_info.rs":"b0d91b0f8d6940cb7087b474c3c814b758c8ce8d9027c415b76ad4af78be6140","src/control_structures.rs":"bdb186e98c14fa4e769b23b3dee4376683e6c6530af0856d55c055aff4398b84","src/dis.rs":"4a335d813fa965482ca0f20a7b9295a55ce7625b577d42bd8b33b156b81c6306","src/emitter.rs":"1b3e272a30c1e2ddba72db69205c3562afaa21dfa8979251942b6e1b47856556","src/emitter_scope.rs":"ba924ef541742a5c7be39d1b683bf3107241cf3ff5b8ff7f93987abc9f52e9d2","src/expression_emitter.rs":"f8e02785dffb179bbe9fe58e45bbfccc08adc3ad0a071a0073bed0feedc8ed9a","src/function_declaration_emitter.rs":"145e4476b387a067736fdf5aac2ca567694b2b0b952d0862bc56bd8e9af4a743","src/lib.rs":"e256eceee1eb7ea66fe855fcc3fa2fff187977f9adca2754872d13e9bb788536","src/object_emitter.rs":"998423b3d6ef8797fadef6763803627df72fde292b1b34d6a41b2e66a331a181","src/reference_op_emitter.rs":"87c7e05934718921d72977746b93513850eab69465d33e190003cb86241f62b4","src/script_emitter.rs":"44a6be5ecdcde3c32d78d100a205d38be2591c7c2cc109967579af7393e09fe8"},"package":null}

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

@ -10,6 +10,7 @@ use crate::emitter_scope::{EmitterScopeStack, NameLocation};
use crate::expression_emitter::*;
use crate::function_declaration_emitter::{
AnnexBFunctionDeclarationEmitter, LazyFunctionEmitter, LexicalFunctionDeclarationEmitter,
TopLevelFunctionDeclarationEmitter,
};
use crate::object_emitter::*;
use crate::reference_op_emitter::{
@ -133,10 +134,9 @@ impl<'alloc, 'opt> AstEmitter<'alloc, 'opt> {
.function_stencil_indices
.get(fun)
.expect("ScriptStencil should be created");
let fun_index = LazyFunctionEmitter { stencil_index }.emit(self);
// NOTE: GCIndex for the function is implicitly handled by
// global_or_eval_decl_instantiation.
LazyFunctionEmitter { stencil_index }.emit(self);
TopLevelFunctionDeclarationEmitter { fun_index }.emit(self);
Ok(())
}

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

@ -147,6 +147,9 @@ pub struct InstructionWriter {
/// Number of JOF_IC instructions emitted so far.
num_ic_entries: usize,
/// Number of instructions in this script that have JOF_TYPESET.
num_type_sets: usize,
}
#[derive(Debug)]
@ -191,6 +194,7 @@ impl InstructionWriter {
maximum_stack_depth: 0,
body_scope_index: None,
num_ic_entries: 0,
num_type_sets: 0,
}
}
@ -298,6 +302,10 @@ impl InstructionWriter {
}
self.bytecode.push(opcode.to_byte());
if opcode.has_typeset() {
self.num_type_sets += 1;
}
}
fn set_last_jump_target_offset(&mut self, target: BytecodeOffset) {
@ -522,6 +530,11 @@ impl InstructionWriter {
self.write_g_c_thing_index(baseobj_index);
}
pub fn new_object_with_group(&mut self, baseobj_index: GCThingIndex) {
self.emit_op(Opcode::NewObjectWithGroup);
self.write_g_c_thing_index(baseobj_index);
}
pub fn object(&mut self, object_index: GCThingIndex) {
self.emit_op(Opcode::Object);
self.write_g_c_thing_index(object_index);
@ -599,10 +612,24 @@ impl InstructionWriter {
self.write_g_c_thing_index(name_index);
}
pub fn call_prop(&mut self, name_index: GCThingIndex) {
self.emit_op(Opcode::CallProp);
self.write_g_c_thing_index(name_index);
}
pub fn get_elem(&mut self) {
self.emit_op(Opcode::GetElem);
}
pub fn call_elem(&mut self) {
self.emit_op(Opcode::CallElem);
}
pub fn length(&mut self, name_index: GCThingIndex) {
self.emit_op(Opcode::Length);
self.write_g_c_thing_index(name_index);
}
pub fn set_prop(&mut self, name_index: GCThingIndex) {
self.emit_op(Opcode::SetProp);
self.write_g_c_thing_index(name_index);
@ -692,6 +719,10 @@ impl InstructionWriter {
self.emit_op(Opcode::IsNoIter);
}
pub fn iter_next(&mut self) {
self.emit_op(Opcode::IterNext);
}
pub fn end_iter(&mut self) {
self.emit_op(Opcode::EndIter);
}
@ -731,6 +762,11 @@ impl InstructionWriter {
self.emit_op(Opcode::Hole);
}
pub fn new_array_copy_on_write(&mut self, object_index: GCThingIndex) {
self.emit_op(Opcode::NewArrayCopyOnWrite);
self.write_g_c_thing_index(object_index);
}
pub fn reg_exp(&mut self, regexp_index: GCThingIndex) {
self.emit_op(Opcode::RegExp);
self.write_g_c_thing_index(regexp_index);
@ -1227,9 +1263,27 @@ impl InstructionWriter {
self.emit_op(Opcode::BindVar);
}
pub fn global_or_eval_decl_instantiation(&mut self, last_fun: u32) {
self.emit_op(Opcode::GlobalOrEvalDeclInstantiation);
self.write_u32(last_fun);
pub fn def_var(&mut self, name_index: GCThingIndex) {
self.emit_op(Opcode::DefVar);
self.write_g_c_thing_index(name_index);
}
pub fn def_fun(&mut self) {
self.emit_op(Opcode::DefFun);
}
pub fn def_let(&mut self, name_index: GCThingIndex) {
self.emit_op(Opcode::DefLet);
self.write_g_c_thing_index(name_index);
}
pub fn def_const(&mut self, name_index: GCThingIndex) {
self.emit_op(Opcode::DefConst);
self.write_g_c_thing_index(name_index);
}
pub fn check_global_or_eval_decl(&mut self) {
self.emit_op(Opcode::CheckGlobalOrEvalDecl);
}
pub fn del_name(&mut self, name_index: GCThingIndex) {
@ -1449,6 +1503,7 @@ impl InstructionWriter {
.map_err(|_| EmitError::NotImplemented("Throwing allocation overflow"))?,
num_ic_entries: self.num_ic_entries.try_into().unwrap(),
fun_length: 0,
num_bytecode_type_sets: self.num_type_sets.try_into().unwrap(),
bytecode: self.bytecode,
scope_notes: self.scope_notes.into(),

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

@ -234,12 +234,7 @@ impl EmitterScopeStack {
///
/// [1]: https://tc39.es/ecma262/#sec-runtime-semantics-scriptevaluation
/// [2]: https://tc39.es/ecma262/#sec-globaldeclarationinstantiation
pub fn enter_global(
&mut self,
emit: &mut InstructionWriter,
scope_data_map: &ScopeDataMap,
top_level_function_count: u32,
) {
pub fn enter_global(&mut self, emit: &mut InstructionWriter, scope_data_map: &ScopeDataMap) {
let scope_index = scope_data_map.get_global_index();
let scope_data = scope_data_map.get_global_at(scope_index);
@ -248,7 +243,25 @@ impl EmitterScopeStack {
emit.enter_global_scope(scope_index);
if scope_data.base.bindings.len() > 0 {
emit.global_or_eval_decl_instantiation(top_level_function_count);
emit.check_global_or_eval_decl();
}
for item in scope_data.iter() {
let name_index = emit.get_atom_gcthing_index(item.name());
match item.kind() {
BindingKind::Var => {
if !item.is_top_level_function() {
emit.def_var(name_index);
}
}
BindingKind::Let => {
emit.def_let(name_index);
}
BindingKind::Const => {
emit.def_const(name_index);
}
}
}
emit.switch_to_main();

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

@ -22,6 +22,17 @@ impl LazyFunctionEmitter {
}
}
pub struct TopLevelFunctionDeclarationEmitter {
pub fun_index: GCThingIndex,
}
impl TopLevelFunctionDeclarationEmitter {
pub fn emit(self, emitter: &mut AstEmitter) {
emitter.emit.lambda(self.fun_index);
emitter.emit.def_fun();
}
}
pub struct LexicalFunctionDeclarationEmitter {
pub name: SourceAtomSetIndex,
pub fun_index: GCThingIndex,

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

@ -500,7 +500,7 @@ where
// [stack] THIS THIS
// FIXME: Support super.
emitter.emit.get_prop(key_index);
emitter.emit.call_prop(key_index);
// [stack] THIS CALLEE
emitter.emit.swap();
@ -560,7 +560,7 @@ where
// [stack] THIS THIS KEY
// FIXME: Support super.
emitter.emit.get_elem();
emitter.emit.call_elem();
// [stack] THIS CALLEE
emitter.emit.swap();

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

@ -20,11 +20,9 @@ where
pub fn emit(self, emitter: &mut AstEmitter) -> Result<(), EmitError> {
let scope_data_map = &emitter.compilation_info.scope_data_map;
emitter.scope_stack.enter_global(
&mut emitter.emit,
scope_data_map,
self.top_level_functions.len() as u32,
);
emitter
.scope_stack
.enter_global(&mut emitter.emit, scope_data_map);
for fun in self.top_level_functions {
(self.top_level_function)(emitter, fun)?;

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

@ -1 +1 @@
{"files":{"Cargo.toml":"553be3c198fe555913bbeb7473b24e0e1fff12e48890a2e399b311df8a97c814","src/ast_builder.rs":"15eebf519763b94e7c11791a1a90b1f73ec00d447857e230232e1d45599e30e5","src/context_stack.rs":"29331d03cd4c8ee9283cb426ebe893b7ba6ad6d8a69016399c4d92a81cb1363b","src/declaration_kind.rs":"fdfda2fe408cce1c637d17fee0813160619450472c6de9befc36ebeed892cc3c","src/early_error_checker.rs":"89da86f7f78392cb60a909c240e430779eed0fc250b3b3c8466665eeaf2fbc25","src/early_errors.rs":"8674454af7ac5efe51eb6a8e2abe088aad5560e0a0bd88a3eae66c90f1527149","src/error.rs":"507e4dd9c66720f3da2db135c3024392d8aaac5ccdb90c7f7463ccb2eff7efa8","src/lib.rs":"b74105a84c4a141b880439f9ec724f7dc08224342be08a73490ac2c01410af08","src/parser_tables_generated.rs":"763ffa17952f8bd1aef6656ec21bdae4c3e179ec3af79bb43a731f89a287aeef","src/stack_value_generated.rs":"ce8567634ff2bb818593f56c0589b4ba2d508704db943eb0778d79dfd19cce36","src/token.rs":"479f4cb97d2e6bc654a70634f3809817cc73eaf749c845643beb3556b9ead383","src/traits/mod.rs":"ba74c71f7218027f8188247bc64df243117613fbc9893d40799402ef1e6dbf59"},"package":null}
{"files":{"Cargo.toml":"553be3c198fe555913bbeb7473b24e0e1fff12e48890a2e399b311df8a97c814","src/ast_builder.rs":"15eebf519763b94e7c11791a1a90b1f73ec00d447857e230232e1d45599e30e5","src/context_stack.rs":"29331d03cd4c8ee9283cb426ebe893b7ba6ad6d8a69016399c4d92a81cb1363b","src/declaration_kind.rs":"fdfda2fe408cce1c637d17fee0813160619450472c6de9befc36ebeed892cc3c","src/early_error_checker.rs":"89da86f7f78392cb60a909c240e430779eed0fc250b3b3c8466665eeaf2fbc25","src/early_errors.rs":"8674454af7ac5efe51eb6a8e2abe088aad5560e0a0bd88a3eae66c90f1527149","src/error.rs":"507e4dd9c66720f3da2db135c3024392d8aaac5ccdb90c7f7463ccb2eff7efa8","src/lib.rs":"b74105a84c4a141b880439f9ec724f7dc08224342be08a73490ac2c01410af08","src/parser_tables_generated.rs":"84e6f1cffea759c8f3b55cd1b6c9f9350a93abda47b2ddb13342b820309e8a3f","src/stack_value_generated.rs":"ce8567634ff2bb818593f56c0589b4ba2d508704db943eb0778d79dfd19cce36","src/token.rs":"479f4cb97d2e6bc654a70634f3809817cc73eaf749c845643beb3556b9ead383","src/traits/mod.rs":"ba74c71f7218027f8188247bc64df243117613fbc9893d40799402ef1e6dbf59"},"package":null}

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

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

@ -1 +1 @@
{"files":{"Cargo.toml":"f5439990185662ab31de12c07ef0c842438e3207bdfecc4fa6a9e4d4bea8a0d3","src/bytecode_offset.rs":"2aa7ba8c3cfbbd832092e65b599ab1c5a28d784ccc65d9e351bba656421b9a69","src/copy/AsyncFunctionResolveKind.h":"3851ecbb4728257595dd6e900749d1d8e02558574c00424a7ff0e3ca007fa6ec","src/copy/BytecodeFormatFlags.h":"aa18cc3691e0d4252d4243b972ef210b4e4e0a5babba24b2efba710ee0f189bd","src/copy/CheckIsObjectKind.h":"8f0e112396d966c9221a743d353f62671e04cdace7dd49a59898d94ba0f621b7","src/copy/FunctionFlags.h":"fa4e966e98360a37158b0da25acdcc6f822ed6fa8af545dd5d0aa368258424e4","src/copy/FunctionPrefixKind.h":"f540a5c646a519b2d61aa27e4be865e08a31438def00ad5ba4ba2982ad1f2275","src/copy/GeneratorAndAsyncKind.h":"301668ce705970a51abfa94f89fd5db29ef5f129525110860e9e9bf7586ef187","src/copy/GeneratorResumeKind.h":"9e3cd9dc9c7f50937c6c45d73ec092dbfd92c4b56818ae6d1504bcd77078d0a6","src/copy/Opcodes.h":"b77d5b0cf2509fd2c5dca439a87c24e74ba466df8c691faa9c8efacbe3ca3989","src/copy/SourceNotes.h":"46fdf5ee41a309bf12eccf2bad3cc4736bcb8f43c3471a2ef506b9f3624ec91c","src/copy/StencilEnums.h":"7cb216be1079d4f66dea13a239d09cd1c083afcf1c0c63ae3ab1b3eefbc67508","src/copy/Symbol.h":"98a827d5bf68567a75686ee0b72b9fb960bde77e96771bbf03fc0a33b601be41","src/copy/ThrowMsgKind.h":"d636116b0152760b841e8ce4380333d6551639b41a075b48683d41ce6486a52b","src/env_coord.rs":"0be36a1bd307f5586affe0f3046d8b2ab2f5382b41b7b7bfb364b97d16a7c410","src/frame_slot.rs":"b20c81d67c572f20d06d493b211cd3eaa0432a8294541583643b82df3af2f813","src/function.rs":"37655675ba171dbbb055839f0fc31379d8b20184f28f98626347a9e9e8a6762d","src/gcthings.rs":"baadc7284c01961a4aa44d464a6f5a0d0be427b6d099c949d4411846738d9a45","src/lib.rs":"b003e085344277d2987ef492dc513048e8ec83217850a22ba7ca06ac01bc9b5c","src/opcode.rs":"f18f4f6b3b1ffcd37eba476b62847f680d91f694f5443c6f6210b9cc9361d4ef","src/opcode_info.rs":"a27c6d5602f5ecdcc882a0167614bc7a7754d958124941b4c1c0cdc2b0a894f1","src/regexp.rs":"7436cf545b990bec7dcc51ff28d67deaca9d4ce894468fdad0dd44b25c571cf2","src/result.rs":"62d3a851b8a497eecc350eed3ba6155b01a4d0e8e5bcfdf8dab776333d19825c","src/scope.rs":"3d2269a06d3e55d24f697338fedde95d9c653faec02d4694d0b63c79979e7c5a","src/scope_notes.rs":"9947ba5aba3097321c76adcb5648a478e4a67e088fdc1e01511e51c4ad41a9f3","src/script.rs":"11ab3300c3fdec63e32e98e069ab98a38311b514221fa44938ecf434622404e5"},"package":null}
{"files":{"Cargo.toml":"f5439990185662ab31de12c07ef0c842438e3207bdfecc4fa6a9e4d4bea8a0d3","src/bytecode_offset.rs":"2aa7ba8c3cfbbd832092e65b599ab1c5a28d784ccc65d9e351bba656421b9a69","src/copy/AsyncFunctionResolveKind.h":"3851ecbb4728257595dd6e900749d1d8e02558574c00424a7ff0e3ca007fa6ec","src/copy/BytecodeFormatFlags.h":"a805958bfb8c97c87122722eb6343eacdf7bd5558ad8c79b324c7d55c1bda60e","src/copy/CheckIsObjectKind.h":"8f0e112396d966c9221a743d353f62671e04cdace7dd49a59898d94ba0f621b7","src/copy/FunctionFlags.h":"3858687164806f03ba68570f7e0727f227f88b47675421ad0ca803095c8d3769","src/copy/FunctionPrefixKind.h":"f540a5c646a519b2d61aa27e4be865e08a31438def00ad5ba4ba2982ad1f2275","src/copy/GeneratorAndAsyncKind.h":"301668ce705970a51abfa94f89fd5db29ef5f129525110860e9e9bf7586ef187","src/copy/GeneratorResumeKind.h":"9e3cd9dc9c7f50937c6c45d73ec092dbfd92c4b56818ae6d1504bcd77078d0a6","src/copy/Opcodes.h":"64edf77a148cf3ed6d547d410b25b780d24711b3d4defa33518acee6d68d17cd","src/copy/SourceNotes.h":"1e467f4e63d6f40a428e257fecd210bd14664516adf75a45cb17ab02ccd65fd8","src/copy/StencilEnums.h":"e5a1db4af868fd65591ed97594f7aa9a4cde79194da0cabd62b34e950b3b10b4","src/copy/Symbol.h":"c478d44bcd17a013e9e03c56f7fb47e5268b9df76559373777355025e82d8b7d","src/copy/ThrowMsgKind.h":"5a06fa6cda81638b325af201a21396cfb460d993001a7725c858202b60237d04","src/env_coord.rs":"0be36a1bd307f5586affe0f3046d8b2ab2f5382b41b7b7bfb364b97d16a7c410","src/frame_slot.rs":"b20c81d67c572f20d06d493b211cd3eaa0432a8294541583643b82df3af2f813","src/function.rs":"b841ba6f7ecee3a38a136ef9902fd1d4a3f6b0aa96d1e8d8340e7f26dead75d9","src/gcthings.rs":"baadc7284c01961a4aa44d464a6f5a0d0be427b6d099c949d4411846738d9a45","src/lib.rs":"b003e085344277d2987ef492dc513048e8ec83217850a22ba7ca06ac01bc9b5c","src/opcode.rs":"842fbacb00b35779bd5922b61accde22973870f9b2a5f5f5b29d1b2117fedd3f","src/opcode_info.rs":"a27c6d5602f5ecdcc882a0167614bc7a7754d958124941b4c1c0cdc2b0a894f1","src/regexp.rs":"7436cf545b990bec7dcc51ff28d67deaca9d4ce894468fdad0dd44b25c571cf2","src/result.rs":"62d3a851b8a497eecc350eed3ba6155b01a4d0e8e5bcfdf8dab776333d19825c","src/scope.rs":"3d2269a06d3e55d24f697338fedde95d9c653faec02d4694d0b63c79979e7c5a","src/scope_notes.rs":"9947ba5aba3097321c76adcb5648a478e4a67e088fdc1e01511e51c4ad41a9f3","src/script.rs":"213df7170dcaa26ecb15b2318469f2e2c7fc37e2bfe049b849aa5ea124287868"},"package":null}

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

@ -25,33 +25,34 @@ enum {
JOF_QARG = 11, /* function argument index */
JOF_LOCAL = 12, /* var or block-local variable */
JOF_RESUMEINDEX = 13, /* yield, await, or gosub resume index */
JOF_DOUBLE = 14, /* inline DoubleValue */
JOF_GCTHING = 15, /* uint32_t generic gc-thing index */
JOF_ATOM = 16, /* uint32_t constant index */
JOF_OBJECT = 17, /* uint32_t object index */
JOF_REGEXP = 18, /* uint32_t regexp index */
JOF_SCOPE = 19, /* uint32_t scope index */
JOF_BIGINT = 20, /* uint32_t index for BigInt value */
JOF_ICINDEX = 21, /* uint32_t IC index */
JOF_LOOPHEAD = 22, /* JSOp::LoopHead, combines JOF_ICINDEX and JOF_UINT8 */
JOF_CLASS_CTOR = 23, /* uint32_t atom index, sourceStart, sourceEnd */
JOF_TWO_UINT8 = 24, /* A pair of unspecified uint8_t arguments */
JOF_TYPEMASK = 0xFF, /* mask for above immediate types */
JOF_ATOM = 14, /* uint32_t constant index */
JOF_OBJECT = 15, /* uint32_t object index */
JOF_REGEXP = 16, /* uint32_t regexp index */
JOF_DOUBLE = 17, /* inline DoubleValue */
JOF_SCOPE = 18, /* uint32_t scope index */
JOF_ICINDEX = 19, /* uint32_t IC index */
JOF_LOOPHEAD = 20, /* JSOp::LoopHead, combines JOF_ICINDEX and JOF_UINT8 */
JOF_BIGINT = 21, /* uint32_t index for BigInt value */
JOF_CLASS_CTOR = 22, /* uint32_t atom index, sourceStart, sourceEnd */
JOF_TWO_UINT8 = 23, /* A pair of unspecified uint8_t arguments */
JOF_TYPEMASK = 0x001f, /* mask for above immediate types */
JOF_NAME = 1 << 8, /* name operation */
JOF_PROP = 2 << 8, /* obj.prop operation */
JOF_ELEM = 3 << 8, /* obj[index] operation */
JOF_MODEMASK = 0xFF << 8, /* mask for above addressing modes */
JOF_NAME = 1 << 5, /* name operation */
JOF_PROP = 2 << 5, /* obj.prop operation */
JOF_ELEM = 3 << 5, /* obj[index] operation */
JOF_MODEMASK = 3 << 5, /* mask for above addressing modes */
JOF_PROPSET = 1 << 16, /* property/element/name set operation */
JOF_PROPINIT = 1 << 17, /* property/element/name init operation */
JOF_CHECKSLOPPY = 1 << 18, /* op can only be generated in sloppy mode */
JOF_CHECKSTRICT = 1 << 19, /* op can only be generated in strict mode */
JOF_INVOKE = 1 << 20, /* any call, construct, or eval instruction */
JOF_CONSTRUCT = 1 << 21, /* invoke instruction using [[Construct]] entry */
JOF_SPREAD = 1 << 22, /* invoke instruction using spread argument */
JOF_GNAME = 1 << 23, /* predicted global name */
JOF_IC = 1 << 24, /* baseline may use an IC for this op */
JOF_PROPSET = 1 << 7, /* property/element/name set operation */
JOF_PROPINIT = 1 << 8, /* property/element/name init operation */
// (1 << 9) is unused.
JOF_CHECKSLOPPY = 1 << 10, /* op can only be generated in sloppy mode */
JOF_CHECKSTRICT = 1 << 11, /* op can only be generated in strict mode */
JOF_INVOKE = 1 << 12, /* any call, construct, or eval instruction */
JOF_CONSTRUCT = 1 << 13, /* invoke instruction using [[Construct]] entry */
JOF_SPREAD = 1 << 14, /* invoke instruction using spread argument */
JOF_GNAME = 1 << 15, /* predicted global name */
JOF_TYPESET = 1 << 16, /* has an entry in a script's type sets */
JOF_IC = 1 << 17, /* baseline may use an IC for this op */
};
#endif /* vm_BytecodeFormatFlags_h */

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

@ -85,7 +85,9 @@ class FunctionFlags {
RESOLVED_NAME = 1 << 13,
RESOLVED_LENGTH = 1 << 14,
// (1 << 15 is unused)
// For a function used as an interpreted constructor, whether a 'new' type
// had constructor information cleared.
NEW_SCRIPT_CLEARED = 1 << 15,
// Shifted form of FunctionKinds.
NORMAL_KIND = NormalFunction << FUNCTION_KIND_SHIFT,
@ -114,7 +116,7 @@ class FunctionFlags {
INTERPRETED_METHOD = BASESCRIPT | METHOD_KIND,
// Flags that XDR ignores. See also: js::BaseScript::MutableFlags.
MUTABLE_FLAGS = RESOLVED_NAME | RESOLVED_LENGTH,
MUTABLE_FLAGS = RESOLVED_NAME | RESOLVED_LENGTH | NEW_SCRIPT_CLEARED,
// Flags preserved when cloning a function. (Exception:
// js::MakeDefaultConstructor produces default constructors for ECMAScript
@ -172,8 +174,8 @@ class FunctionFlags {
bool isConstructor() const { return hasFlags(CONSTRUCTOR); }
bool isNonBuiltinConstructor() const {
// Note: keep this in sync with branchIfNotFunctionIsNonBuiltinCtor in
// MacroAssembler.cpp.
// Note: keep this in sync with emitGuardFunctionIsNonBuiltinCtor in
// {CacheIRCompiler, WarpCacheIRTranspiler}.cpp.
return hasFlags(BASESCRIPT) && hasFlags(CONSTRUCTOR) &&
!hasFlags(SELF_HOSTED);
}
@ -296,7 +298,12 @@ class FunctionFlags {
void setResolvedLength() { setFlags(RESOLVED_LENGTH); }
void setResolvedName() { setFlags(RESOLVED_NAME); }
// Mark a function as having its 'new' script information cleared.
bool wasNewScriptCleared() const { return hasFlags(NEW_SCRIPT_CLEARED); }
void setNewScriptCleared() { setFlags(NEW_SCRIPT_CLEARED); }
void setInferredName() { setFlags(HAS_INFERRED_NAME); }
void clearInferredName() { clearFlags(HAS_INFERRED_NAME); }
void setGuessedAtom() { setFlags(HAS_GUESSED_ATOM); }

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

@ -819,12 +819,18 @@
* must fill in all slots of the new object before it is used in any other
* way.
*
* For `JSOp::NewObject`, the new object has a group based on the allocation
* site (or a new group if the template's group is a singleton). For
* `JSOp::NewObjectWithGroup`, the new object has the same group as the
* template object.
*
* Category: Objects
* Type: Creating objects
* Operands: uint32_t baseobjIndex
* Stack: => obj
*/ \
MACRO(NewObject, new_object, NULL, 5, 0, 1, JOF_OBJECT|JOF_IC) \
MACRO(NewObjectWithGroup, new_object_with_group, NULL, 5, 0, 1, JOF_OBJECT|JOF_IC) \
/*
* Push a preconstructed object.
*
@ -1004,6 +1010,9 @@
* Get the value of the property `obj.name`. This can call getters and
* proxy traps.
*
* `JSOp::CallProp` is exactly like `JSOp::GetProp` but hints to the VM that we're
* getting a method in order to call it.
*
* Implements: [GetV][1], [GetValue][2] step 5.
*
* [1]: https://tc39.es/ecma262/#sec-getv
@ -1014,10 +1023,14 @@
* Operands: uint32_t nameIndex
* Stack: obj => obj[name]
*/ \
MACRO(GetProp, get_prop, NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_IC) \
MACRO(GetProp, get_prop, NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_IC) \
MACRO(CallProp, call_prop, NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_IC) \
/*
* Get the value of the property `obj[key]`.
*
* `JSOp::CallElem` is exactly like `JSOp::GetElem` but hints to the VM that
* we're getting a method in order to call it.
*
* Implements: [GetV][1], [GetValue][2] step 5.
*
* [1]: https://tc39.es/ecma262/#sec-getv
@ -1028,7 +1041,20 @@
* Operands:
* Stack: obj, key => obj[key]
*/ \
MACRO(GetElem, get_elem, NULL, 1, 2, 1, JOF_BYTE|JOF_ELEM|JOF_IC) \
MACRO(GetElem, get_elem, NULL, 1, 2, 1, JOF_BYTE|JOF_ELEM|JOF_TYPESET|JOF_IC) \
MACRO(CallElem, call_elem, NULL, 1, 2, 1, JOF_BYTE|JOF_ELEM|JOF_TYPESET|JOF_IC) \
/*
* Push the value of `obj.length`.
*
* `nameIndex` must be the index of the atom `"length"`. This then behaves
* exactly like `JSOp::GetProp`.
*
* Category: Objects
* Type: Accessing properties
* Operands: uint32_t nameIndex
* Stack: obj => obj.length
*/ \
MACRO(Length, length, NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_IC) \
/*
* Non-strict assignment to a property, `obj.name = val`.
*
@ -1203,7 +1229,7 @@
* Operands: uint32_t nameIndex
* Stack: receiver, obj => super.name
*/ \
MACRO(GetPropSuper, get_prop_super, NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_IC) \
MACRO(GetPropSuper, get_prop_super, NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_IC) \
/*
* Get the value of `receiver[key]`, starting the property search at `obj`.
* In spec terms, `obj.[[Get]](key, receiver)`.
@ -1221,7 +1247,7 @@
* Operands:
* Stack: receiver, key, obj => super[key]
*/ \
MACRO(GetElemSuper, get_elem_super, NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_IC) \
MACRO(GetElemSuper, get_elem_super, NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_TYPESET|JOF_IC) \
/*
* Assign `val` to `receiver.name`, starting the search for an existing
* property at `obj`. In spec terms, `obj.[[Set]](name, val, receiver)`.
@ -1339,6 +1365,16 @@
* Stack: val => val, done
*/ \
MACRO(IsNoIter, is_no_iter, NULL, 1, 1, 2, JOF_BYTE) \
/*
* No-op instruction to hint to IonBuilder that the value on top of the
* stack is the string key in a for-in loop.
*
* Category: Objects
* Type: Enumeration
* Operands:
* Stack: val => val
*/ \
MACRO(IterNext, iter_next, NULL, 1, 1, 1, JOF_BYTE) \
/*
* Exit a for-in loop, closing the iterator.
*
@ -1494,6 +1530,23 @@
* Stack: => hole
*/ \
MACRO(Hole, hole, NULL, 1, 0, 1, JOF_BYTE) \
/*
* Create and push a new array that shares the elements of a template
* object.
*
* `script->getObject(objectIndex)` must be a copy-on-write array whose
* elements are all primitive values.
*
* This is an optimization. This single instruction implements an entire
* array literal, saving run time, code, and memory compared to
* `JSOp::NewArray` and a series of `JSOp::InitElem` instructions.
*
* Category: Objects
* Type: Array literals
* Operands: uint32_t objectIndex
* Stack: => array
*/ \
MACRO(NewArrayCopyOnWrite, new_array_copy_on_write, NULL, 5, 0, 1, JOF_OBJECT) \
/*
* Clone and push a new RegExp object.
*
@ -1508,9 +1561,11 @@
*/ \
MACRO(RegExp, reg_exp, NULL, 5, 0, 1, JOF_REGEXP) \
/*
* Push a new function object.
* Push a function object.
*
* The new function inherits the current environment chain.
* This clones the function unless it's a singleton; see
* `CanReuseFunctionForClone`. The new function inherits the current
* environment chain.
*
* Used to create most JS functions. Notable exceptions are arrow functions
* and derived or default class constructors.
@ -1689,11 +1744,11 @@
* Operands: uint16_t argc
* Stack: callee, this, args[0], ..., args[argc-1] => rval
*/ \
MACRO(Call, call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC) \
MACRO(CallIter, call_iter, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC) \
MACRO(FunApply, fun_apply, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC) \
MACRO(FunCall, fun_call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC) \
MACRO(CallIgnoresRv, call_ignores_rv, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC) \
MACRO(Call, call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_IC) \
MACRO(CallIter, call_iter, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_IC) \
MACRO(FunApply, fun_apply, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_IC) \
MACRO(FunCall, fun_call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_IC) \
MACRO(CallIgnoresRv, call_ignores_rv, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_IC) \
/*
* Like `JSOp::Call`, but the arguments are provided in an array rather than
* a span of stack slots. Used to implement spread-call syntax:
@ -1709,7 +1764,7 @@
* Operands:
* Stack: callee, this, args => rval
*/ \
MACRO(SpreadCall, spread_call, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_IC) \
MACRO(SpreadCall, spread_call, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_TYPESET|JOF_IC) \
/*
* Push true if `arr` is an array object that can be passed directly as the
* `args` argument to `JSOp::SpreadCall`.
@ -1755,7 +1810,7 @@
* Operands: uint16_t argc
* Stack: callee, this, args[0], ..., args[argc-1] => rval
*/ \
MACRO(Eval, eval, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CHECKSLOPPY|JOF_IC) \
MACRO(Eval, eval, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_CHECKSLOPPY|JOF_IC) \
/*
* Spread-call variant of `JSOp::Eval`.
*
@ -1766,7 +1821,7 @@
* Operands:
* Stack: callee, this, args => rval
*/ \
MACRO(SpreadEval, spread_eval, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_CHECKSLOPPY|JOF_IC) \
MACRO(SpreadEval, spread_eval, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_TYPESET|JOF_CHECKSLOPPY|JOF_IC) \
/*
* Like `JSOp::Eval`, but for strict mode code.
*
@ -1775,7 +1830,7 @@
* Operands: uint16_t argc
* Stack: evalFn, this, args[0], ..., args[argc-1] => rval
*/ \
MACRO(StrictEval, strict_eval, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CHECKSTRICT|JOF_IC) \
MACRO(StrictEval, strict_eval, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_CHECKSTRICT|JOF_IC) \
/*
* Spread-call variant of `JSOp::StrictEval`.
*
@ -1786,7 +1841,7 @@
* Operands:
* Stack: callee, this, args => rval
*/ \
MACRO(StrictSpreadEval, strict_spread_eval, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_CHECKSTRICT|JOF_IC) \
MACRO(StrictSpreadEval, strict_spread_eval, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_TYPESET|JOF_CHECKSTRICT|JOF_IC) \
/*
* Push the implicit `this` value for an unqualified function call, like
* `foo()`. `nameIndex` gives the name of the function we're calling.
@ -1883,8 +1938,8 @@
* Operands: uint16_t argc
* Stack: callee, isConstructing, args[0], ..., args[argc-1], newTarget => rval
*/ \
MACRO(New, new_, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CONSTRUCT|JOF_IC) \
MACRO(SuperCall, super_call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CONSTRUCT|JOF_IC) \
MACRO(New, new_, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CONSTRUCT|JOF_TYPESET|JOF_IC) \
MACRO(SuperCall, super_call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CONSTRUCT|JOF_TYPESET|JOF_IC) \
/*
* Spread-call variant of `JSOp::New`.
*
@ -1902,8 +1957,8 @@
* Operands:
* Stack: callee, isConstructing, args, newTarget => rval
*/ \
MACRO(SpreadNew, spread_new, NULL, 1, 4, 1, JOF_BYTE|JOF_INVOKE|JOF_CONSTRUCT|JOF_SPREAD|JOF_IC) \
MACRO(SpreadSuperCall, spread_super_call, NULL, 1, 4, 1, JOF_BYTE|JOF_INVOKE|JOF_CONSTRUCT|JOF_SPREAD|JOF_IC) \
MACRO(SpreadNew, spread_new, NULL, 1, 4, 1, JOF_BYTE|JOF_INVOKE|JOF_CONSTRUCT|JOF_SPREAD|JOF_TYPESET|JOF_IC) \
MACRO(SpreadSuperCall, spread_super_call, NULL, 1, 4, 1, JOF_BYTE|JOF_INVOKE|JOF_CONSTRUCT|JOF_SPREAD|JOF_TYPESET|JOF_IC) \
/*
* Push the prototype of `callee` in preparation for calling `super()`.
*
@ -2693,8 +2748,8 @@
/*
* Initialize a global lexical binding.
*
* The binding must already have been created by
* `GlobalOrEvalDeclInstantiation` and must be uninitialized.
* The binding must already have been created by `DefLet` or `DefConst` and
* must be uninitialized.
*
* Like `JSOp::InitLexical` but for global lexicals. Unlike `InitLexical`
* this can't be used to mark a binding as uninitialized.
@ -2815,7 +2870,7 @@
* Operands: uint32_t nameIndex
* Stack: => val
*/ \
MACRO(GetName, get_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_IC) \
MACRO(GetName, get_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_IC) \
/*
* Find a global binding and push its value.
*
@ -2839,7 +2894,7 @@
* Operands: uint32_t nameIndex
* Stack: => val
*/ \
MACRO(GetGName, get_g_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_GNAME|JOF_IC) \
MACRO(GetGName, get_g_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_GNAME|JOF_IC) \
/*
* Push the value of an argument that is stored in the stack frame
* or in an `ArgumentsObject`.
@ -2886,7 +2941,7 @@
* Operands: uint8_t hops, uint24_t slot
* Stack: => aliasedVar
*/ \
MACRO(GetAliasedVar, get_aliased_var, NULL, 5, 0, 1, JOF_ENVCOORD|JOF_NAME) \
MACRO(GetAliasedVar, get_aliased_var, NULL, 5, 0, 1, JOF_ENVCOORD|JOF_NAME|JOF_TYPESET|JOF_IC) \
/*
* Get the value of a module import by name and pushes it onto the stack.
*
@ -2895,7 +2950,7 @@
* Operands: uint32_t nameIndex
* Stack: => val
*/ \
MACRO(GetImport, get_import, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME) \
MACRO(GetImport, get_import, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_IC) \
/*
* Get the value of a binding from the environment `env`. If the name is
* not bound in `env`, throw a ReferenceError.
@ -2920,7 +2975,7 @@
* Operands: uint32_t nameIndex
* Stack: env => v
*/ \
MACRO(GetBoundName, get_bound_name, NULL, 5, 1, 1, JOF_ATOM|JOF_NAME|JOF_IC) \
MACRO(GetBoundName, get_bound_name, NULL, 5, 1, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_IC) \
/*
* Push the value of an intrinsic onto the stack.
*
@ -2933,7 +2988,7 @@
* Operands: uint32_t nameIndex
* Stack: => intrinsic[name]
*/ \
MACRO(GetIntrinsic, get_intrinsic, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_IC) \
MACRO(GetIntrinsic, get_intrinsic, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_IC) \
/*
* Pushes the currently executing function onto the stack.
*
@ -3272,27 +3327,87 @@
*/ \
MACRO(BindVar, bind_var, NULL, 1, 0, 1, JOF_BYTE) \
/*
* Check for conflicting bindings and then initialize them in global or
* sloppy eval scripts. This is required for global scripts with any
* top-level bindings, or any sloppy-eval scripts with any non-lexical
* top-level bindings.
* Create a new binding on the current VariableEnvironment (the environment
* on the environment chain designated to receive new variables).
*
* Implements: [GlobalDeclarationInstantiation][1] and
* [EvalDeclarationInstantiation][2] (except step 12).
* `JSOp::Def{Var,Let,Const,Fun}` instructions must appear in the script
* before anything else that might add bindings to the environment, and
* only once per binding. There must be a correct entry for the new binding
* in `script->bodyScope()`. (All this ensures that at run time, there is
* no existing conflicting binding. This is checked by the
* `JSOp::CheckGlobalOrEvalDecl` bytecode instruction that must appear
* before `JSOp::Def{Var,Let,Const,Fun}`.)
*
* The `lastFun` argument is a GCThingIndex of the last hoisted top-level
* function that is part of top-level script initialization. The gcthings
* from index `0` thru `lastFun` contain only scopes and hoisted functions.
* Throw a SyntaxError if the current VariableEnvironment is the global
* environment and a binding with the same name exists on the global
* lexical environment.
*
* This is used for global scripts and also in some cases for function
* scripts where use of dynamic scoping inhibits optimization.
*
* Category: Variables and scopes
* Type: Creating and deleting bindings
* Operands: uint32_t nameIndex
* Stack: =>
*/ \
MACRO(DefVar, def_var, NULL, 5, 0, 0, JOF_ATOM) \
/*
* Create a new binding for the given function on the current scope.
*
* `fun` must be a function object with an explicit name. The new
* variable's name is `fun->explicitName()`, and its value is `fun`. In
* global scope, this creates a new property on the global object.
*
* Implements: The body of the loop in [GlobalDeclarationInstantiation][1]
* step 17 ("For each Parse Node *f* in *functionsToInitialize*...") and
* the corresponding loop in [EvalDeclarationInstantiation][2].
*
* [1]: https://tc39.es/ecma262/#sec-globaldeclarationinstantiation
* [2]: https://tc39.es/ecma262/#sec-evaldeclarationinstantiation
*
* Category: Variables and scopes
* Type: Creating and deleting bindings
* Operands: uint32_t lastFun
* Operands:
* Stack: fun =>
*/ \
MACRO(DefFun, def_fun, NULL, 1, 1, 0, JOF_BYTE) \
/*
* Create a new uninitialized mutable binding in the global lexical
* environment. Throw a SyntaxError if a binding with the same name already
* exists on that environment, or if a var binding with the same name
* exists on the global.
*
* Category: Variables and scopes
* Type: Creating and deleting bindings
* Operands: uint32_t nameIndex
* Stack: =>
*/ \
MACRO(GlobalOrEvalDeclInstantiation, global_or_eval_decl_instantiation, NULL, 5, 0, 0, JOF_GCTHING) \
MACRO(DefLet, def_let, NULL, 5, 0, 0, JOF_ATOM) \
/*
* Like `DefLet`, but create an uninitialized constant binding.
*
* Category: Variables and scopes
* Type: Creating and deleting bindings
* Operands: uint32_t nameIndex
* Stack: =>
*/ \
MACRO(DefConst, def_const, NULL, 5, 0, 0, JOF_ATOM) \
/*
* Check for conflicting bindings before `JSOp::Def{Var,Let,Const,Fun}` in
* global or sloppy eval scripts.
*
* Implements: [GlobalDeclarationInstantiation][1] steps 5, 6, 10 and 12,
* and [EvalDeclarationInstantiation][2] steps 5 and 8.
*
* [1]: https://tc39.es/ecma262/#sec-globaldeclarationinstantiation
* [2]: https://tc39.es/ecma262/#sec-evaldeclarationinstantiation
*
* Category: Variables and scopes
* Type: Creating and deleting bindings
* Operands:
* Stack: =>
*/ \
MACRO(CheckGlobalOrEvalDecl, check_global_or_eval_decl, NULL, 1, 0, 0, JOF_BYTE) \
/*
* Look up a variable on the environment chain and delete it. Push `true`
* on success (if a binding was deleted, or if no such binding existed in
@ -3367,7 +3482,7 @@
* Operands:
* Stack: => rest
*/ \
MACRO(Rest, rest, NULL, 1, 0, 1, JOF_BYTE|JOF_IC) \
MACRO(Rest, rest, NULL, 1, 0, 1, JOF_BYTE|JOF_TYPESET|JOF_IC) \
/*
* Determines the `this` value for current function frame and pushes it
* onto the stack.
@ -3564,16 +3679,6 @@
* a power of two. Use this macro to do so.
*/
#define FOR_EACH_TRAILING_UNUSED_OPCODE(MACRO) \
MACRO(229) \
MACRO(230) \
MACRO(231) \
MACRO(232) \
MACRO(233) \
MACRO(234) \
MACRO(235) \
MACRO(236) \
MACRO(237) \
MACRO(238) \
MACRO(239) \
MACRO(240) \
MACRO(241) \

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

@ -209,6 +209,8 @@ class SrcNote {
* (fromOperand).
*/
static constexpr ptrdiff_t ColSpanSignBit = 1 << (OperandBits - 1);
static constexpr ptrdiff_t MinColSpan = -ColSpanSignBit;
static constexpr ptrdiff_t MaxColSpan = ColSpanSignBit - 1;
static inline ptrdiff_t fromOperand(ptrdiff_t operand) {
// There should be no bits set outside the field we're going to
@ -220,8 +222,9 @@ class SrcNote {
}
public:
static constexpr ptrdiff_t MinColSpan = -ColSpanSignBit;
static constexpr ptrdiff_t MaxColSpan = ColSpanSignBit - 1;
static inline bool isRepresentable(ptrdiff_t colspan) {
return MinColSpan <= colspan && colspan <= MaxColSpan;
}
static inline ptrdiff_t toOperand(ptrdiff_t colspan) {
// Truncate the two's complement colspan, for storage as an operand.
@ -249,20 +252,13 @@ class SrcNote {
}
public:
static inline unsigned lengthFor(unsigned line, size_t initialLine) {
unsigned operandSize = toOperand(line, initialLine) >
ptrdiff_t(SrcNote::FourBytesOperandMask)
? 4
: 1;
return 1 /* SetLine */ + operandSize;
static inline unsigned lengthFor(unsigned line) {
return 1 /* SetLine */ + (line > SrcNote::FourBytesOperandMask ? 4 : 1);
}
static inline ptrdiff_t toOperand(size_t line, size_t initialLine) {
MOZ_ASSERT(line >= initialLine);
return ptrdiff_t(line - initialLine);
}
static inline ptrdiff_t toOperand(size_t line) { return ptrdiff_t(line); }
static inline size_t getLine(const SrcNote* sn, size_t initialLine);
static inline size_t getLine(const SrcNote* sn);
};
friend class SrcNoteWriter;
@ -370,9 +366,8 @@ inline ptrdiff_t SrcNote::ColSpan::getSpan(const SrcNote* sn) {
}
/* static */
inline size_t SrcNote::SetLine::getLine(const SrcNote* sn, size_t initialLine) {
return initialLine +
fromOperand(SrcNoteReader::getOperand(sn, unsigned(Operands::Line)));
inline size_t SrcNote::SetLine::getLine(const SrcNote* sn) {
return fromOperand(SrcNoteReader::getOperand(sn, unsigned(Operands::Line)));
}
// Iterate over SrcNote array, until it hits terminator.

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

@ -105,6 +105,17 @@ enum class ImmutableScriptFlagsEnum : uint32_t {
// On top-level global/eval/module scripts, this is set when the embedding
// ensures this script will not be re-used. In this case, parser literals may
// be exposed directly instead of being cloned.
//
// For non-lazy functions, this is set when the function is almost-certain to
// be run once (and its parents transitively the same). In this case, the
// function may be marked as a singleton to improve typeset precision. Note
// that under edge cases with fun.caller the function may still run multiple
// times.
//
// For lazy functions, the situation is more complex. If enclosing script is
// not yet compiled, this flag is undefined and should not be used. As the
// enclosing script is compiled, this flag is updated to the same definition
// the eventual non-lazy function will use.
TreatAsRunOnce = 1 << 7,
// ----
@ -243,6 +254,10 @@ enum class ImmutableScriptFlagsEnum : uint32_t {
// is set independently of whether we actually use an `arguments` binding. The
// conditions are specified in the ECMAScript spec.
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 << 28,
};
enum class MutableScriptFlagsEnum : uint32_t {
@ -292,8 +307,8 @@ enum class MutableScriptFlagsEnum : uint32_t {
// Script has had hoisted shape guard fail.
FailedShapeGuard = 1 << 19,
// Script has had instruction hoisted by LICM fail.
HadLICMInvalidation = 1 << 20,
// Script experienced frequent bailouts.
HadFrequentBailouts = 1 << 20,
// An overflow happened where Range Analysis hoped it would not. The next
// compile should be more conservative.
@ -308,9 +323,6 @@ enum class MutableScriptFlagsEnum : uint32_t {
// Lexical check did fail and bail out.
FailedLexicalCheck = 1 << 24,
// A guard inserted by phi specialization failed.
HadSpeculativePhiBailout = 1 << 25,
};
} // namespace js

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

@ -15,7 +15,10 @@
#include "jstypes.h" // JS_PUBLIC_API
#include "js/TypeDecls.h"
#include "js/RootingAPI.h" // JS::Handle
struct JS_PUBLIC_API JSContext;
class JS_PUBLIC_API JSString;
namespace JS {

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

@ -9,7 +9,7 @@
#include <stdint.h> // uint8_t
#include "js/friend/ErrorMessages.h" // JSErrNum
#include "jsfriendapi.h" // JSErrNum
namespace js {

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

@ -54,6 +54,8 @@ const RESOLVED_NAME: u16 = 1 << 13;
#[allow(dead_code)]
const RESOLVED_LENGTH: u16 = 1 << 14;
#[allow(dead_code)]
const NEW_SCRIPT_CLEARED: u16 = 1 << 15;
#[allow(dead_code)]
const NORMAL_KIND: u16 = (FunctionKind::NormalFunction as u16) << FUNCTION_KIND_SHIFT;
#[allow(dead_code)]
const ASMJS_KIND: u16 = (FunctionKind::AsmJS as u16) << FUNCTION_KIND_SHIFT;
@ -98,7 +100,7 @@ const INTERPRETED_SETTER: u16 = BASESCRIPT | SETTER_KIND;
#[allow(dead_code)]
const INTERPRETED_METHOD: u16 = BASESCRIPT | METHOD_KIND;
#[allow(dead_code)]
const MUTABLE_FLAGS: u16 = RESOLVED_NAME | RESOLVED_LENGTH;
const MUTABLE_FLAGS: u16 = RESOLVED_NAME | RESOLVED_LENGTH | NEW_SCRIPT_CLEARED;
#[allow(dead_code)]
const STABLE_ACROSS_CLONES: u16 = CONSTRUCTOR | LAMBDA | SELF_HOSTED | FUNCTION_KIND_MASK;
// @@@@ END TYPES @@@@

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

@ -63,6 +63,7 @@ macro_rules! using_opcode_database {
(ImportMeta, import_meta, NULL, 1, 0, 1, JOF_BYTE),
(NewInit, new_init, NULL, 1, 0, 1, JOF_BYTE|JOF_IC),
(NewObject, new_object, NULL, 5, 0, 1, JOF_OBJECT|JOF_IC),
(NewObjectWithGroup, new_object_with_group, NULL, 5, 0, 1, JOF_OBJECT|JOF_IC),
(Object, object, NULL, 5, 0, 1, JOF_OBJECT),
(ObjWithProto, obj_with_proto, NULL, 1, 1, 1, JOF_BYTE),
(InitProp, init_prop, NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_PROPINIT|JOF_IC),
@ -79,8 +80,11 @@ macro_rules! using_opcode_database {
(InitHiddenPropSetter, init_hidden_prop_setter, NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_PROPINIT),
(InitElemSetter, init_elem_setter, NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_PROPINIT),
(InitHiddenElemSetter, init_hidden_elem_setter, NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_PROPINIT),
(GetProp, get_prop, NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_IC),
(GetElem, get_elem, NULL, 1, 2, 1, JOF_BYTE|JOF_ELEM|JOF_IC),
(GetProp, get_prop, NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_IC),
(CallProp, call_prop, NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_IC),
(GetElem, get_elem, NULL, 1, 2, 1, JOF_BYTE|JOF_ELEM|JOF_TYPESET|JOF_IC),
(CallElem, call_elem, NULL, 1, 2, 1, JOF_BYTE|JOF_ELEM|JOF_TYPESET|JOF_IC),
(Length, length, NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_IC),
(SetProp, set_prop, NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_PROPSET|JOF_CHECKSLOPPY|JOF_IC),
(StrictSetProp, strict_set_prop, NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_PROPSET|JOF_CHECKSTRICT|JOF_IC),
(SetElem, set_elem, NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_PROPSET|JOF_CHECKSLOPPY|JOF_IC),
@ -92,8 +96,8 @@ macro_rules! using_opcode_database {
(HasOwn, has_own, NULL, 1, 2, 1, JOF_BYTE|JOF_IC),
(CheckPrivateField, check_private_field, NULL, 3, 2, 3, JOF_TWO_UINT8|JOF_CHECKSTRICT|JOF_IC),
(SuperBase, super_base, NULL, 1, 1, 1, JOF_BYTE),
(GetPropSuper, get_prop_super, NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_IC),
(GetElemSuper, get_elem_super, NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_IC),
(GetPropSuper, get_prop_super, NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_IC),
(GetElemSuper, get_elem_super, NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_TYPESET|JOF_IC),
(SetPropSuper, set_prop_super, NULL, 5, 3, 1, JOF_ATOM|JOF_PROP|JOF_PROPSET|JOF_CHECKSLOPPY),
(StrictSetPropSuper, strict_set_prop_super, NULL, 5, 3, 1, JOF_ATOM|JOF_PROP|JOF_PROPSET|JOF_CHECKSTRICT),
(SetElemSuper, set_elem_super, NULL, 1, 4, 1, JOF_BYTE|JOF_ELEM|JOF_PROPSET|JOF_CHECKSLOPPY),
@ -101,6 +105,7 @@ macro_rules! using_opcode_database {
(Iter, iter, NULL, 1, 1, 1, JOF_BYTE|JOF_IC),
(MoreIter, more_iter, NULL, 1, 1, 2, JOF_BYTE),
(IsNoIter, is_no_iter, NULL, 1, 1, 2, JOF_BYTE),
(IterNext, iter_next, NULL, 1, 1, 1, JOF_BYTE),
(EndIter, end_iter, NULL, 1, 2, 0, JOF_BYTE),
(CheckIsObj, check_is_obj, NULL, 2, 1, 1, JOF_UINT8),
(CheckObjCoercible, check_obj_coercible, NULL, 1, 1, 1, JOF_BYTE),
@ -110,6 +115,7 @@ macro_rules! using_opcode_database {
(InitElemArray, init_elem_array, NULL, 5, 2, 1, JOF_UINT32|JOF_ELEM|JOF_PROPINIT|JOF_IC),
(InitElemInc, init_elem_inc, NULL, 1, 3, 2, JOF_BYTE|JOF_ELEM|JOF_PROPINIT|JOF_IC),
(Hole, hole, NULL, 1, 0, 1, JOF_BYTE),
(NewArrayCopyOnWrite, new_array_copy_on_write, NULL, 5, 0, 1, JOF_OBJECT),
(RegExp, reg_exp, NULL, 5, 0, 1, JOF_REGEXP),
(Lambda, lambda, NULL, 5, 0, 1, JOF_OBJECT),
(LambdaArrow, lambda_arrow, NULL, 5, 1, 1, JOF_OBJECT),
@ -120,25 +126,25 @@ macro_rules! using_opcode_database {
(ClassConstructor, class_constructor, NULL, 13, 0, 1, JOF_CLASS_CTOR),
(DerivedConstructor, derived_constructor, NULL, 13, 1, 1, JOF_CLASS_CTOR),
(BuiltinObject, builtin_object, NULL, 2, 0, 1, JOF_UINT8),
(Call, call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC),
(CallIter, call_iter, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC),
(FunApply, fun_apply, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC),
(FunCall, fun_call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC),
(CallIgnoresRv, call_ignores_rv, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC),
(SpreadCall, spread_call, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_IC),
(Call, call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_IC),
(CallIter, call_iter, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_IC),
(FunApply, fun_apply, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_IC),
(FunCall, fun_call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_IC),
(CallIgnoresRv, call_ignores_rv, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_IC),
(SpreadCall, spread_call, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_TYPESET|JOF_IC),
(OptimizeSpreadCall, optimize_spread_call, NULL, 1, 1, 2, JOF_BYTE|JOF_IC),
(Eval, eval, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CHECKSLOPPY|JOF_IC),
(SpreadEval, spread_eval, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_CHECKSLOPPY|JOF_IC),
(StrictEval, strict_eval, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CHECKSTRICT|JOF_IC),
(StrictSpreadEval, strict_spread_eval, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_CHECKSTRICT|JOF_IC),
(Eval, eval, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_CHECKSLOPPY|JOF_IC),
(SpreadEval, spread_eval, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_TYPESET|JOF_CHECKSLOPPY|JOF_IC),
(StrictEval, strict_eval, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_TYPESET|JOF_CHECKSTRICT|JOF_IC),
(StrictSpreadEval, strict_spread_eval, NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_SPREAD|JOF_TYPESET|JOF_CHECKSTRICT|JOF_IC),
(ImplicitThis, implicit_this, "", 5, 0, 1, JOF_ATOM),
(GImplicitThis, g_implicit_this, "", 5, 0, 1, JOF_ATOM),
(CallSiteObj, call_site_obj, NULL, 5, 0, 1, JOF_OBJECT),
(IsConstructing, is_constructing, NULL, 1, 0, 1, JOF_BYTE),
(New, new_, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CONSTRUCT|JOF_IC),
(SuperCall, super_call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CONSTRUCT|JOF_IC),
(SpreadNew, spread_new, NULL, 1, 4, 1, JOF_BYTE|JOF_INVOKE|JOF_CONSTRUCT|JOF_SPREAD|JOF_IC),
(SpreadSuperCall, spread_super_call, NULL, 1, 4, 1, JOF_BYTE|JOF_INVOKE|JOF_CONSTRUCT|JOF_SPREAD|JOF_IC),
(New, new_, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CONSTRUCT|JOF_TYPESET|JOF_IC),
(SuperCall, super_call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_CONSTRUCT|JOF_TYPESET|JOF_IC),
(SpreadNew, spread_new, NULL, 1, 4, 1, JOF_BYTE|JOF_INVOKE|JOF_CONSTRUCT|JOF_SPREAD|JOF_TYPESET|JOF_IC),
(SpreadSuperCall, spread_super_call, NULL, 1, 4, 1, JOF_BYTE|JOF_INVOKE|JOF_CONSTRUCT|JOF_SPREAD|JOF_TYPESET|JOF_IC),
(SuperFun, super_fun, NULL, 1, 1, 1, JOF_BYTE),
(CheckThisReinit, check_this_reinit, NULL, 1, 1, 1, JOF_BYTE),
(Generator, generator, NULL, 1, 0, 1, JOF_BYTE),
@ -189,14 +195,14 @@ macro_rules! using_opcode_database {
(CheckThis, check_this, NULL, 1, 1, 1, JOF_BYTE),
(BindGName, bind_g_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_GNAME|JOF_IC),
(BindName, bind_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_IC),
(GetName, get_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_IC),
(GetGName, get_g_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_GNAME|JOF_IC),
(GetName, get_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_IC),
(GetGName, get_g_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_GNAME|JOF_IC),
(GetArg, get_arg, NULL, 3, 0, 1, JOF_QARG|JOF_NAME),
(GetLocal, get_local, NULL, 4, 0, 1, JOF_LOCAL|JOF_NAME),
(GetAliasedVar, get_aliased_var, NULL, 5, 0, 1, JOF_ENVCOORD|JOF_NAME),
(GetImport, get_import, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME),
(GetBoundName, get_bound_name, NULL, 5, 1, 1, JOF_ATOM|JOF_NAME|JOF_IC),
(GetIntrinsic, get_intrinsic, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_IC),
(GetAliasedVar, get_aliased_var, NULL, 5, 0, 1, JOF_ENVCOORD|JOF_NAME|JOF_TYPESET|JOF_IC),
(GetImport, get_import, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_IC),
(GetBoundName, get_bound_name, NULL, 5, 1, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_IC),
(GetIntrinsic, get_intrinsic, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_IC),
(Callee, callee, NULL, 1, 0, 1, JOF_BYTE),
(EnvCallee, env_callee, NULL, 2, 0, 1, JOF_UINT8),
(SetName, set_name, NULL, 5, 2, 1, JOF_ATOM|JOF_NAME|JOF_PROPSET|JOF_CHECKSLOPPY|JOF_IC),
@ -216,10 +222,14 @@ macro_rules! using_opcode_database {
(EnterWith, enter_with, NULL, 5, 1, 0, JOF_SCOPE),
(LeaveWith, leave_with, NULL, 1, 0, 0, JOF_BYTE),
(BindVar, bind_var, NULL, 1, 0, 1, JOF_BYTE),
(GlobalOrEvalDeclInstantiation, global_or_eval_decl_instantiation, NULL, 5, 0, 0, JOF_GCTHING),
(DefVar, def_var, NULL, 5, 0, 0, JOF_ATOM),
(DefFun, def_fun, NULL, 1, 1, 0, JOF_BYTE),
(DefLet, def_let, NULL, 5, 0, 0, JOF_ATOM),
(DefConst, def_const, NULL, 5, 0, 0, JOF_ATOM),
(CheckGlobalOrEvalDecl, check_global_or_eval_decl, NULL, 1, 0, 0, JOF_BYTE),
(DelName, del_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_CHECKSLOPPY),
(Arguments, arguments, NULL, 1, 0, 1, JOF_BYTE),
(Rest, rest, NULL, 1, 0, 1, JOF_BYTE|JOF_IC),
(Rest, rest, NULL, 1, 0, 1, JOF_BYTE|JOF_TYPESET|JOF_IC),
(FunctionThis, function_this, NULL, 1, 0, 1, JOF_BYTE),
(Pop, pop, NULL, 1, 1, 0, JOF_BYTE),
(PopN, pop_n, NULL, 3, -1, 0, JOF_UINT16),
@ -315,77 +325,77 @@ const JOF_LOCAL: u32 = 12;
/// yield, await, or gosub resume index
const JOF_RESUMEINDEX: u32 = 13;
/// inline DoubleValue
const JOF_DOUBLE: u32 = 14;
/// uint32_t generic gc-thing index
const JOF_GCTHING: u32 = 15;
/// uint32_t constant index
const JOF_ATOM: u32 = 16;
const JOF_ATOM: u32 = 14;
/// uint32_t object index
const JOF_OBJECT: u32 = 17;
const JOF_OBJECT: u32 = 15;
/// uint32_t regexp index
const JOF_REGEXP: u32 = 18;
const JOF_REGEXP: u32 = 16;
/// inline DoubleValue
const JOF_DOUBLE: u32 = 17;
/// uint32_t scope index
const JOF_SCOPE: u32 = 19;
/// uint32_t index for BigInt value
const JOF_BIGINT: u32 = 20;
const JOF_SCOPE: u32 = 18;
/// uint32_t IC index
const JOF_ICINDEX: u32 = 21;
const JOF_ICINDEX: u32 = 19;
/// JSOp::LoopHead, combines JOF_ICINDEX and JOF_UINT8
const JOF_LOOPHEAD: u32 = 22;
const JOF_LOOPHEAD: u32 = 20;
/// uint32_t index for BigInt value
const JOF_BIGINT: u32 = 21;
/// uint32_t atom index, sourceStart, sourceEnd
const JOF_CLASS_CTOR: u32 = 23;
const JOF_CLASS_CTOR: u32 = 22;
/// A pair of unspecified uint8_t arguments
const JOF_TWO_UINT8: u32 = 24;
const JOF_TWO_UINT8: u32 = 23;
/// mask for above immediate types
const JOF_TYPEMASK: u32 = 0xFF;
const JOF_TYPEMASK: u32 = 0x001f;
/// name operation
const JOF_NAME: u32 = 1 << 8;
const JOF_NAME: u32 = 1 << 5;
/// obj.prop operation
const JOF_PROP: u32 = 2 << 8;
const JOF_PROP: u32 = 2 << 5;
/// obj[index] operation
const JOF_ELEM: u32 = 3 << 8;
const JOF_ELEM: u32 = 3 << 5;
/// property/element/name set operation
const JOF_PROPSET: u32 = 1 << 16;
const JOF_PROPSET: u32 = 1 << 7;
/// property/element/name init operation
const JOF_PROPINIT: u32 = 1 << 17;
const JOF_PROPINIT: u32 = 1 << 8;
/// op can only be generated in sloppy mode
const JOF_CHECKSLOPPY: u32 = 1 << 18;
const JOF_CHECKSLOPPY: u32 = 1 << 10;
/// op can only be generated in strict mode
const JOF_CHECKSTRICT: u32 = 1 << 19;
const JOF_CHECKSTRICT: u32 = 1 << 11;
/// any call, construct, or eval instruction
const JOF_INVOKE: u32 = 1 << 20;
const JOF_INVOKE: u32 = 1 << 12;
/// invoke instruction using [[Construct]] entry
const JOF_CONSTRUCT: u32 = 1 << 21;
const JOF_CONSTRUCT: u32 = 1 << 13;
/// invoke instruction using spread argument
const JOF_SPREAD: u32 = 1 << 22;
const JOF_SPREAD: u32 = 1 << 14;
/// predicted global name
const JOF_GNAME: u32 = 1 << 23;
const JOF_GNAME: u32 = 1 << 15;
/// has an entry in a script's type sets
const JOF_TYPESET: u32 = 1 << 16;
/// baseline may use an IC for this op
const JOF_IC: u32 = 1 << 24;
const JOF_IC: u32 = 1 << 17;
// @@@@ END FLAGS @@@@
@ -567,6 +577,10 @@ impl Opcode {
pub fn has_argc(self) -> bool {
self.format_bits() & JOF_TYPEMASK == JOF_ARGC
}
pub fn has_typeset(self) -> bool {
self.format_bits() & JOF_TYPESET != 0
}
}
#[cfg(test)]

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

@ -70,6 +70,8 @@ pub enum ImmutableScriptFlagsEnum {
AlwaysNeedsArgsObj = 1 << 26,
#[allow(dead_code)]
HasMappedArgsObj = 1 << 27,
#[allow(dead_code)]
IsLikelyConstructorWrapper = 1 << 28,
}
#[derive(Debug, Clone, Copy)]
@ -99,7 +101,7 @@ pub enum MutableScriptFlagsEnum {
#[allow(dead_code)]
FailedShapeGuard = 1 << 19,
#[allow(dead_code)]
HadLICMInvalidation = 1 << 20,
HadFrequentBailouts = 1 << 20,
#[allow(dead_code)]
HadOverflowBailout = 1 << 21,
#[allow(dead_code)]
@ -108,8 +110,6 @@ pub enum MutableScriptFlagsEnum {
InvalidatedIdempotentCache = 1 << 23,
#[allow(dead_code)]
FailedLexicalCheck = 1 << 24,
#[allow(dead_code)]
HadSpeculativePhiBailout = 1 << 25,
}
// @@@@ END TYPES @@@@
@ -156,6 +156,7 @@ pub struct ImmutableScriptData {
pub body_scope_index: u32,
pub num_ic_entries: u32,
pub fun_length: u16,
pub num_bytecode_type_sets: u32,
pub bytecode: Vec<u8>,
pub scope_notes: Vec<ScopeNote>,
// TODO: Add resume_offsets and try_notes.