1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
|
/*
* Copyright (C) 2013-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "JITInlineCacheGenerator.h"
#if ENABLE(JIT)
#include "CCallHelpers.h"
#include "CacheableIdentifierInlines.h"
#include "CodeBlock.h"
#include "InlineAccess.h"
#include "LinkBuffer.h"
#include "StructureStubInfo.h"
namespace JSC {
static StructureStubInfo* garbageStubInfo()
{
static StructureStubInfo* stubInfo = new StructureStubInfo(AccessType::GetById, CodeOrigin());
return stubInfo;
}
JITInlineCacheGenerator::JITInlineCacheGenerator(
CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSite, AccessType accessType,
const RegisterSet& usedRegisters)
: m_codeBlock(codeBlock)
, m_jitType(jitType)
{
m_stubInfo = m_codeBlock ? m_codeBlock->addStubInfo(accessType, codeOrigin) : garbageStubInfo();
m_stubInfo->callSiteIndex = callSite;
m_stubInfo->usedRegisters = usedRegisters;
}
void JITInlineCacheGenerator::finalize(
LinkBuffer& fastPath, LinkBuffer& slowPath, CodeLocationLabel<JITStubRoutinePtrTag> start)
{
m_stubInfo->start = start;
m_stubInfo->doneLocation = fastPath.locationOf<JSInternalPtrTag>(m_done);
if (!JITCode::useDataIC(m_jitType))
m_stubInfo->m_slowPathCallLocation = slowPath.locationOf<JSInternalPtrTag>(m_slowPathCall);
m_stubInfo->slowPathStartLocation = slowPath.locationOf<JITStubRoutinePtrTag>(m_slowPathBegin);
}
JITByIdGenerator::JITByIdGenerator(
CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSite, AccessType accessType,
const RegisterSet& usedRegisters, JSValueRegs base, JSValueRegs value, GPRReg stubInfoGPR)
: JITInlineCacheGenerator(codeBlock, jitType, codeOrigin, callSite, accessType, usedRegisters)
, m_base(base)
, m_value(value)
{
m_stubInfo->baseGPR = base.payloadGPR();
m_stubInfo->valueGPR = value.payloadGPR();
m_stubInfo->regs.thisGPR = InvalidGPRReg;
m_stubInfo->m_stubInfoGPR = stubInfoGPR;
#if USE(JSVALUE32_64)
m_stubInfo->baseTagGPR = base.tagGPR();
m_stubInfo->valueTagGPR = value.tagGPR();
m_stubInfo->v.thisTagGPR = InvalidGPRReg;
#endif
}
void JITByIdGenerator::finalize(LinkBuffer& fastPath, LinkBuffer& slowPath)
{
JITInlineCacheGenerator::finalize(fastPath, slowPath, fastPath.locationOf<JITStubRoutinePtrTag>(m_start));
if (JITCode::useDataIC(m_jitType))
m_stubInfo->m_codePtr = m_stubInfo->slowPathStartLocation;
}
void JITByIdGenerator::generateFastCommon(MacroAssembler& jit, size_t inlineICSize)
{
// We generate the same code regardless of whether SharedIC is enabled because we still need to use InlineAccess
// for the performance reason.
m_start = jit.label();
size_t startSize = jit.m_assembler.buffer().codeSize();
m_slowPathJump = jit.jump();
size_t jumpSize = jit.m_assembler.buffer().codeSize() - startSize;
size_t nopsToEmitInBytes = inlineICSize - jumpSize;
jit.emitNops(nopsToEmitInBytes);
ASSERT(jit.m_assembler.buffer().codeSize() - startSize == inlineICSize);
m_done = jit.label();
}
JITGetByIdGenerator::JITGetByIdGenerator(
CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSite, const RegisterSet& usedRegisters,
CacheableIdentifier propertyName, JSValueRegs base, JSValueRegs value, GPRReg stubInfoGPR, AccessType accessType)
: JITByIdGenerator(codeBlock, jitType, codeOrigin, callSite, accessType, usedRegisters, base, value, stubInfoGPR)
, m_isLengthAccess(propertyName.uid() == codeBlock->vm().propertyNames->length.impl())
{
RELEASE_ASSERT(base.payloadGPR() != value.tagGPR());
}
void JITGetByIdGenerator::generateFastPath(MacroAssembler& jit)
{
generateFastCommon(jit, m_isLengthAccess ? InlineAccess::sizeForLengthAccess() : InlineAccess::sizeForPropertyAccess());
}
JITGetByIdWithThisGenerator::JITGetByIdWithThisGenerator(
CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSite, const RegisterSet& usedRegisters,
CacheableIdentifier, JSValueRegs value, JSValueRegs base, JSValueRegs thisRegs, GPRReg stubInfoGPR)
: JITByIdGenerator(codeBlock, jitType, codeOrigin, callSite, AccessType::GetByIdWithThis, usedRegisters, base, value, stubInfoGPR)
{
RELEASE_ASSERT(thisRegs.payloadGPR() != thisRegs.tagGPR());
m_stubInfo->regs.thisGPR = thisRegs.payloadGPR();
#if USE(JSVALUE32_64)
m_stubInfo->v.thisTagGPR = thisRegs.tagGPR();
#endif
}
void JITGetByIdWithThisGenerator::generateFastPath(MacroAssembler& jit)
{
generateFastCommon(jit, InlineAccess::sizeForPropertyAccess());
}
JITPutByIdGenerator::JITPutByIdGenerator(
CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSite, const RegisterSet& usedRegisters, CacheableIdentifier,
JSValueRegs base, JSValueRegs value, GPRReg stubInfoGPR, GPRReg scratch,
ECMAMode ecmaMode, PutKind putKind)
: JITByIdGenerator(codeBlock, jitType, codeOrigin, callSite, AccessType::PutById, usedRegisters, base, value, stubInfoGPR)
, m_ecmaMode(ecmaMode)
, m_putKind(putKind)
{
m_stubInfo->usedRegisters.clear(scratch);
}
void JITPutByIdGenerator::generateFastPath(MacroAssembler& jit)
{
generateFastCommon(jit, InlineAccess::sizeForPropertyReplace());
}
V_JITOperation_GSsiJJC JITPutByIdGenerator::slowPathFunction()
{
switch (m_putKind) {
case PutKind::NotDirect:
if (m_ecmaMode.isStrict())
return operationPutByIdStrictOptimize;
return operationPutByIdNonStrictOptimize;
case PutKind::Direct:
if (m_ecmaMode.isStrict())
return operationPutByIdDirectStrictOptimize;
return operationPutByIdDirectNonStrictOptimize;
case PutKind::DirectPrivateFieldDefine:
ASSERT(m_ecmaMode.isStrict());
return operationPutByIdDefinePrivateFieldStrictOptimize;
case PutKind::DirectPrivateFieldSet:
ASSERT(m_ecmaMode.isStrict());
return operationPutByIdSetPrivateFieldStrictOptimize;
}
// Make win port compiler happy
RELEASE_ASSERT_NOT_REACHED();
return nullptr;
}
JITDelByValGenerator::JITDelByValGenerator(CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSiteIndex, const RegisterSet& usedRegisters, JSValueRegs base, JSValueRegs property, JSValueRegs result, GPRReg stubInfoGPR, GPRReg scratch)
: Base(codeBlock, jitType, codeOrigin, callSiteIndex, AccessType::DeleteByVal, usedRegisters)
{
m_stubInfo->hasConstantIdentifier = false;
ASSERT(base.payloadGPR() != result.payloadGPR());
m_stubInfo->baseGPR = base.payloadGPR();
m_stubInfo->regs.propertyGPR = property.payloadGPR();
m_stubInfo->valueGPR = result.payloadGPR();
m_stubInfo->m_stubInfoGPR = stubInfoGPR;
#if USE(JSVALUE32_64)
ASSERT(base.tagGPR() != result.tagGPR());
m_stubInfo->baseTagGPR = base.tagGPR();
m_stubInfo->valueTagGPR = result.tagGPR();
m_stubInfo->v.propertyTagGPR = property.tagGPR();
#endif
m_stubInfo->usedRegisters.clear(scratch);
}
void JITDelByValGenerator::generateFastPath(MacroAssembler& jit)
{
m_start = jit.label();
if (JITCode::useDataIC(m_jitType)) {
jit.move(CCallHelpers::TrustedImmPtr(m_stubInfo), m_stubInfo->m_stubInfoGPR);
jit.call(CCallHelpers::Address(m_stubInfo->m_stubInfoGPR, StructureStubInfo::offsetOfCodePtr()), JITStubRoutinePtrTag);
} else
m_slowPathJump = jit.patchableJump();
m_done = jit.label();
}
void JITDelByValGenerator::finalize(LinkBuffer& fastPath, LinkBuffer& slowPath)
{
Base::finalize(fastPath, slowPath, fastPath.locationOf<JITStubRoutinePtrTag>(m_start));
if (JITCode::useDataIC(m_jitType))
m_stubInfo->m_codePtr = m_stubInfo->slowPathStartLocation;
}
JITDelByIdGenerator::JITDelByIdGenerator(CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSiteIndex, const RegisterSet& usedRegisters, CacheableIdentifier, JSValueRegs base, JSValueRegs result, GPRReg stubInfoGPR, GPRReg scratch)
: Base(codeBlock, jitType, codeOrigin, callSiteIndex, AccessType::DeleteByID, usedRegisters)
{
m_stubInfo->hasConstantIdentifier = true;
ASSERT(base.payloadGPR() != result.payloadGPR());
m_stubInfo->baseGPR = base.payloadGPR();
m_stubInfo->regs.propertyGPR = InvalidGPRReg;
m_stubInfo->valueGPR = result.payloadGPR();
m_stubInfo->m_stubInfoGPR = stubInfoGPR;
#if USE(JSVALUE32_64)
ASSERT(base.tagGPR() != result.tagGPR());
m_stubInfo->baseTagGPR = base.tagGPR();
m_stubInfo->valueTagGPR = result.tagGPR();
m_stubInfo->v.propertyTagGPR = InvalidGPRReg;
#endif
m_stubInfo->usedRegisters.clear(scratch);
}
void JITDelByIdGenerator::generateFastPath(MacroAssembler& jit)
{
m_start = jit.label();
if (JITCode::useDataIC(m_jitType)) {
jit.move(CCallHelpers::TrustedImmPtr(m_stubInfo), m_stubInfo->m_stubInfoGPR);
jit.call(CCallHelpers::Address(m_stubInfo->m_stubInfoGPR, StructureStubInfo::offsetOfCodePtr()), JITStubRoutinePtrTag);
} else
m_slowPathJump = jit.patchableJump();
m_done = jit.label();
}
void JITDelByIdGenerator::finalize(LinkBuffer& fastPath, LinkBuffer& slowPath)
{
Base::finalize(fastPath, slowPath, fastPath.locationOf<JITStubRoutinePtrTag>(m_start));
if (JITCode::useDataIC(m_jitType))
m_stubInfo->m_codePtr = m_stubInfo->slowPathStartLocation;
}
JITInByValGenerator::JITInByValGenerator(CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSiteIndex, AccessType accessType, const RegisterSet& usedRegisters, JSValueRegs base, JSValueRegs property, JSValueRegs result, GPRReg stubInfoGPR)
: Base(codeBlock, jitType, codeOrigin, callSiteIndex, accessType, usedRegisters)
{
m_stubInfo->hasConstantIdentifier = false;
m_stubInfo->baseGPR = base.payloadGPR();
m_stubInfo->regs.propertyGPR = property.payloadGPR();
m_stubInfo->valueGPR = result.payloadGPR();
m_stubInfo->m_stubInfoGPR = stubInfoGPR;
#if USE(JSVALUE32_64)
m_stubInfo->baseTagGPR = base.tagGPR();
m_stubInfo->valueTagGPR = result.tagGPR();
m_stubInfo->v.propertyTagGPR = property.tagGPR();
#endif
}
void JITInByValGenerator::generateFastPath(MacroAssembler& jit)
{
m_start = jit.label();
if (JITCode::useDataIC(m_jitType)) {
jit.move(CCallHelpers::TrustedImmPtr(m_stubInfo), m_stubInfo->m_stubInfoGPR);
jit.call(CCallHelpers::Address(m_stubInfo->m_stubInfoGPR, StructureStubInfo::offsetOfCodePtr()), JITStubRoutinePtrTag);
} else
m_slowPathJump = jit.patchableJump();
m_done = jit.label();
}
void JITInByValGenerator::finalize(
LinkBuffer& fastPath, LinkBuffer& slowPath)
{
ASSERT(m_start.isSet());
Base::finalize(fastPath, slowPath, fastPath.locationOf<JITStubRoutinePtrTag>(m_start));
if (JITCode::useDataIC(m_jitType))
m_stubInfo->m_codePtr = m_stubInfo->slowPathStartLocation;
}
JITInByIdGenerator::JITInByIdGenerator(
CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSite, const RegisterSet& usedRegisters,
CacheableIdentifier propertyName, JSValueRegs base, JSValueRegs value, GPRReg stubInfoGPR)
: JITByIdGenerator(codeBlock, jitType, codeOrigin, callSite, AccessType::InById, usedRegisters, base, value, stubInfoGPR)
{
// FIXME: We are not supporting fast path for "length" property.
UNUSED_PARAM(propertyName);
RELEASE_ASSERT(base.payloadGPR() != value.tagGPR());
}
void JITInByIdGenerator::generateFastPath(MacroAssembler& jit)
{
generateFastCommon(jit, InlineAccess::sizeForPropertyAccess());
}
JITInstanceOfGenerator::JITInstanceOfGenerator(
CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSiteIndex,
const RegisterSet& usedRegisters, GPRReg result, GPRReg value, GPRReg prototype, GPRReg stubInfoGPR,
GPRReg scratch1, GPRReg scratch2, bool prototypeIsKnownObject)
: JITInlineCacheGenerator(codeBlock, jitType, codeOrigin, callSiteIndex, AccessType::InstanceOf, usedRegisters)
{
m_stubInfo->baseGPR = value;
m_stubInfo->valueGPR = result;
m_stubInfo->regs.prototypeGPR = prototype;
m_stubInfo->m_stubInfoGPR = stubInfoGPR;
#if USE(JSVALUE32_64)
m_stubInfo->baseTagGPR = InvalidGPRReg;
m_stubInfo->valueTagGPR = InvalidGPRReg;
m_stubInfo->v.thisTagGPR = InvalidGPRReg;
#endif
m_stubInfo->usedRegisters.clear(result);
if (scratch1 != InvalidGPRReg)
m_stubInfo->usedRegisters.clear(scratch1);
if (scratch2 != InvalidGPRReg)
m_stubInfo->usedRegisters.clear(scratch2);
m_stubInfo->prototypeIsKnownObject = prototypeIsKnownObject;
m_stubInfo->hasConstantIdentifier = false;
}
void JITInstanceOfGenerator::generateFastPath(MacroAssembler& jit)
{
m_start = jit.label();
if (JITCode::useDataIC(m_jitType)) {
jit.move(CCallHelpers::TrustedImmPtr(m_stubInfo), m_stubInfo->m_stubInfoGPR);
jit.call(CCallHelpers::Address(m_stubInfo->m_stubInfoGPR, StructureStubInfo::offsetOfCodePtr()), JITStubRoutinePtrTag);
} else
m_slowPathJump = jit.patchableJump();
m_done = jit.label();
}
void JITInstanceOfGenerator::finalize(LinkBuffer& fastPath, LinkBuffer& slowPath)
{
Base::finalize(fastPath, slowPath, fastPath.locationOf<JITStubRoutinePtrTag>(m_start));
if (JITCode::useDataIC(m_jitType))
m_stubInfo->m_codePtr = m_stubInfo->slowPathStartLocation;
}
JITGetByValGenerator::JITGetByValGenerator(CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSiteIndex, AccessType accessType, const RegisterSet& usedRegisters, JSValueRegs base, JSValueRegs property, JSValueRegs result, GPRReg stubInfoGPR)
: Base(codeBlock, jitType, codeOrigin, callSiteIndex, accessType, usedRegisters)
, m_base(base)
, m_result(result)
{
m_stubInfo->hasConstantIdentifier = false;
m_stubInfo->baseGPR = base.payloadGPR();
m_stubInfo->regs.propertyGPR = property.payloadGPR();
m_stubInfo->valueGPR = result.payloadGPR();
m_stubInfo->m_stubInfoGPR = stubInfoGPR;
#if USE(JSVALUE32_64)
m_stubInfo->baseTagGPR = base.tagGPR();
m_stubInfo->valueTagGPR = result.tagGPR();
m_stubInfo->v.propertyTagGPR = property.tagGPR();
#endif
}
void JITGetByValGenerator::generateFastPath(MacroAssembler& jit)
{
m_start = jit.label();
if (JITCode::useDataIC(m_jitType)) {
jit.move(CCallHelpers::TrustedImmPtr(m_stubInfo), m_stubInfo->m_stubInfoGPR);
jit.call(CCallHelpers::Address(m_stubInfo->m_stubInfoGPR, StructureStubInfo::offsetOfCodePtr()), JITStubRoutinePtrTag);
} else
m_slowPathJump = jit.patchableJump();
m_done = jit.label();
}
void JITGetByValGenerator::finalize(LinkBuffer& fastPath, LinkBuffer& slowPath)
{
Base::finalize(fastPath, slowPath, fastPath.locationOf<JITStubRoutinePtrTag>(m_start));
if (JITCode::useDataIC(m_jitType))
m_stubInfo->m_codePtr = m_stubInfo->slowPathStartLocation;
}
JITPutByValGenerator::JITPutByValGenerator(CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSiteIndex, AccessType accessType, const RegisterSet& usedRegisters, JSValueRegs base, JSValueRegs property, JSValueRegs value, GPRReg arrayProfileGPR, GPRReg stubInfoGPR)
: Base(codeBlock, jitType, codeOrigin, callSiteIndex, accessType, usedRegisters)
, m_base(base)
, m_value(value)
{
m_stubInfo->hasConstantIdentifier = false;
m_stubInfo->baseGPR = base.payloadGPR();
m_stubInfo->regs.propertyGPR = property.payloadGPR();
m_stubInfo->valueGPR = value.payloadGPR();
m_stubInfo->m_stubInfoGPR = stubInfoGPR;
m_stubInfo->m_arrayProfileGPR = arrayProfileGPR;
#if USE(JSVALUE32_64)
m_stubInfo->baseTagGPR = base.tagGPR();
m_stubInfo->valueTagGPR = value.tagGPR();
m_stubInfo->v.propertyTagGPR = property.tagGPR();
#endif
}
void JITPutByValGenerator::generateFastPath(MacroAssembler& jit)
{
m_start = jit.label();
if (JITCode::useDataIC(m_jitType)) {
jit.move(CCallHelpers::TrustedImmPtr(m_stubInfo), m_stubInfo->m_stubInfoGPR);
jit.call(CCallHelpers::Address(m_stubInfo->m_stubInfoGPR, StructureStubInfo::offsetOfCodePtr()), JITStubRoutinePtrTag);
} else
m_slowPathJump = jit.patchableJump();
m_done = jit.label();
}
void JITPutByValGenerator::finalize(LinkBuffer& fastPath, LinkBuffer& slowPath)
{
Base::finalize(fastPath, slowPath, fastPath.locationOf<JITStubRoutinePtrTag>(m_start));
if (JITCode::useDataIC(m_jitType))
m_stubInfo->m_codePtr = m_stubInfo->slowPathStartLocation;
}
JITPrivateBrandAccessGenerator::JITPrivateBrandAccessGenerator(CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSiteIndex, AccessType accessType, const RegisterSet& usedRegisters, JSValueRegs base, JSValueRegs brand, GPRReg stubInfoGPR)
: Base(codeBlock, jitType, codeOrigin, callSiteIndex, accessType, usedRegisters)
{
ASSERT(accessType == AccessType::CheckPrivateBrand || accessType == AccessType::SetPrivateBrand);
m_stubInfo->hasConstantIdentifier = false;
m_stubInfo->baseGPR = base.payloadGPR();
m_stubInfo->regs.brandGPR = brand.payloadGPR();
m_stubInfo->valueGPR = InvalidGPRReg;
m_stubInfo->m_stubInfoGPR = stubInfoGPR;
#if USE(JSVALUE32_64)
m_stubInfo->baseTagGPR = base.tagGPR();
m_stubInfo->v.brandTagGPR = brand.tagGPR();
m_stubInfo->valueTagGPR = InvalidGPRReg;
#endif
}
void JITPrivateBrandAccessGenerator::generateFastPath(MacroAssembler& jit)
{
m_start = jit.label();
if (JITCode::useDataIC(m_jitType)) {
jit.move(CCallHelpers::TrustedImmPtr(m_stubInfo), m_stubInfo->m_stubInfoGPR);
jit.call(CCallHelpers::Address(m_stubInfo->m_stubInfoGPR, StructureStubInfo::offsetOfCodePtr()), JITStubRoutinePtrTag);
} else
m_slowPathJump = jit.patchableJump();
m_done = jit.label();
}
void JITPrivateBrandAccessGenerator::finalize(LinkBuffer& fastPath, LinkBuffer& slowPath)
{
Base::finalize(fastPath, slowPath, fastPath.locationOf<JITStubRoutinePtrTag>(m_start));
if (JITCode::useDataIC(m_jitType))
m_stubInfo->m_codePtr = m_stubInfo->slowPathStartLocation;
}
} // namespace JSC
#endif // ENABLE(JIT)
|