зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1635395: Remove unused JSOp::CheckIsCallable byte code. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D73831
This commit is contained in:
Родитель
aebe7bbaed
Коммит
d726e087a2
|
@ -1607,7 +1607,6 @@ static bool BytecodeIsEffectful(JSOp op) {
|
|||
case JSOp::ImplicitThis:
|
||||
case JSOp::NewTarget:
|
||||
case JSOp::CheckIsObj:
|
||||
case JSOp::CheckIsCallable:
|
||||
case JSOp::CheckObjCoercible:
|
||||
case JSOp::DebugCheckSelfHosted:
|
||||
case JSOp::IsConstructing:
|
||||
|
|
|
@ -511,10 +511,6 @@ bool BytecodeEmitter::emitCheckIsObj(CheckIsObjectKind kind) {
|
|||
return emit2(JSOp::CheckIsObj, uint8_t(kind));
|
||||
}
|
||||
|
||||
bool BytecodeEmitter::emitCheckIsCallable(CheckIsCallableKind kind) {
|
||||
return emit2(JSOp::CheckIsCallable, uint8_t(kind));
|
||||
}
|
||||
|
||||
/* Updates line number notes, not column notes. */
|
||||
bool BytecodeEmitter::updateLineNumberNotes(uint32_t offset) {
|
||||
if (skipLocationSrcNotes()) {
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "js/RootingAPI.h" // JS::Rooted, JS::Handle
|
||||
#include "js/TypeDecls.h" // jsbytecode
|
||||
#include "vm/BytecodeUtil.h" // JSOp
|
||||
#include "vm/CheckIsCallableKind.h" // CheckIsCallableKind
|
||||
#include "vm/CheckIsObjectKind.h" // CheckIsObjectKind
|
||||
#include "vm/FunctionPrefixKind.h" // FunctionPrefixKind
|
||||
#include "vm/GeneratorResumeKind.h" // GeneratorResumeKind
|
||||
|
@ -407,9 +406,6 @@ struct MOZ_STACK_CLASS BytecodeEmitter {
|
|||
// Helper to emit JSOp::CheckIsObj.
|
||||
MOZ_MUST_USE bool emitCheckIsObj(CheckIsObjectKind kind);
|
||||
|
||||
// Helper to emit JSOp::CheckIsCallable.
|
||||
MOZ_MUST_USE bool emitCheckIsCallable(CheckIsCallableKind kind);
|
||||
|
||||
// Push whether the value atop of the stack is non-undefined and non-null.
|
||||
MOZ_MUST_USE bool emitPushNotUndefinedOrNull();
|
||||
|
||||
|
|
|
@ -2227,24 +2227,6 @@ bool BaselineCodeGen<Handler>::emit_CheckIsObj() {
|
|||
return true;
|
||||
}
|
||||
|
||||
template <typename Handler>
|
||||
bool BaselineCodeGen<Handler>::emit_CheckIsCallable() {
|
||||
frame.syncStack(0);
|
||||
masm.loadValue(frame.addressOfStackValue(-1), R0);
|
||||
|
||||
prepareVMCall();
|
||||
|
||||
pushUint8BytecodeOperandArg(R1.scratchReg());
|
||||
pushArg(R0);
|
||||
|
||||
using Fn = bool (*)(JSContext*, HandleValue, CheckIsCallableKind);
|
||||
if (!callVM<Fn, CheckIsCallable>()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename Handler>
|
||||
bool BaselineCodeGen<Handler>::emit_CheckThis() {
|
||||
frame.syncStack(0);
|
||||
|
|
|
@ -12805,30 +12805,6 @@ void CodeGenerator::visitOutOfLineIsCallable(OutOfLineIsCallable* ool) {
|
|||
masm.jump(ool->rejoin());
|
||||
}
|
||||
|
||||
void CodeGenerator::visitCheckIsCallable(LCheckIsCallable* ins) {
|
||||
ValueOperand checkValue = ToValue(ins, LCheckIsCallable::CheckValue);
|
||||
Register temp = ToRegister(ins->temp());
|
||||
|
||||
// OOL code is used in the following 2 cases:
|
||||
// * checkValue is not callable
|
||||
// * checkValue is proxy and it's unknown whether it's callable or not
|
||||
// CheckIsCallable checks if passed value is callable, regardless of the
|
||||
// cases above. IsCallable operation is not observable and checking it
|
||||
// again doesn't matter.
|
||||
using Fn = bool (*)(JSContext*, HandleValue, CheckIsCallableKind);
|
||||
OutOfLineCode* ool = oolCallVM<Fn, CheckIsCallable>(
|
||||
ins, ArgList(checkValue, Imm32(ins->mir()->checkKind())), StoreNothing());
|
||||
|
||||
masm.branchTestObject(Assembler::NotEqual, checkValue, ool->entry());
|
||||
|
||||
Register object = masm.extractObject(checkValue, temp);
|
||||
emitIsCallableOrConstructor<Callable>(object, temp, ool->entry());
|
||||
|
||||
masm.branchTest32(Assembler::Zero, temp, temp, ool->entry());
|
||||
|
||||
masm.bind(ool->rejoin());
|
||||
}
|
||||
|
||||
class OutOfLineIsConstructor : public OutOfLineCodeBase<CodeGenerator> {
|
||||
LIsConstructor* ins_;
|
||||
|
||||
|
|
|
@ -2355,9 +2355,6 @@ AbortReasonOr<Ok> IonBuilder::inspectOpcode(JSOp op, bool* restarted) {
|
|||
case JSOp::CheckIsObj:
|
||||
return jsop_checkisobj(GET_UINT8(pc));
|
||||
|
||||
case JSOp::CheckIsCallable:
|
||||
return jsop_checkiscallable(GET_UINT8(pc));
|
||||
|
||||
case JSOp::CheckObjCoercible:
|
||||
return jsop_checkobjcoercible();
|
||||
|
||||
|
@ -9759,14 +9756,6 @@ AbortReasonOr<Ok> IonBuilder::jsop_checkisobj(uint8_t kind) {
|
|||
return Ok();
|
||||
}
|
||||
|
||||
AbortReasonOr<Ok> IonBuilder::jsop_checkiscallable(uint8_t kind) {
|
||||
MCheckIsCallable* check =
|
||||
MCheckIsCallable::New(alloc(), current->pop(), kind);
|
||||
current->add(check);
|
||||
current->push(check);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
AbortReasonOr<Ok> IonBuilder::jsop_checkobjcoercible() {
|
||||
MDefinition* toCheck = current->peek(-1);
|
||||
|
||||
|
|
|
@ -4681,17 +4681,6 @@ void LIRGenerator::visitCheckIsObj(MCheckIsObj* ins) {
|
|||
assignSafepoint(lir, ins);
|
||||
}
|
||||
|
||||
void LIRGenerator::visitCheckIsCallable(MCheckIsCallable* ins) {
|
||||
MDefinition* checkVal = ins->checkValue();
|
||||
MOZ_ASSERT(checkVal->type() == MIRType::Value);
|
||||
|
||||
LCheckIsCallable* lir =
|
||||
new (alloc()) LCheckIsCallable(useBox(checkVal), temp());
|
||||
redefine(ins, checkVal);
|
||||
add(lir, ins);
|
||||
assignSafepoint(lir, ins);
|
||||
}
|
||||
|
||||
void LIRGenerator::visitCheckObjCoercible(MCheckObjCoercible* ins) {
|
||||
MDefinition* checkVal = ins->checkValue();
|
||||
MOZ_ASSERT(checkVal->type() == MIRType::Value);
|
||||
|
|
|
@ -10832,27 +10832,6 @@ class MCheckIsObj : public MUnaryInstruction, public BoxInputsPolicy::Data {
|
|||
AliasSet getAliasSet() const override { return AliasSet::None(); }
|
||||
};
|
||||
|
||||
class MCheckIsCallable : public MUnaryInstruction,
|
||||
public BoxInputsPolicy::Data {
|
||||
uint8_t checkKind_;
|
||||
|
||||
MCheckIsCallable(MDefinition* toCheck, uint8_t checkKind)
|
||||
: MUnaryInstruction(classOpcode, toCheck), checkKind_(checkKind) {
|
||||
setResultType(MIRType::Value);
|
||||
setResultTypeSet(toCheck->resultTypeSet());
|
||||
setGuard();
|
||||
}
|
||||
|
||||
public:
|
||||
INSTRUCTION_HEADER(CheckIsCallable)
|
||||
TRIVIAL_NEW_WRAPPERS
|
||||
NAMED_OPERANDS((0, checkValue))
|
||||
|
||||
uint8_t checkKind() const { return checkKind_; }
|
||||
|
||||
AliasSet getAliasSet() const override { return AliasSet::None(); }
|
||||
};
|
||||
|
||||
class MCheckObjCoercible : public MUnaryInstruction,
|
||||
public BoxInputsPolicy::Data {
|
||||
explicit MCheckObjCoercible(MDefinition* toCheck)
|
||||
|
|
|
@ -80,7 +80,6 @@ namespace jit {
|
|||
_(CheckClassHeritageOperation, js::CheckClassHeritageOperation) \
|
||||
_(CheckGlobalOrEvalDeclarationConflicts, \
|
||||
js::CheckGlobalOrEvalDeclarationConflicts) \
|
||||
_(CheckIsCallable, js::jit::CheckIsCallable) \
|
||||
_(CheckOverRecursed, js::jit::CheckOverRecursed) \
|
||||
_(CheckOverRecursedBaseline, js::jit::CheckOverRecursedBaseline) \
|
||||
_(CloneRegExpObject, js::CloneRegExpObject) \
|
||||
|
|
|
@ -1531,14 +1531,6 @@ bool EqualStringsHelperPure(JSString* str1, JSString* str2) {
|
|||
return EqualChars(&str1->asLinear(), str2Linear);
|
||||
}
|
||||
|
||||
bool CheckIsCallable(JSContext* cx, HandleValue v, CheckIsCallableKind kind) {
|
||||
if (!IsCallable(v)) {
|
||||
return ThrowCheckIsCallable(cx, kind);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool MaybeTypedArrayIndexString(jsid id) {
|
||||
MOZ_ASSERT(JSID_IS_ATOM(id) || JSID_IS_SYMBOL(id));
|
||||
|
||||
|
|
|
@ -1084,9 +1084,6 @@ MOZ_MUST_USE bool CallNativeSetter(JSContext* cx, HandleFunction callee,
|
|||
|
||||
MOZ_MUST_USE bool EqualStringsHelperPure(JSString* str1, JSString* str2);
|
||||
|
||||
MOZ_MUST_USE bool CheckIsCallable(JSContext* cx, HandleValue v,
|
||||
CheckIsCallableKind kind);
|
||||
|
||||
void HandleCodeCoverageAtPC(BaselineFrame* frame, jsbytecode* pc);
|
||||
void HandleCodeCoverageAtPrologue(BaselineFrame* frame);
|
||||
|
||||
|
|
|
@ -2266,16 +2266,6 @@ bool WarpBuilder::build_CheckIsObj(BytecodeLocation loc) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool WarpBuilder::build_CheckIsCallable(BytecodeLocation loc) {
|
||||
CheckIsCallableKind kind = loc.getCheckIsCallableKind();
|
||||
MDefinition* val = current->pop();
|
||||
|
||||
MCheckIsCallable* ins = MCheckIsCallable::New(alloc(), val, uint8_t(kind));
|
||||
current->add(ins);
|
||||
current->push(ins);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WarpBuilder::build_CheckObjCoercible(BytecodeLocation) {
|
||||
MDefinition* val = current->pop();
|
||||
MCheckObjCoercible* ins = MCheckObjCoercible::New(alloc(), val);
|
||||
|
|
|
@ -561,7 +561,6 @@ AbortReasonOr<WarpScriptSnapshot*> WarpOracle::createScriptSnapshot(
|
|||
case JSOp::InitHiddenElemSetter:
|
||||
case JSOp::NewTarget:
|
||||
case JSOp::CheckIsObj:
|
||||
case JSOp::CheckIsCallable:
|
||||
case JSOp::CheckObjCoercible:
|
||||
case JSOp::FunWithProto:
|
||||
case JSOp::SpreadCall:
|
||||
|
|
|
@ -7096,23 +7096,6 @@ class LCheckIsObj : public LInstructionHelper<0, BOX_PIECES, 0> {
|
|||
MCheckIsObj* mir() const { return mir_->toCheckIsObj(); }
|
||||
};
|
||||
|
||||
class LCheckIsCallable : public LInstructionHelper<0, BOX_PIECES, 1> {
|
||||
public:
|
||||
LIR_HEADER(CheckIsCallable)
|
||||
|
||||
static const size_t CheckValue = 0;
|
||||
|
||||
LCheckIsCallable(const LBoxAllocation& value, const LDefinition& temp)
|
||||
: LInstructionHelper(classOpcode) {
|
||||
setBoxOperand(CheckValue, value);
|
||||
setTemp(0, temp);
|
||||
}
|
||||
|
||||
const LDefinition* temp() { return getTemp(0); }
|
||||
|
||||
MCheckIsCallable* mir() const { return mir_->toCheckIsCallable(); }
|
||||
};
|
||||
|
||||
class LCheckObjCoercible : public LInstructionHelper<0, BOX_PIECES, 0> {
|
||||
public:
|
||||
LIR_HEADER(CheckObjCoercible)
|
||||
|
|
|
@ -10,9 +10,8 @@
|
|||
#include "frontend/NameAnalysisTypes.h"
|
||||
#include "js/TypeDecls.h"
|
||||
#include "vm/BytecodeUtil.h"
|
||||
#include "vm/CheckIsCallableKind.h" // CheckIsCallableKind
|
||||
#include "vm/CheckIsObjectKind.h" // CheckIsObjectKind
|
||||
#include "vm/FunctionPrefixKind.h" // FunctionPrefixKind
|
||||
#include "vm/CheckIsObjectKind.h" // CheckIsObjectKind
|
||||
#include "vm/FunctionPrefixKind.h" // FunctionPrefixKind
|
||||
#include "vm/StringType.h"
|
||||
|
||||
namespace js {
|
||||
|
@ -281,10 +280,6 @@ class BytecodeLocation {
|
|||
MOZ_ASSERT(is(JSOp::CheckIsObj));
|
||||
return CheckIsObjectKind(GET_UINT8(rawBytecode_));
|
||||
}
|
||||
CheckIsCallableKind getCheckIsCallableKind() const {
|
||||
MOZ_ASSERT(is(JSOp::CheckIsCallable));
|
||||
return CheckIsCallableKind(GET_UINT8(rawBytecode_));
|
||||
}
|
||||
|
||||
uint32_t getNewArrayLength() const {
|
||||
MOZ_ASSERT(is(JSOp::NewArray));
|
||||
|
|
|
@ -669,7 +669,6 @@ uint32_t BytecodeParser::simulateOp(JSOp op, uint32_t offset,
|
|||
|
||||
case JSOp::And:
|
||||
case JSOp::CheckIsObj:
|
||||
case JSOp::CheckIsCallable:
|
||||
case JSOp::CheckObjCoercible:
|
||||
case JSOp::CheckThis:
|
||||
case JSOp::CheckThisReinit:
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: set ts=8 sts=2 et sw=2 tw=80:
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef vm_CheckIsCallableKind_h
|
||||
#define vm_CheckIsCallableKind_h
|
||||
|
||||
#include <stdint.h> // uint8_t
|
||||
|
||||
namespace js {
|
||||
|
||||
enum class CheckIsCallableKind : uint8_t { IteratorReturn };
|
||||
|
||||
} // namespace js
|
||||
|
||||
#endif /* vm_CheckIsCallableKind_h */
|
|
@ -2961,15 +2961,6 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
|
|||
}
|
||||
END_CASE(CheckIsObj)
|
||||
|
||||
CASE(CheckIsCallable) {
|
||||
if (!IsCallable(REGS.sp[-1])) {
|
||||
MOZ_ALWAYS_FALSE(
|
||||
ThrowCheckIsCallable(cx, CheckIsCallableKind(GET_UINT8(REGS.pc))));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
END_CASE(CheckIsCallable)
|
||||
|
||||
CASE(CheckThis) {
|
||||
if (REGS.sp[-1].isMagic(JS_UNINITIALIZED_LEXICAL)) {
|
||||
MOZ_ALWAYS_FALSE(ThrowUninitializedThis(cx));
|
||||
|
@ -5651,18 +5642,6 @@ bool js::ThrowCheckIsObject(JSContext* cx, CheckIsObjectKind kind) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool js::ThrowCheckIsCallable(JSContext* cx, CheckIsCallableKind kind) {
|
||||
switch (kind) {
|
||||
case CheckIsCallableKind::IteratorReturn:
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_RETURN_NOT_CALLABLE);
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("Unknown kind");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js::ThrowUninitializedThis(JSContext* cx) {
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_UNINITIALIZED_THIS);
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
|
||||
#include "jspubtd.h"
|
||||
|
||||
#include "vm/CheckIsCallableKind.h" // CheckIsCallableKind
|
||||
#include "vm/CheckIsObjectKind.h" // CheckIsObjectKind
|
||||
#include "vm/CheckIsObjectKind.h" // CheckIsObjectKind
|
||||
#include "vm/Iteration.h"
|
||||
#include "vm/Stack.h"
|
||||
|
||||
|
@ -677,8 +676,6 @@ void ReportRuntimeRedeclaration(JSContext* cx, HandlePropertyName name,
|
|||
|
||||
bool ThrowCheckIsObject(JSContext* cx, CheckIsObjectKind kind);
|
||||
|
||||
bool ThrowCheckIsCallable(JSContext* cx, CheckIsCallableKind kind);
|
||||
|
||||
bool ThrowUninitializedThis(JSContext* cx);
|
||||
|
||||
bool ThrowInitializedThis(JSContext* cx);
|
||||
|
|
|
@ -1381,17 +1381,6 @@
|
|||
* Stack: result => result
|
||||
*/ \
|
||||
MACRO(CheckIsObj, check_is_obj, NULL, 2, 1, 1, JOF_UINT8) \
|
||||
/*
|
||||
* Check that the top value on the stack is callable, and throw a TypeError
|
||||
* if not. The operand `kind` is used only to generate an appropriate error
|
||||
* message.
|
||||
*
|
||||
* Category: Objects
|
||||
* Type: Iteration
|
||||
* Operands: CheckIsCallableKind kind
|
||||
* Stack: obj => obj
|
||||
*/ \
|
||||
MACRO(CheckIsCallable, check_is_callable, NULL, 2, 1, 1, JOF_UINT8) \
|
||||
/*
|
||||
* Throw a TypeError if `val` is `null` or `undefined`.
|
||||
*
|
||||
|
@ -3671,6 +3660,7 @@
|
|||
* a power of two. Use this macro to do so.
|
||||
*/
|
||||
#define FOR_EACH_TRAILING_UNUSED_OPCODE(MACRO) \
|
||||
MACRO(237) \
|
||||
MACRO(238) \
|
||||
MACRO(239) \
|
||||
MACRO(240) \
|
||||
|
|
Загрузка…
Ссылка в новой задаче