Skip to content

Commit af80f7a

Browse files
committed
fix: restore Reserved1/2/3, remove global opcodes re-added by mistake
Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
1 parent 6935488 commit af80f7a

4 files changed

Lines changed: 25 additions & 228 deletions

File tree

core/engine/src/vm/code_block.rs

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -396,24 +396,6 @@ impl CodeBlock {
396396
| Instruction::CreateUnmappedArgumentsObject { dst }
397397
| Instruction::RestParameterInit { dst }
398398
| Instruction::StoreNewArray { dst } => format!("dst:{dst}"),
399-
Instruction::HasRestrictedGlobalProperty { dst, index }
400-
| Instruction::CanDeclareGlobalFunction { dst, index }
401-
| Instruction::CanDeclareGlobalVar { dst, index } => {
402-
format!("dst: {dst}, index: {index}")
403-
}
404-
Instruction::CreateGlobalFunctionBinding {
405-
src,
406-
configurable,
407-
name_index,
408-
} => {
409-
format!("src: {src}, configurable: {configurable}, name_index: {name_index}")
410-
}
411-
Instruction::CreateGlobalVarBinding {
412-
configurable,
413-
name_index,
414-
} => {
415-
format!("configurable: {configurable}, name_index: {name_index}")
416-
}
417399
Instruction::Add { lhs, rhs, dst }
418400
| Instruction::Sub { lhs, rhs, dst }
419401
| Instruction::Div { lhs, rhs, dst }
@@ -895,7 +877,10 @@ impl CodeBlock {
895877
| Instruction::AsyncGenerator => String::new(),
896878
Instruction::AddDisposableResource { value } => format!("value: {value}"),
897879
Instruction::DisposeResources { count } => format!("count: {count}"),
898-
Instruction::Reserved4
880+
Instruction::Reserved1
881+
| Instruction::Reserved2
882+
| Instruction::Reserved3
883+
| Instruction::Reserved4
899884
| Instruction::Reserved5
900885
| Instruction::Reserved6
901886
| Instruction::Reserved7
@@ -947,7 +932,9 @@ impl CodeBlock {
947932
| Instruction::Reserved53
948933
| Instruction::Reserved54
949934
| Instruction::Reserved55
950-
| Instruction::Reserved56 => unreachable!("Reserved opcodes are unreachable"),
935+
| Instruction::Reserved56
936+
| Instruction::Reserved57
937+
| Instruction::Reserved58 => unreachable!("Reserved opcodes are unreachable"),
951938
}
952939
}
953940
}

core/engine/src/vm/flowgraph/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,7 @@ impl CodeBlock {
367367
| Instruction::CheckReturn
368368
| Instruction::BindThisValue { .. }
369369
| Instruction::CreateMappedArgumentsObject { .. }
370-
| Instruction::CreateUnmappedArgumentsObject { .. }
371-
| Instruction::HasRestrictedGlobalProperty { .. }
372-
| Instruction::CanDeclareGlobalFunction { .. }
373-
| Instruction::CanDeclareGlobalVar { .. }
374-
| Instruction::CreateGlobalFunctionBinding { .. }
375-
| Instruction::CreateGlobalVarBinding { .. } => {
370+
| Instruction::CreateUnmappedArgumentsObject { .. } => {
376371
graph.add_node(previous_pc, NodeShape::None, label.into(), Color::None);
377372
graph.add_edge(previous_pc, pc, None, Color::None, EdgeStyle::Line);
378373
}
@@ -387,7 +382,10 @@ impl CodeBlock {
387382
let label = format!("DisposeResources count: {count}");
388383
graph.add_node(previous_pc, NodeShape::None, label.into(), Color::None);
389384
}
390-
Instruction::Reserved4
385+
Instruction::Reserved1
386+
| Instruction::Reserved2
387+
| Instruction::Reserved3
388+
| Instruction::Reserved4
391389
| Instruction::Reserved5
392390
| Instruction::Reserved6
393391
| Instruction::Reserved7
@@ -439,7 +437,9 @@ impl CodeBlock {
439437
| Instruction::Reserved53
440438
| Instruction::Reserved54
441439
| Instruction::Reserved55
442-
| Instruction::Reserved56 => unreachable!("Reserved opcodes are unreachable"),
440+
| Instruction::Reserved56
441+
| Instruction::Reserved57
442+
| Instruction::Reserved58 => unreachable!("Reserved opcodes are unreachable"),
443443
}
444444
}
445445

core/engine/src/vm/opcode/global.rs

Lines changed: 0 additions & 147 deletions
This file was deleted.

core/engine/src/vm/opcode/mod.rs

Lines changed: 10 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ mod environment;
2525
mod function;
2626
mod generator;
2727
mod get;
28-
mod global;
2928
mod iteration;
3029
mod meta;
3130
mod new;
@@ -71,8 +70,6 @@ pub(crate) use generator::*;
7170
#[doc(inline)]
7271
pub(crate) use get::*;
7372
#[doc(inline)]
74-
pub(crate) use global::*;
75-
#[doc(inline)]
7673
pub(crate) use iteration::*;
7774
#[doc(inline)]
7875
pub(crate) use meta::*;
@@ -2145,56 +2142,6 @@ generate_opcodes! {
21452142
/// - Output: dst
21462143
CreateUnmappedArgumentsObject { dst: RegisterOperand },
21472144

2148-
/// Performs [`HasRestrictedGlobalProperty ( N )`][spec]
2149-
///
2150-
/// - Operands:
2151-
/// - index: `VaryingOperand`
2152-
/// - Registers:
2153-
/// - Output: dst
2154-
///
2155-
/// [spec]: https://tc39.es/ecma262/#sec-hasrestrictedglobalproperty
2156-
HasRestrictedGlobalProperty { dst: RegisterOperand, index: IndexOperand },
2157-
2158-
/// Performs [`CanDeclareGlobalFunction ( N )`][spec]
2159-
///
2160-
/// - Operands:
2161-
/// - index: `VaryingOperand`
2162-
/// - Registers:
2163-
/// - Output: dst
2164-
///
2165-
/// [spec]: https://tc39.es/ecma262/#sec-candeclareglobalfunction
2166-
CanDeclareGlobalFunction { dst: RegisterOperand, index: IndexOperand },
2167-
2168-
/// Performs [`CanDeclareGlobalVar ( N )`][spec]
2169-
///
2170-
/// - Operands:
2171-
/// - index: `VaryingOperand`
2172-
/// - Registers:
2173-
/// - Output: dst
2174-
///
2175-
/// [spec]: https://tc39.es/ecma262/#sec-candeclareglobalvar
2176-
CanDeclareGlobalVar { dst: RegisterOperand, index: IndexOperand },
2177-
2178-
/// Performs [`CreateGlobalFunctionBinding ( N, V, D )`][spec]
2179-
///
2180-
/// - Operands:
2181-
/// - configurable: `bool`
2182-
/// - name_index: `VaryingOperand`
2183-
/// - Registers:
2184-
/// - Input: src
2185-
///
2186-
/// [spec]: https://tc39.es/ecma262/#sec-createglobalfunctionbinding
2187-
CreateGlobalFunctionBinding { src: RegisterOperand, configurable: IndexOperand, name_index: IndexOperand },
2188-
2189-
/// Performs [`CreateGlobalVarBinding ( N, V, D )`][spec]
2190-
///
2191-
/// - Operands:
2192-
/// - configurable: `bool`
2193-
/// - name_index: `VaryingOperand`
2194-
///
2195-
/// [spec]: https://tc39.es/ecma262/#sec-createglobalvarbinding
2196-
CreateGlobalVarBinding { configurable: IndexOperand, name_index: IndexOperand },
2197-
21982145
/// Add a disposable resource to the disposal stack.
21992146
///
22002147
/// This opcode implements the AddDisposableResource abstract operation.
@@ -2213,6 +2160,12 @@ generate_opcodes! {
22132160
/// - Stack: **=>**
22142161
DisposeResources { count: IndexOperand },
22152162
/// Reserved [`Opcode`].
2163+
Reserved1 => Reserved,
2164+
/// Reserved [`Opcode`].
2165+
Reserved2 => Reserved,
2166+
/// Reserved [`Opcode`].
2167+
Reserved3 => Reserved,
2168+
/// Reserved [`Opcode`].
22162169
Reserved4 => Reserved,
22172170
/// Reserved [`Opcode`].
22182171
Reserved5 => Reserved,
@@ -2318,4 +2271,8 @@ generate_opcodes! {
23182271
Reserved55 => Reserved,
23192272
/// Reserved [`Opcode`].
23202273
Reserved56 => Reserved,
2274+
/// Reserved [`Opcode`].
2275+
Reserved57 => Reserved,
2276+
/// Reserved [`Opcode`].
2277+
Reserved58 => Reserved,
23212278
}

0 commit comments

Comments
 (0)