Skip to content

Commit 4e5e850

Browse files
committed
[JSC] Merge BytecodeGeneratorBase into BytecodeGenerator
https://bugs.webkit.org/show_bug.cgi?id=328770 rdar://190893912 Reviewed by Sosuke Suzuki. We introduced BytecodeGeneratorBase originally because we shared it between JS and Wasm. But now Wasm directly interprets binary via IPInt, thus we no longer use this for Wasm. Just merge them for JS. * Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: * Source/JavaScriptCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations: * Source/JavaScriptCore/bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumperBase<InstructionStreamType>::dumpValue): * Source/JavaScriptCore/bytecode/BytecodeDumper.h: * Source/JavaScriptCore/bytecode/BytecodeGeneratorification.cpp: * Source/JavaScriptCore/bytecode/BytecodeList.rb: * Source/JavaScriptCore/bytecode/Fits.h: * Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h: * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp: (JSC::Label::setLocation): (JSC::BytecodeGenerator::allocateCalleeSaveSpace): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitJump): (JSC::BytecodeGenerator::fuseCompareAndJump): (JSC::BytecodeGenerator::fuseTestAndJmp): (JSC::BytecodeGenerator::emitJumpIfTrue): (JSC::BytecodeGenerator::emitJumpIfFalse): (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): (JSC::BytecodeGenerator::emitJumpIfNotReflectConstruct): (JSC::BytecodeGenerator::emitJumpIfNotEvalFunction): (JSC::BytecodeGenerator::emitJumpIfEmptyPropertyNameEnumerator): (JSC::BytecodeGenerator::emitJumpIfSentinelString): (JSC::BytecodeGenerator::emitWideJumpIfNotFunctionHasOwnProperty): (JSC::BytecodeGenerator::emitExpectedFunctionSnippet): (JSC::BytecodeGenerator::emitRequireObjectCoercible): (JSC::BytecodeGenerator::emitRequireObjectCoercibleForDestructuring): (JSC::BytecodeGenerator::emitIteratorClose): (JSC::GenericLabel<JSGeneratorTraits>::setLocation): Deleted. * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h: * Source/JavaScriptCore/bytecompiler/BytecodeGeneratorBase.h: Removed. * Source/JavaScriptCore/bytecompiler/BytecodeGeneratorInlines.h: Renamed from Source/JavaScriptCore/bytecompiler/BytecodeGeneratorBaseInlines.h. (JSC::shrinkToFit): (JSC::BytecodeGenerator::newLabel): (JSC::BytecodeGenerator::newEmittedLabel): (JSC::BytecodeGenerator::reclaimFreeRegisters): (JSC::BytecodeGenerator::emitLabel): (JSC::BytecodeGenerator::recordOpcode): (JSC::BytecodeGenerator::writeOpcode): (JSC::BytecodeGenerator::newRegister): (JSC::BytecodeGenerator::newTemporary): (JSC::BytecodeGenerator::newTemporaries): (JSC::BytecodeGenerator::addVar): * Source/JavaScriptCore/bytecompiler/Label.h: (JSC::BoundLabel::BoundLabel): (JSC::BoundLabel::target): (JSC::BoundLabel::saveTarget): (JSC::BoundLabel::operator int): (JSC::Label::bind): (JSC::Label::ref): (JSC::Label::deref): (JSC::Label::refCount const): (JSC::Label::hasOneRef const): (JSC::Label::isForward const): (JSC::Label::isBound const): (JSC::Label::location const): (JSC::Label::unresolvedJumps const): (JSC::BoundLabel::commitTarget): (JSC::GenericBoundLabel::GenericBoundLabel): Deleted. (JSC::GenericBoundLabel::target): Deleted. (JSC::GenericBoundLabel::saveTarget): Deleted. (JSC::GenericBoundLabel::commitTarget): Deleted. (JSC::GenericBoundLabel::operator int): Deleted. (JSC::GenericLabel::bind): Deleted. (JSC::GenericLabel::ref): Deleted. (JSC::GenericLabel::deref): Deleted. (JSC::GenericLabel::refCount const): Deleted. (JSC::GenericLabel::hasOneRef const): Deleted. (JSC::GenericLabel::isForward const): Deleted. (JSC::GenericLabel::isBound const): Deleted. (JSC::GenericLabel::location const): Deleted. (JSC::GenericLabel::unresolvedJumps const): Deleted. * Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp: * Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h: * Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp: Canonical link: https://commits.webkit.org/324734@main
1 parent 59e81f3 commit 4e5e850

16 files changed

Lines changed: 233 additions & 355 deletions

‎Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@
101101
072F534E2E3C0B7100389E15 /* CachedCall.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F8690E0F9584A100558697 /* CachedCall.h */; settings = {ATTRIBUTES = (Private, ); }; };
102102
072F534F2E3C0BC200389E15 /* ProtoCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 65FB5115184EE8F800C12B70 /* ProtoCallFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
103103
072F53502E3C0F3300389E15 /* JITSubGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE98B5B61BB9AE110073E7A6 /* JITSubGenerator.h */; };
104-
072F53512E3C3F8700389E15 /* BytecodeGeneratorBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C5AD6522F1866C00F1FB83 /* BytecodeGeneratorBase.h */; };
105104
072F53522E3C3FDA00389E15 /* ProfileTypeBytecodeFlag.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BA7752211A8E5F008D0B05 /* ProfileTypeBytecodeFlag.h */; };
106105
077B97302FD2BBE10042BC77 /* JavaScriptCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077B972F2FD2BBE10042BC77 /* JavaScriptCore.swift */; };
107106
077BB36E2FD3AD620042BC77 /* SwiftTestingHarness.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077BB36D2FD3AD620042BC77 /* SwiftTestingHarness.swift */; };
@@ -4172,8 +4171,7 @@
41724171
14BE7D3217135CF400D1807A /* WeakInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakInlines.h; sourceTree = "<group>"; };
41734172
14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakGCMap.h; sourceTree = "<group>"; };
41744173
14C1F9CF22EA51FD0040B145 /* Wasm.rb */ = {isa = PBXFileReference; lastKnownFileType = text.script.ruby; path = Wasm.rb; sourceTree = "<group>"; };
4175-
14C5AD6522F1866C00F1FB83 /* BytecodeGeneratorBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BytecodeGeneratorBase.h; sourceTree = "<group>"; };
4176-
14C5AD6622F1866C00F1FB83 /* BytecodeGeneratorBaseInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BytecodeGeneratorBaseInlines.h; sourceTree = "<group>"; };
4174+
14C5AD6622F1866C00F1FB83 /* BytecodeGeneratorInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BytecodeGeneratorInlines.h; sourceTree = "<group>"; };
41774175
14CA958A16AB50DE00938A06 /* StaticPropertyAnalyzer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticPropertyAnalyzer.h; sourceTree = "<group>"; };
41784176
14CA958C16AB50FA00938A06 /* ObjectAllocationProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectAllocationProfile.h; sourceTree = "<group>"; };
41794177
14CC3BA12138A238002D58B6 /* InstructionStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InstructionStream.cpp; sourceTree = "<group>"; };
@@ -8760,8 +8758,7 @@
87608758
children = (
87618759
969A07200ED1CE3300F1F681 /* BytecodeGenerator.cpp */,
87628760
969A07210ED1CE3300F1F681 /* BytecodeGenerator.h */,
8763-
14C5AD6522F1866C00F1FB83 /* BytecodeGeneratorBase.h */,
8764-
14C5AD6622F1866C00F1FB83 /* BytecodeGeneratorBaseInlines.h */,
8761+
14C5AD6622F1866C00F1FB83 /* BytecodeGeneratorInlines.h */,
87658762
969A07270ED1CE6900F1F681 /* Label.h */,
87668763
960097A50EBABB58007A7297 /* LabelScope.h */,
87678764
655EB29A10CE2581001A990E /* NodesCodegen.cpp */,
@@ -11588,7 +11585,6 @@
1158811585
0F21C27F14BEAA8200ADC64B /* BytecodeConventions.h in Headers */,
1158911586
E3D877741E65C0A000BE945A /* BytecodeDumper.h in Headers */,
1159011587
969A07230ED1CE3300F1F681 /* BytecodeGenerator.h in Headers */,
11591-
072F53512E3C3F8700389E15 /* BytecodeGeneratorBase.h in Headers */,
1159211588
E328DAE81D38D005001A2529 /* BytecodeGeneratorification.h in Headers */,
1159311589
E328DAE91D38D005001A2529 /* BytecodeGraph.h in Headers */,
1159411590
53663FDA23562F96005EA68C /* BytecodeIndex.h in Headers */,

‎Source/JavaScriptCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bytecode/Repatch.cpp
2020
bytecode/SetPrivateBrandStatus.cpp
2121
bytecode/Watchpoint.cpp
2222
bytecompiler/BytecodeGenerator.cpp
23-
bytecompiler/BytecodeGeneratorBaseInlines.h
23+
bytecompiler/BytecodeGeneratorInlines.h
2424
bytecompiler/NodesCodegen.cpp
2525
bytecompiler/StaticPropertyAnalyzer.h
2626
debugger/Debugger.cpp

‎Source/JavaScriptCore/bytecode/BytecodeDumper.cpp‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ void BytecodeDumperBase<InstructionStreamType>::dumpValue(VirtualRegister reg)
5555
}
5656

5757
template<typename InstructionStreamType>
58-
template<typename Traits>
59-
void BytecodeDumperBase<InstructionStreamType>::dumpValue(GenericBoundLabel<Traits> label)
58+
void BytecodeDumperBase<InstructionStreamType>::dumpValue(BoundLabel label)
6059
{
6160
int target = label.target();
6261
if (!target)
@@ -65,8 +64,6 @@ void BytecodeDumperBase<InstructionStreamType>::dumpValue(GenericBoundLabel<Trai
6564
m_out.print(target, "(->", targetOffset, ")");
6665
}
6766

68-
template void BytecodeDumperBase<JSInstructionStream>::dumpValue(GenericBoundLabel<JSGeneratorTraits>);
69-
7067
template<class Block>
7168
UTF8CString BytecodeDumper<Block>::registerName(VirtualRegister r) const
7269
{

‎Source/JavaScriptCore/bytecode/BytecodeDumper.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
#pragma once
2828

2929
#include "BytecodeBasicBlock.h"
30-
#include "BytecodeGeneratorBase.h"
3130
#include "CallLinkInfo.h"
3231
#include "ICStatusMap.h"
3332
#include "Instruction.h"
3433
#include "InstructionStream.h"
34+
#include "Label.h"
3535
#include "PropertyInlineCache.h"
3636
#include "WasmOps.h"
3737

@@ -60,8 +60,7 @@ class BytecodeDumperBase {
6060

6161
void dumpValue(VirtualRegister);
6262

63-
template<typename Traits>
64-
void dumpValue(GenericBoundLabel<Traits>);
63+
void dumpValue(BoundLabel);
6564

6665
template<typename T>
6766
void dumpValue(T v) { m_out.print(v); }

‎Source/JavaScriptCore/bytecode/BytecodeGeneratorification.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "BytecodeGeneratorification.h"
2929

3030
#include "BytecodeDumper.h"
31-
#include "BytecodeGeneratorBaseInlines.h"
31+
#include "BytecodeGeneratorInlines.h"
3232
#include "BytecodeLivenessAnalysisInlines.h"
3333
#include "BytecodeRewriter.h"
3434
#include "BytecodeStructs.h"

‎Source/JavaScriptCore/bytecode/BytecodeList.rb‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
:SymbolTableOrScopeDepth,
6161
:ToThisStatus,
6262
:TypeLocation,
63-
:WasmBoundLabel,
6463
:InlineWatchpointSet,
6564
:WriteBarrierStructureID,
6665

‎Source/JavaScriptCore/bytecode/Fits.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ struct Fits<OperandTypes, size> {
352352
}
353353
};
354354

355-
template<OpcodeSize size, typename GeneratorTraits>
356-
struct Fits<GenericBoundLabel<GeneratorTraits>, size> : public Fits<int, size> {
355+
template<OpcodeSize size>
356+
struct Fits<BoundLabel, size> : public Fits<int, size> {
357357
// This is a bit hacky: we need to delay computing jump targets, since we
358358
// might have to emit `nop`s to align the instructions stream. Additionally,
359359
// we have to compute the target before we start writing to the instruction
@@ -362,19 +362,19 @@ struct Fits<GenericBoundLabel<GeneratorTraits>, size> : public Fits<int, size> {
362362
// later we use the saved target when we call convert.
363363

364364
using Base = Fits<int, size>;
365-
static bool check(GenericBoundLabel<GeneratorTraits>& label)
365+
static bool check(BoundLabel& label)
366366
{
367367
return Base::check(label.saveTarget());
368368
}
369369

370-
static typename Base::TargetType convert(GenericBoundLabel<GeneratorTraits>& label)
370+
static typename Base::TargetType convert(BoundLabel& label)
371371
{
372372
return Base::convert(label.commitTarget());
373373
}
374374

375-
static GenericBoundLabel<GeneratorTraits> convert(typename Base::TargetType target)
375+
static BoundLabel convert(typename Base::TargetType target)
376376
{
377-
return GenericBoundLabel<GeneratorTraits>(Base::convert(target));
377+
return BoundLabel(Base::convert(target));
378378
}
379379
};
380380

‎Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,6 @@ class UnlinkedCodeBlock : public JSCell {
371371
private:
372372
friend class BytecodeRewriter;
373373
friend class UnlinkedCodeBlockGenerator;
374-
template<typename Traits>
375-
friend class BytecodeGeneratorBase;
376374

377375
template<typename CodeBlockType>
378376
friend class CachedCodeBlock;

‎Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp‎

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "AbstractModuleRecord.h"
3535
#include "BuiltinExecutables.h"
3636
#include "BuiltinNames.h"
37-
#include "BytecodeGeneratorBaseInlines.h"
37+
#include "BytecodeGeneratorInlines.h"
3838
#include "BytecodeGeneratorification.h"
3939
#include "BytecodeUseDef.h"
4040
#include "DefinePropertyAttributes.h"
@@ -104,10 +104,9 @@ struct VarArgsOp<OpSuperConstruct> {
104104
using type = OpSuperConstructVarargs;
105105
};
106106

107-
template<>
108-
void GenericLabel<JSGeneratorTraits>::setLocation(BytecodeGenerator& generator, unsigned location)
107+
void Label::setLocation(BytecodeGenerator& generator, unsigned location)
109108
{
110-
static_cast<JSC::BytecodeGenerator&>(generator).invalidateLoadedPrivateNames();
109+
generator.invalidateLoadedPrivateNames();
111110
m_location = location;
112111

113112
for (auto offset : m_unresolvedJumps) {
@@ -384,8 +383,14 @@ ParserError BytecodeGenerator::generate(unsigned& size)
384383
return ParserError(ParserError::ErrorNone);
385384
}
386385

386+
void BytecodeGenerator::allocateCalleeSaveSpace()
387+
{
388+
for (size_t i = 0; i < CodeBlock::llintBaselineCalleeSaveSpaceAsVirtualRegisters(); i++)
389+
addVar();
390+
}
391+
387392
BytecodeGenerator::BytecodeGenerator(VM& vm, ProgramNode* programNode, UnlinkedProgramCodeBlock* codeBlock, OptionSet<CodeGenerationMode> codeGenerationMode, const RefPtr<TDZEnvironmentLink>& parentScopeTDZVariables, const FixedVector<Identifier>*, const PrivateNameEnvironment*)
388-
: BytecodeGeneratorBase(makeUnique<UnlinkedCodeBlockGenerator>(vm, codeBlock), CodeBlock::llintBaselineCalleeSaveSpaceAsVirtualRegisters())
393+
: m_codeBlock(makeUnique<UnlinkedCodeBlockGenerator>(vm, codeBlock))
389394
, m_codeGenerationMode(codeGenerationMode)
390395
, m_scopeNode(programNode)
391396
, m_thisRegister(CallFrame::thisArgumentOffset())
@@ -400,6 +405,8 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, ProgramNode* programNode, UnlinkedP
400405
, m_needsToUpdateArrowFunctionContext(programNode->usesArrowFunction() || programNode->usesEval())
401406
, m_ecmaMode(ECMAMode::fromBool(programNode->isStrictMode()))
402407
{
408+
allocateCalleeSaveSpace();
409+
403410
ASSERT_UNUSED(parentScopeTDZVariables, !parentScopeTDZVariables);
404411

405412
m_codeBlock->setNumParameters(1); // Allocate space for "this"
@@ -431,7 +438,7 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, ProgramNode* programNode, UnlinkedP
431438
}
432439

433440
BytecodeGenerator::BytecodeGenerator(VM& vm, FunctionNode* functionNode, UnlinkedFunctionCodeBlock* codeBlock, OptionSet<CodeGenerationMode> codeGenerationMode, const RefPtr<TDZEnvironmentLink>& parentScopeTDZVariables, const FixedVector<Identifier>* generatorOrAsyncWrapperFunctionParameterNames, const PrivateNameEnvironment* parentPrivateNameEnvironment)
434-
: BytecodeGeneratorBase(makeUnique<UnlinkedCodeBlockGenerator>(vm, codeBlock), CodeBlock::llintBaselineCalleeSaveSpaceAsVirtualRegisters())
441+
: m_codeBlock(makeUnique<UnlinkedCodeBlockGenerator>(vm, codeBlock))
435442
, m_codeGenerationMode(codeGenerationMode)
436443
, m_scopeNode(functionNode)
437444
, m_codeType(FunctionCode)
@@ -460,6 +467,8 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, FunctionNode* functionNode, Unlinke
460467
, m_ecmaMode(ECMAMode::fromBool(functionNode->isStrictMode()))
461468
, m_derivedContextType(codeBlock->derivedContextType())
462469
{
470+
allocateCalleeSaveSpace();
471+
463472
ECMAMode ecmaMode = m_ecmaMode;
464473
pushPrivateAccessNames(parentPrivateNameEnvironment);
465474

@@ -1002,7 +1011,7 @@ IGNORE_GCC_WARNINGS_END
10021011
}
10031012

10041013
BytecodeGenerator::BytecodeGenerator(VM& vm, EvalNode* evalNode, UnlinkedEvalCodeBlock* codeBlock, OptionSet<CodeGenerationMode> codeGenerationMode, const RefPtr<TDZEnvironmentLink>& parentScopeTDZVariables, const FixedVector<Identifier>*, const PrivateNameEnvironment* parentPrivateNameEnvironment)
1005-
: BytecodeGeneratorBase(makeUnique<UnlinkedCodeBlockGenerator>(vm, codeBlock), CodeBlock::llintBaselineCalleeSaveSpaceAsVirtualRegisters())
1014+
: m_codeBlock(makeUnique<UnlinkedCodeBlockGenerator>(vm, codeBlock))
10061015
, m_codeGenerationMode(codeGenerationMode)
10071016
, m_scopeNode(evalNode)
10081017
, m_thisRegister(CallFrame::thisArgumentOffset())
@@ -1018,6 +1027,8 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, EvalNode* evalNode, UnlinkedEvalCod
10181027
, m_ecmaMode(ECMAMode::fromBool(evalNode->isStrictMode()))
10191028
, m_derivedContextType(codeBlock->derivedContextType())
10201029
{
1030+
allocateCalleeSaveSpace();
1031+
10211032
m_codeBlock->setNumParameters(1);
10221033

10231034
pushPrivateAccessNames(parentPrivateNameEnvironment);
@@ -1068,7 +1079,7 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, EvalNode* evalNode, UnlinkedEvalCod
10681079
}
10691080

10701081
BytecodeGenerator::BytecodeGenerator(VM& vm, ModuleProgramNode* moduleProgramNode, UnlinkedModuleProgramCodeBlock* codeBlock, OptionSet<CodeGenerationMode> codeGenerationMode, const RefPtr<TDZEnvironmentLink>& parentScopeTDZVariables, const FixedVector<Identifier>*, const PrivateNameEnvironment*)
1071-
: BytecodeGeneratorBase(makeUnique<UnlinkedCodeBlockGenerator>(vm, codeBlock), CodeBlock::llintBaselineCalleeSaveSpaceAsVirtualRegisters())
1082+
: m_codeBlock(makeUnique<UnlinkedCodeBlockGenerator>(vm, codeBlock))
10721083
, m_codeGenerationMode(codeGenerationMode)
10731084
, m_scopeNode(moduleProgramNode)
10741085
, m_thisRegister(CallFrame::thisArgumentOffset())
@@ -1084,6 +1095,8 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, ModuleProgramNode* moduleProgramNod
10841095
, m_needsToUpdateArrowFunctionContext(moduleProgramNode->usesArrowFunction() || moduleProgramNode->usesEval())
10851096
, m_ecmaMode(ECMAMode::strict())
10861097
{
1098+
allocateCalleeSaveSpace();
1099+
10871100
ASSERT_UNUSED(parentScopeTDZVariables, !parentScopeTDZVariables);
10881101
codeBlock->setVariableDeclarations(moduleProgramNode->varDeclarations());
10891102

@@ -1485,7 +1498,7 @@ void BytecodeGenerator::emitLoopHint()
14851498

14861499
void BytecodeGenerator::emitJump(Label& target)
14871500
{
1488-
OpJmp::emit(this, target.bind(this));
1501+
OpJmp::emit(this, target.bind(m_writer));
14891502
}
14901503

14911504
void BytecodeGenerator::emitCheckTraps()
@@ -1511,7 +1524,7 @@ bool BytecodeGenerator::fuseCompareAndJump(RegisterID* cond, Label& target, bool
15111524
if (swapOperands)
15121525
std::swap(binop.m_lhs, binop.m_rhs);
15131526

1514-
JmpOp::emit(this, binop.m_lhs, binop.m_rhs, target.bind(this));
1527+
JmpOp::emit(this, binop.m_lhs, binop.m_rhs, target.bind(m_writer));
15151528
return true;
15161529
}
15171530
return false;
@@ -1525,7 +1538,7 @@ bool BytecodeGenerator::fuseTestAndJmp(RegisterID* cond, Label& target)
15251538
if (cond->index() == unop.m_dst.offset() && cond->isTemporary() && !cond->refCount()) {
15261539
rewind();
15271540

1528-
JmpOp::emit(this, unop.m_operand, target.bind(this));
1541+
JmpOp::emit(this, unop.m_operand, target.bind(m_writer));
15291542
return true;
15301543
}
15311544
return false;
@@ -1576,7 +1589,7 @@ void BytecodeGenerator::emitJumpIfTrue(RegisterID* cond, Label& target)
15761589
}
15771590
}
15781591

1579-
OpJtrue::emit(this, cond, target.bind(this));
1592+
OpJtrue::emit(this, cond, target.bind(m_writer));
15801593
}
15811594

15821595
void BytecodeGenerator::emitJumpIfFalse(RegisterID* cond, Label& target)
@@ -1627,42 +1640,42 @@ void BytecodeGenerator::emitJumpIfFalse(RegisterID* cond, Label& target)
16271640
}
16281641
}
16291642

1630-
OpJfalse::emit(this, cond, target.bind(this));
1643+
OpJfalse::emit(this, cond, target.bind(m_writer));
16311644
}
16321645

16331646
void BytecodeGenerator::emitJumpIfNotFunctionCall(RegisterID* cond, Label& target)
16341647
{
1635-
OpJneqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::callFunction), target.bind(this));
1648+
OpJneqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::callFunction), target.bind(m_writer));
16361649
}
16371650

16381651
void BytecodeGenerator::emitJumpIfNotFunctionApply(RegisterID* cond, Label& target)
16391652
{
1640-
OpJneqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::applyFunction), target.bind(this));
1653+
OpJneqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::applyFunction), target.bind(m_writer));
16411654
}
16421655

16431656
void BytecodeGenerator::emitJumpIfNotReflectConstruct(RegisterID* cond, Label& target)
16441657
{
1645-
OpJneqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::reflectConstructFunction), target.bind(this));
1658+
OpJneqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::reflectConstructFunction), target.bind(m_writer));
16461659
}
16471660

16481661
void BytecodeGenerator::emitJumpIfNotEvalFunction(RegisterID* cond, Label& target)
16491662
{
1650-
OpJneqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::evalFunction), target.bind(this));
1663+
OpJneqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::evalFunction), target.bind(m_writer));
16511664
}
16521665

16531666
void BytecodeGenerator::emitJumpIfEmptyPropertyNameEnumerator(RegisterID* cond, Label& target)
16541667
{
1655-
OpJeqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::emptyPropertyNameEnumerator), target.bind(this));
1668+
OpJeqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::emptyPropertyNameEnumerator), target.bind(m_writer));
16561669
}
16571670

16581671
void BytecodeGenerator::emitJumpIfSentinelString(RegisterID* cond, Label& target)
16591672
{
1660-
OpJeqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::sentinelString), target.bind(this));
1673+
OpJeqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::sentinelString), target.bind(m_writer));
16611674
}
16621675

16631676
unsigned BytecodeGenerator::emitWideJumpIfNotFunctionHasOwnProperty(RegisterID* cond, Label& target)
16641677
{
1665-
OpJneqPtr::emit<OpcodeSize::Wide32>(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::hasOwnPropertyFunction), target.bind(this));
1678+
OpJneqPtr::emit<OpcodeSize::Wide32>(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::hasOwnPropertyFunction), target.bind(m_writer));
16661679
return m_lastInstruction.offset();
16671680
}
16681681

@@ -3789,7 +3802,7 @@ ExpectedFunction BytecodeGenerator::emitExpectedFunctionSnippet(RegisterID* dst,
37893802
if (callArguments.argumentCountIncludingThis() >= 2)
37903803
return NoExpectedFunction;
37913804

3792-
OpJneqPtr::emit(this, func, moveLinkTimeConstant(nullptr, LinkTimeConstant::Object), realCall->bind(this));
3805+
OpJneqPtr::emit(this, func, moveLinkTimeConstant(nullptr, LinkTimeConstant::Object), realCall->bind(m_writer));
37933806

37943807
if (dst != ignoredResult())
37953808
emitNewObject(dst);
@@ -3805,7 +3818,7 @@ ExpectedFunction BytecodeGenerator::emitExpectedFunctionSnippet(RegisterID* dst,
38053818
if (callArguments.argumentCountIncludingThis() > 2)
38063819
return NoExpectedFunction;
38073820

3808-
OpJneqPtr::emit(this, func, moveLinkTimeConstant(nullptr, LinkTimeConstant::Array), realCall->bind(this));
3821+
OpJneqPtr::emit(this, func, moveLinkTimeConstant(nullptr, LinkTimeConstant::Array), realCall->bind(m_writer));
38093822

38103823
if (dst != ignoredResult()) {
38113824
if (callArguments.argumentCountIncludingThis() == 2)
@@ -3823,7 +3836,7 @@ ExpectedFunction BytecodeGenerator::emitExpectedFunctionSnippet(RegisterID* dst,
38233836
return NoExpectedFunction;
38243837
}
38253838

3826-
OpJmp::emit(this, done.bind(this));
3839+
OpJmp::emit(this, done.bind(m_writer));
38273840
emitLabel(realCall.get());
38283841

38293842
return expectedFunction;
@@ -5344,15 +5357,15 @@ RegisterID* BytecodeGenerator::emitRestParameter(RegisterID* result, unsigned nu
53445357
void BytecodeGenerator::emitRequireObjectCoercible(RegisterID* value, ASCIILiteral error)
53455358
{
53465359
Ref<Label> target = newLabel();
5347-
OpJnundefinedOrNull::emit(this, value, target->bind(this));
5360+
OpJnundefinedOrNull::emit(this, value, target->bind(m_writer));
53485361
emitThrowTypeError(error);
53495362
emitLabel(target.get());
53505363
}
53515364

53525365
void BytecodeGenerator::emitRequireObjectCoercibleForDestructuring(RegisterID* value, const Identifier* propertyName)
53535366
{
53545367
Ref<Label> target = newLabel();
5355-
OpJnundefinedOrNull::emit(this, value, target->bind(this));
5368+
OpJnundefinedOrNull::emit(this, value, target->bind(m_writer));
53565369

53575370
if (propertyName && !propertyName->isNull()) {
53585371
auto errorMessageStr = tryMakeString("Cannot destructure property '"_s, propertyName->string(), "' from null or undefined value"_s);
@@ -5552,7 +5565,7 @@ void BytecodeGenerator::emitIteratorGenericClose(RegisterID* iterator, const Thr
55525565
void BytecodeGenerator::emitIteratorClose(RegisterID* iterator, RegisterID* nextOrIndex, RegisterID* iterable, const ThrowableExpressionData* node)
55535566
{
55545567
Ref<Label> done = newLabel();
5555-
OpIteratorCloseCheck::emit(this, iterator, nextOrIndex, iterable, done->bind(this));
5568+
OpIteratorCloseCheck::emit(this, iterator, nextOrIndex, iterable, done->bind(m_writer));
55565569
emitIteratorGenericClose(iterator, node);
55575570
emitLabel(done.get());
55585571
}

0 commit comments

Comments
 (0)