Commit 942dc585 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: [objects] Free one bit in the SharedFunctionInfo::flags.

Port 591408cb

Original Commit Message:

    We'll need one bit in the SharedFunctionInfo::flags to record whether
    it's safe to skip arguments adaptor frames (for v8:8895), so this
    just removes the SharedFunctionInfo::IsDerivedConstructorBit which is
    redundant, since the same information is already available in the
    SharedFunctionInfo::FunctionKindBits, and most places in the code
    use that already, with the exception of the JSConstructStubGeneric
    builtin.

    This changes the JSConstructStubGeneric builtin to just check the
    function kind instead of testing the explicit bit, which also makes
    this more consistent. It seems like there's not much overhead to
    that, doing an additional bitmasking plus two comparisons instead
    of one. This shouldn't really matter since invocation and execution
    of the constructors is going to dominate and optimized code inlines
    all of this anyways. If this turns out to affect performance, we
    can still look into encoding the FunctionKindBits more cleverly.

    the shift when accessing the function kind. This seems logic, since
    for the actual boolean bit fields it doesn't matter where they are
    in the flags, whereas for the function kind this saves one shift.

R=bmeurer@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com, miladfar@ca.ibm.com
BUG=
LOG=N

Change-Id: I4e3ba5a066285bf50e869c32228d79d26d57258f
Reviewed-on: https://chromium-review.googlesource.com/c/1486411Reviewed-by: 's avatarMilad Farazmand <miladfar@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#59837}
parent b152bb75
......@@ -215,8 +215,9 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
__ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
__ lwz(r7, FieldMemOperand(r7, SharedFunctionInfo::kFlagsOffset));
__ TestBitMask(r7, SharedFunctionInfo::IsDerivedConstructorBit::kMask, r0);
__ bne(&not_create_implicit_receiver, cr0);
__ DecodeField<SharedFunctionInfo::FunctionKindBits>(r7);
__ JumpIfIsInRange(r7, kDefaultDerivedConstructor, kDerivedConstructor,
&not_create_implicit_receiver);
// If not derived class constructor: Allocate the new receiver object.
__ IncrementCounter(masm->isolate()->counters()->constructed_objects(), 1,
......
......@@ -209,8 +209,9 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
__ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset));
__ LoadlW(r6, FieldMemOperand(r6, SharedFunctionInfo::kFlagsOffset));
__ TestBitMask(r6, SharedFunctionInfo::IsDerivedConstructorBit::kMask, r0);
__ bne(&not_create_implicit_receiver);
__ DecodeField<SharedFunctionInfo::FunctionKindBits>(r6);
__ JumpIfIsInRange(r6, kDefaultDerivedConstructor, kDerivedConstructor,
&not_create_implicit_receiver);
// If not derived class constructor: Allocate the new receiver object.
__ IncrementCounter(masm->isolate()->counters()->constructed_objects(), 1,
......
......@@ -1552,6 +1552,20 @@ void TurboAssembler::SubAndCheckForOverflow(Register dst, Register left,
}
}
void MacroAssembler::JumpIfIsInRange(Register value, unsigned lower_limit,
unsigned higher_limit,
Label* on_in_range) {
Register scratch = r0;
if (lower_limit != 0) {
mov(scratch, Operand(lower_limit));
sub(scratch, value, scratch);
cmpli(scratch, Operand(higher_limit - lower_limit));
} else {
mov(scratch, Operand(higher_limit));
cmpl(value, scratch);
}
ble(on_in_range);
}
void MacroAssembler::TryDoubleToInt32Exact(Register result,
DoubleRegister double_input,
......
......@@ -812,6 +812,11 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
bne(if_not_equal);
}
// Checks if value is in range [lower_limit, higher_limit] using a single
// comparison.
void JumpIfIsInRange(Register value, unsigned lower_limit,
unsigned higher_limit, Label* on_in_range);
// Try to convert a double to a signed 32-bit integer.
// CR_EQ in cr7 is set and result assigned if the conversion is exact.
void TryDoubleToInt32Exact(Register result, DoubleRegister double_input,
......
......@@ -1518,6 +1518,20 @@ void MacroAssembler::CompareRoot(Register obj, RootIndex index) {
CmpP(obj, MemOperand(kRootRegister, RootRegisterOffsetForRootIndex(index)));
}
void MacroAssembler::JumpIfIsInRange(Register value, unsigned lower_limit,
unsigned higher_limit,
Label* on_in_range) {
if (lower_limit != 0) {
Register scratch = r0;
LoadRR(scratch, value);
slgfi(scratch, Operand(lower_limit));
CmpLogicalP(scratch, Operand(higher_limit - lower_limit));
} else {
CmpLogicalP(value, Operand(higher_limit));
}
ble(on_in_range);
}
void MacroAssembler::TryDoubleToInt32Exact(Register result,
DoubleRegister double_input,
Register scratch,
......
......@@ -1074,6 +1074,11 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
bne(if_not_equal);
}
// Checks if value is in range [lower_limit, higher_limit] using a single
// comparison.
void JumpIfIsInRange(Register value, unsigned lower_limit,
unsigned higher_limit, Label* on_in_range);
// Try to convert a double to a signed 32-bit integer.
// CR_EQ in cr7 is set and result assigned if the conversion is exact.
void TryDoubleToInt32Exact(Register result, DoubleRegister double_input,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment