Skip to content

Commit

Permalink
Merge r235527 - Switch int8_t to GPRReg in StructureStubInfo because …
Browse files Browse the repository at this point in the history
…sizeof(GPRReg) == sizeof(int8_t)

https://bugs.webkit.org/show_bug.cgi?id=189166

Reviewed by Mark Lam.

* bytecode/AccessCase.cpp:
(JSC::AccessCase::generateImpl):
* bytecode/GetterSetterAccessCase.cpp:
(JSC::GetterSetterAccessCase::emitDOMJITGetter):
* bytecode/InlineAccess.cpp:
(JSC::getScratchRegister):
* bytecode/PolymorphicAccess.cpp:
(JSC::PolymorphicAccess::regenerate):
* bytecode/StructureStubInfo.h:
(JSC::StructureStubInfo::valueRegs const):
* jit/JITInlineCacheGenerator.cpp:
(JSC::JITByIdGenerator::JITByIdGenerator):
(JSC::JITGetByIdWithThisGenerator::JITGetByIdWithThisGenerator):
(JSC::JITInstanceOfGenerator::JITInstanceOfGenerator):
  • Loading branch information
Saam Barati authored and carlosgcampos committed Sep 18, 2018
1 parent 409c6b2 commit 509a77c
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 30 deletions.
22 changes: 22 additions & 0 deletions Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,25 @@
2018-08-30 Saam barati <sbarati@apple.com>

Switch int8_t to GPRReg in StructureStubInfo because sizeof(GPRReg) == sizeof(int8_t)
https://bugs.webkit.org/show_bug.cgi?id=189166

Reviewed by Mark Lam.

* bytecode/AccessCase.cpp:
(JSC::AccessCase::generateImpl):
* bytecode/GetterSetterAccessCase.cpp:
(JSC::GetterSetterAccessCase::emitDOMJITGetter):
* bytecode/InlineAccess.cpp:
(JSC::getScratchRegister):
* bytecode/PolymorphicAccess.cpp:
(JSC::PolymorphicAccess::regenerate):
* bytecode/StructureStubInfo.h:
(JSC::StructureStubInfo::valueRegs const):
* jit/JITInlineCacheGenerator.cpp:
(JSC::JITByIdGenerator::JITByIdGenerator):
(JSC::JITGetByIdWithThisGenerator::JITGetByIdWithThisGenerator):
(JSC::JITInstanceOfGenerator::JITInstanceOfGenerator):

2018-08-30 Saam barati <sbarati@apple.com>

InlineAccess should do StringLength
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/bytecode/AccessCase.cpp
Expand Up @@ -1066,7 +1066,7 @@ void AccessCase::generateImpl(AccessGenerationState& state)
ScratchRegisterAllocator allocator(stubInfo.patch.usedRegisters);
allocator.lock(baseGPR);
#if USE(JSVALUE32_64)
allocator.lock(static_cast<GPRReg>(stubInfo.patch.baseTagGPR));
allocator.lock(stubInfo.patch.baseTagGPR);
#endif
allocator.lock(valueRegs);
allocator.lock(scratchGPR);
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/bytecode/GetterSetterAccessCase.cpp
Expand Up @@ -141,7 +141,7 @@ void GetterSetterAccessCase::emitDOMJITGetter(AccessGenerationState& state, cons
ScratchRegisterAllocator allocator(stubInfo.patch.usedRegisters);
allocator.lock(baseGPR);
#if USE(JSVALUE32_64)
allocator.lock(static_cast<GPRReg>(stubInfo.patch.baseTagGPR));
allocator.lock(stubInfo.patch.baseTagGPR);
#endif
allocator.lock(valueRegs);
allocator.lock(scratchGPR);
Expand Down
6 changes: 3 additions & 3 deletions Source/JavaScriptCore/bytecode/InlineAccess.cpp
Expand Up @@ -198,10 +198,10 @@ ALWAYS_INLINE static GPRReg getScratchRegister(StructureStubInfo& stubInfo)
{
ScratchRegisterAllocator allocator(stubInfo.patch.usedRegisters);
allocator.lock(stubInfo.baseGPR());
allocator.lock(static_cast<GPRReg>(stubInfo.patch.valueGPR));
allocator.lock(stubInfo.patch.valueGPR);
#if USE(JSVALUE32_64)
allocator.lock(static_cast<GPRReg>(stubInfo.patch.baseTagGPR));
allocator.lock(static_cast<GPRReg>(stubInfo.patch.valueTagGPR));
allocator.lock(stubInfo.patch.baseTagGPR);
allocator.lock(stubInfo.patch.valueTagGPR);
#endif
GPRReg scratch = allocator.allocateScratchGPR();
if (allocator.didReuseRegisters())
Expand Down
4 changes: 2 additions & 2 deletions Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp
Expand Up @@ -382,7 +382,7 @@ AccessGenerationResult PolymorphicAccess::regenerate(
state.ident = &ident;

state.baseGPR = stubInfo.baseGPR();
state.thisGPR = static_cast<GPRReg>(stubInfo.patch.thisGPR);
state.thisGPR = stubInfo.patch.thisGPR;
state.valueRegs = stubInfo.valueRegs();

ScratchRegisterAllocator allocator(stubInfo.patch.usedRegisters);
Expand All @@ -392,7 +392,7 @@ AccessGenerationResult PolymorphicAccess::regenerate(
allocator.lock(state.thisGPR);
allocator.lock(state.valueRegs);
#if USE(JSVALUE32_64)
allocator.lock(static_cast<GPRReg>(stubInfo.patch.baseTagGPR));
allocator.lock(stubInfo.patch.baseTagGPR);
#endif

state.scratchGPR = allocator.allocateScratchGPR();
Expand Down
18 changes: 9 additions & 9 deletions Source/JavaScriptCore/bytecode/StructureStubInfo.h
Expand Up @@ -191,19 +191,19 @@ class StructureStubInfo {
int32_t deltaFromStartToSlowPathCallLocation;
int32_t deltaFromStartToSlowPathStart;

int8_t baseGPR;
int8_t valueGPR;
int8_t thisGPR;
GPRReg baseGPR;
GPRReg valueGPR;
GPRReg thisGPR;
#if USE(JSVALUE32_64)
int8_t valueTagGPR;
int8_t baseTagGPR;
int8_t thisTagGPR;
GPRReg valueTagGPR;
GPRReg baseTagGPR;
GPRReg thisTagGPR;
#endif
} patch;

GPRReg baseGPR() const
{
return static_cast<GPRReg>(patch.baseGPR);
return patch.baseGPR;
}

CodeLocationCall<JSInternalPtrTag> slowPathCallLocation() { return patch.start.callAtOffset<JSInternalPtrTag>(patch.deltaFromStartToSlowPathCallLocation); }
Expand All @@ -219,9 +219,9 @@ class StructureStubInfo {
{
return JSValueRegs(
#if USE(JSVALUE32_64)
static_cast<GPRReg>(patch.valueTagGPR),
patch.valueTagGPR,
#endif
static_cast<GPRReg>(patch.valueGPR));
patch.valueGPR);
}


Expand Down
28 changes: 14 additions & 14 deletions Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp
Expand Up @@ -76,13 +76,13 @@ JITByIdGenerator::JITByIdGenerator(
, m_base(base)
, m_value(value)
{
m_stubInfo->patch.baseGPR = static_cast<int8_t>(base.payloadGPR());
m_stubInfo->patch.valueGPR = static_cast<int8_t>(value.payloadGPR());
m_stubInfo->patch.thisGPR = static_cast<int8_t>(InvalidGPRReg);
m_stubInfo->patch.baseGPR = base.payloadGPR();
m_stubInfo->patch.valueGPR = value.payloadGPR();
m_stubInfo->patch.thisGPR = InvalidGPRReg;
#if USE(JSVALUE32_64)
m_stubInfo->patch.baseTagGPR = static_cast<int8_t>(base.tagGPR());
m_stubInfo->patch.valueTagGPR = static_cast<int8_t>(value.tagGPR());
m_stubInfo->patch.thisTagGPR = static_cast<int8_t>(InvalidGPRReg);
m_stubInfo->patch.baseTagGPR = base.tagGPR();
m_stubInfo->patch.valueTagGPR = value.tagGPR();
m_stubInfo->patch.thisTagGPR = InvalidGPRReg;
#endif
}

Expand Down Expand Up @@ -126,9 +126,9 @@ JITGetByIdWithThisGenerator::JITGetByIdWithThisGenerator(
{
RELEASE_ASSERT(thisRegs.payloadGPR() != thisRegs.tagGPR());

m_stubInfo->patch.thisGPR = static_cast<int8_t>(thisRegs.payloadGPR());
m_stubInfo->patch.thisGPR = thisRegs.payloadGPR();
#if USE(JSVALUE32_64)
m_stubInfo->patch.thisTagGPR = static_cast<int8_t>(thisRegs.tagGPR());
m_stubInfo->patch.thisTagGPR = thisRegs.tagGPR();
#endif
}

Expand Down Expand Up @@ -188,13 +188,13 @@ JITInstanceOfGenerator::JITInstanceOfGenerator(
: JITInlineCacheGenerator(
codeBlock, codeOrigin, callSiteIndex, AccessType::InstanceOf, usedRegisters)
{
m_stubInfo->patch.baseGPR = static_cast<int8_t>(value);
m_stubInfo->patch.valueGPR = static_cast<int8_t>(result);
m_stubInfo->patch.thisGPR = static_cast<int8_t>(prototype);
m_stubInfo->patch.baseGPR = value;
m_stubInfo->patch.valueGPR = result;
m_stubInfo->patch.thisGPR = prototype;
#if USE(JSVALUE32_64)
m_stubInfo->patch.baseTagGPR = static_cast<int8_t>(InvalidGPRReg);
m_stubInfo->patch.valueTagGPR = static_cast<int8_t>(InvalidGPRReg);
m_stubInfo->patch.thisTagGPR = static_cast<int8_t>(InvalidGPRReg);
m_stubInfo->patch.baseTagGPR = InvalidGPRReg;
m_stubInfo->patch.valueTagGPR = InvalidGPRReg;
m_stubInfo->patch.thisTagGPR = InvalidGPRReg;
#endif

m_stubInfo->patch.usedRegisters.clear(result);
Expand Down

0 comments on commit 509a77c

Please sign in to comment.