зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1370208 - Inline Boolean constructor when called as a function. r=nbp
--HG-- extra : rebase_source : dcfc345881550a8e4179da27baade79dccff5e0b
This commit is contained in:
Родитель
65a48a95db
Коммит
46fea327c8
|
@ -27,6 +27,8 @@
|
|||
_(AtomicsXor) \
|
||||
_(AtomicsIsLockFree) \
|
||||
\
|
||||
_(Boolean) \
|
||||
\
|
||||
_(IntlIsCollator) \
|
||||
_(IntlIsDateTimeFormat) \
|
||||
_(IntlIsNumberFormat) \
|
||||
|
|
|
@ -633,6 +633,9 @@ class IonBuilder
|
|||
InliningResult inlineArraySlice(CallInfo& callInfo);
|
||||
InliningResult inlineArrayJoin(CallInfo& callInfo);
|
||||
|
||||
// Boolean natives.
|
||||
InliningResult inlineBoolean(CallInfo& callInfo);
|
||||
|
||||
// Iterator intrinsics.
|
||||
InliningResult inlineNewIterator(CallInfo& callInfo, MNewIterator::Type type);
|
||||
|
||||
|
|
|
@ -110,6 +110,10 @@ IonBuilder::inlineNativeCall(CallInfo& callInfo, JSFunction* target)
|
|||
case InlinableNative::AtomicsIsLockFree:
|
||||
return inlineAtomicsIsLockFree(callInfo);
|
||||
|
||||
// Boolean natives.
|
||||
case InlinableNative::Boolean:
|
||||
return inlineBoolean(callInfo);
|
||||
|
||||
// Intl natives.
|
||||
case InlinableNative::IntlIsCollator:
|
||||
return inlineHasClass(callInfo, &CollatorObject::class_);
|
||||
|
@ -898,6 +902,28 @@ IonBuilder::inlineArraySlice(CallInfo& callInfo)
|
|||
return InliningStatus_Inlined;
|
||||
}
|
||||
|
||||
IonBuilder::InliningResult
|
||||
IonBuilder::inlineBoolean(CallInfo& callInfo)
|
||||
{
|
||||
if (callInfo.constructing()) {
|
||||
trackOptimizationOutcome(TrackedOutcome::CantInlineNativeBadForm);
|
||||
return InliningStatus_NotInlined;
|
||||
}
|
||||
|
||||
if (getInlineReturnType() != MIRType::Boolean)
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
callInfo.setImplicitlyUsedUnchecked();
|
||||
|
||||
if (callInfo.argc() > 0) {
|
||||
MDefinition* result = convertToBoolean(callInfo.getArg(0));
|
||||
current->push(result);
|
||||
} else {
|
||||
pushConstant(BooleanValue(false));
|
||||
}
|
||||
return InliningStatus_Inlined;
|
||||
}
|
||||
|
||||
IonBuilder::InliningResult
|
||||
IonBuilder::inlineNewIterator(CallInfo& callInfo, MNewIterator::Type type)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "jsobj.h"
|
||||
#include "jstypes.h"
|
||||
|
||||
#include "jit/InlinableNatives.h"
|
||||
#include "vm/GlobalObject.h"
|
||||
#include "vm/ProxyObject.h"
|
||||
#include "vm/StringBuffer.h"
|
||||
|
@ -144,7 +145,9 @@ js::InitBooleanClass(JSContext* cx, HandleObject obj)
|
|||
return nullptr;
|
||||
booleanProto->setFixedSlot(BooleanObject::PRIMITIVE_VALUE_SLOT, BooleanValue(false));
|
||||
|
||||
RootedFunction ctor(cx, GlobalObject::createConstructor(cx, Boolean, cx->names().Boolean, 1));
|
||||
RootedFunction ctor(cx, GlobalObject::createConstructor(cx, Boolean, cx->names().Boolean, 1,
|
||||
gc::AllocKind::FUNCTION,
|
||||
&jit::JitInfo_Boolean));
|
||||
if (!ctor)
|
||||
return nullptr;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче