Bug 1669918 - Pass initializer_list directly to the transpiler. r=iain

This way we don't have to copy it to a temporary Vector.

Differential Revision: https://phabricator.services.mozilla.com/D92881
This commit is contained in:
Jan de Mooij 2020-10-08 15:51:38 +00:00
Родитель 0ada0a0e77
Коммит fcb2fda8bb
3 изменённых файлов: 16 добавлений и 27 удалений

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

@ -1774,12 +1774,7 @@ bool WarpBuilder::transpileCall(BytecodeLocation loc,
auto* argc = MConstant::New(alloc(), Int32Value(callInfo->argc()));
current->add(argc);
MDefinitionStackVector inputs;
if (!inputs.append(argc)) {
return false;
}
return TranspileCacheIRToMIR(this, loc, cacheIRSnapshot, inputs, callInfo);
return TranspileCacheIRToMIR(this, loc, cacheIRSnapshot, {argc}, callInfo);
}
bool WarpBuilder::buildCallOp(BytecodeLocation loc) {
@ -2932,11 +2927,7 @@ bool WarpBuilder::buildIC(BytecodeLocation loc, CacheKind kind,
MOZ_ASSERT(numInputs == NumInputsForCacheKind(kind));
if (auto* cacheIRSnapshot = getOpSnapshot<WarpCacheIR>(loc)) {
MDefinitionStackVector inputs_;
if (!inputs_.append(inputs.begin(), inputs.end())) {
return false;
}
return TranspileCacheIRToMIR(this, loc, cacheIRSnapshot, inputs_);
return TranspileCacheIRToMIR(this, loc, cacheIRSnapshot, inputs);
}
if (getOpSnapshot<WarpBailout>(loc)) {
@ -2953,12 +2944,8 @@ bool WarpBuilder::buildIC(BytecodeLocation loc, CacheKind kind,
CallInfo callInfo(alloc(), pc, /*constructing =*/false, ignoresRval);
callInfo.markAsInlined();
MDefinitionStackVector inputs_;
if (!inputs_.append(inputs.begin(), inputs.end())) {
return false;
}
if (!TranspileCacheIRToMIR(this, loc, inliningSnapshot->cacheIRSnapshot(),
inputs_, &callInfo)) {
inputs, &callInfo)) {
return false;
}
return buildInlinedCall(loc, inliningSnapshot, callInfo);

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

@ -38,6 +38,7 @@ class MOZ_RAII WarpCacheIRTranspiler : public WarpBuilderShared {
const uint8_t* stubData_;
// Vector mapping OperandId to corresponding MDefinition.
using MDefinitionStackVector = Vector<MDefinition*, 8, SystemAllocPolicy>;
MDefinitionStackVector operands_;
CallInfo* callInfo_;
@ -217,11 +218,12 @@ class MOZ_RAII WarpCacheIRTranspiler : public WarpBuilderShared {
stubData_(cacheIRSnapshot->stubData()),
callInfo_(callInfo) {}
MOZ_MUST_USE bool transpile(const MDefinitionStackVector& inputs);
MOZ_MUST_USE bool transpile(std::initializer_list<MDefinition*> inputs);
};
bool WarpCacheIRTranspiler::transpile(const MDefinitionStackVector& inputs) {
if (!operands_.appendAll(inputs)) {
bool WarpCacheIRTranspiler::transpile(
std::initializer_list<MDefinition*> inputs) {
if (!operands_.append(inputs.begin(), inputs.end())) {
return false;
}
@ -4000,7 +4002,7 @@ static void MaybeSetImplicitlyUsed(uint32_t numInstructionIdsBefore,
bool jit::TranspileCacheIRToMIR(WarpBuilder* builder, BytecodeLocation loc,
const WarpCacheIR* cacheIRSnapshot,
const MDefinitionStackVector& inputs,
std::initializer_list<MDefinition*> inputs,
CallInfo* maybeCallInfo) {
uint32_t numInstructionIdsBefore =
builder->mirGen().graph().getNumInstructionIds();

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

@ -7,6 +7,8 @@
#ifndef jit_WarpCacheIRTranspiler_h
#define jit_WarpCacheIRTranspiler_h
#include <initializer_list>
#include "js/AllocPolicy.h"
#include "js/Vector.h"
@ -22,14 +24,12 @@ class MInstruction;
class WarpBuilder;
class WarpCacheIR;
using MDefinitionStackVector = Vector<MDefinition*, 8, SystemAllocPolicy>;
// Generate MIR from a Baseline ICStub's CacheIR.
MOZ_MUST_USE bool TranspileCacheIRToMIR(WarpBuilder* builder,
BytecodeLocation loc,
const WarpCacheIR* cacheIRSnapshot,
const MDefinitionStackVector& inputs,
CallInfo* maybeCallInfo = nullptr);
MOZ_MUST_USE bool TranspileCacheIRToMIR(
WarpBuilder* builder, BytecodeLocation loc,
const WarpCacheIR* cacheIRSnapshot,
std::initializer_list<MDefinition*> inputs,
CallInfo* maybeCallInfo = nullptr);
} // namespace jit
} // namespace js