304
303
JIT jit(globalData, codeBlock);
305
304
jit.privateCompileGetByIdChainList(stubInfo, prototypeStructureList, currentIndex, structure, chain, count, cachedOffset, callFrame);
309
static void compileGetByIdChain(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, void* returnAddress)
307
static void compileGetByIdChain(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, ReturnAddressPtr returnAddress)
311
309
JIT jit(globalData, codeBlock);
312
310
jit.privateCompileGetByIdChain(stubInfo, structure, chain, count, cachedOffset, returnAddress, callFrame);
315
static void compilePutByIdReplace(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, void* returnAddress)
317
JIT jit(globalData, codeBlock);
318
jit.privateCompilePutByIdReplace(stubInfo, structure, cachedOffset, returnAddress);
321
static void compilePutByIdTransition(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, void* returnAddress)
313
static void compilePutByIdTransition(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress)
323
315
JIT jit(globalData, codeBlock);
324
316
jit.privateCompilePutByIdTransition(stubInfo, oldStructure, newStructure, cachedOffset, chain, returnAddress);
327
static void compileCTIMachineTrampolines(JSGlobalData* globalData)
319
static void compileCTIMachineTrampolines(JSGlobalData* globalData, RefPtr<ExecutablePool>* executablePool, CodePtr* ctiStringLengthTrampoline, CodePtr* ctiVirtualCallLink, CodePtr* ctiVirtualCall, CodePtr* ctiNativeCallThunk)
329
321
JIT jit(globalData);
330
jit.privateCompileCTIMachineTrampolines();
322
jit.privateCompileCTIMachineTrampolines(executablePool, globalData, ctiStringLengthTrampoline, ctiVirtualCallLink, ctiVirtualCall, ctiNativeCallThunk);
333
static void patchGetByIdSelf(StructureStubInfo*, Structure*, size_t cachedOffset, void* returnAddress);
334
static void patchPutByIdReplace(StructureStubInfo*, Structure*, size_t cachedOffset, void* returnAddress);
325
static void patchGetByIdSelf(CodeBlock* codeblock, StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress);
326
static void patchPutByIdReplace(CodeBlock* codeblock, StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress);
327
static void patchMethodCallProto(CodeBlock* codeblock, MethodCallLinkInfo&, JSFunction*, Structure*, JSObject*, ReturnAddressPtr);
336
static void compilePatchGetArrayLength(JSGlobalData* globalData, CodeBlock* codeBlock, void* returnAddress)
329
static void compilePatchGetArrayLength(JSGlobalData* globalData, CodeBlock* codeBlock, ReturnAddressPtr returnAddress)
338
331
JIT jit(globalData, codeBlock);
339
332
return jit.privateCompilePatchGetArrayLength(returnAddress);
342
static void linkCall(JSFunction* callee, CodeBlock* calleeCodeBlock, void* ctiCode, CallLinkInfo* callLinkInfo, int callerArgCount);
335
static void linkCall(JSFunction* callee, CodeBlock* callerCodeBlock, CodeBlock* calleeCodeBlock, JITCode&, CallLinkInfo*, int callerArgCount, JSGlobalData*);
343
336
static void unlinkCall(CallLinkInfo*);
345
inline static JSValuePtr execute(void* code, RegisterFile* registerFile, CallFrame* callFrame, JSGlobalData* globalData, JSValuePtr* exception)
347
return JSValuePtr::decode(ctiTrampoline(
351
code, registerFile, callFrame, exception, Profiler::enabledProfilerReference(), globalData));
340
DataLabelPtr storeLocation;
343
JSRInfo(DataLabelPtr storeLocation, Label targetLocation)
344
: storeLocation(storeLocation)
345
, target(targetLocation)
355
350
JIT(JSGlobalData*, CodeBlock* = 0);
357
352
void privateCompileMainPass();
358
353
void privateCompileLinkPass();
359
354
void privateCompileSlowCases();
360
void privateCompile();
361
void privateCompileGetByIdSelf(StructureStubInfo*, Structure*, size_t cachedOffset, void* returnAddress);
362
void privateCompileGetByIdProto(StructureStubInfo*, Structure*, Structure* prototypeStructure, size_t cachedOffset, void* returnAddress, CallFrame* callFrame);
363
#if USE(CTI_REPATCH_PIC)
355
JITCode privateCompile();
356
void privateCompileGetByIdProto(StructureStubInfo*, Structure*, Structure* prototypeStructure, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame);
364
357
void privateCompileGetByIdSelfList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, size_t cachedOffset);
365
358
void privateCompileGetByIdProtoList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, Structure* prototypeStructure, size_t cachedOffset, CallFrame* callFrame);
366
359
void privateCompileGetByIdChainList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, StructureChain* chain, size_t count, size_t cachedOffset, CallFrame* callFrame);
368
void privateCompileGetByIdChain(StructureStubInfo*, Structure*, StructureChain*, size_t count, size_t cachedOffset, void* returnAddress, CallFrame* callFrame);
369
void privateCompilePutByIdReplace(StructureStubInfo*, Structure*, size_t cachedOffset, void* returnAddress);
370
void privateCompilePutByIdTransition(StructureStubInfo*, Structure*, Structure*, size_t cachedOffset, StructureChain*, void* returnAddress);
360
void privateCompileGetByIdChain(StructureStubInfo*, Structure*, StructureChain*, size_t count, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame);
361
void privateCompilePutByIdTransition(StructureStubInfo*, Structure*, Structure*, size_t cachedOffset, StructureChain*, ReturnAddressPtr returnAddress);
372
void privateCompileCTIMachineTrampolines();
373
void privateCompilePatchGetArrayLength(void* returnAddress);
363
void privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* data, CodePtr* ctiStringLengthTrampoline, CodePtr* ctiVirtualCallLink, CodePtr* ctiVirtualCall, CodePtr* ctiNativeCallThunk);
364
void privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress);
375
366
void addSlowCase(Jump);
367
void addSlowCase(JumpList);
376
368
void addJump(Jump, int);
377
369
void emitJumpSlowToHot(Jump, int);
379
void compileGetByIdHotPath(int resultVReg, int baseVReg, Identifier* ident, unsigned propertyAccessInstructionIndex);
380
void compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident, Vector<SlowCaseEntry>::iterator& iter, unsigned propertyAccessInstructionIndex);
381
void compilePutByIdHotPath(int baseVReg, Identifier* ident, int valueVReg, unsigned propertyAccessInstructionIndex);
382
void compilePutByIdSlowCase(int baseVReg, Identifier* ident, int valueVReg, Vector<SlowCaseEntry>::iterator& iter, unsigned propertyAccessInstructionIndex);
383
371
void compileOpCall(OpcodeID, Instruction* instruction, unsigned callLinkInfoIndex);
372
void compileOpCallVarargs(Instruction* instruction);
384
373
void compileOpCallInitializeCallFrame();
385
374
void compileOpCallSetupArgs(Instruction*);
386
void compileOpCallEvalSetupArgs(Instruction*);
375
void compileOpCallVarargsSetupArgs(Instruction*);
387
376
void compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID);
377
void compileOpCallVarargsSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter);
388
378
void compileOpConstructSetupArgs(Instruction*);
389
380
enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq };
390
381
void compileOpStrictEq(Instruction* instruction, CompileOpStrictEqType type);
391
void putDoubleResultToJSNumberCellOrJSImmediate(X86Assembler::XMMRegisterID xmmSource, RegisterID jsNumberCell, unsigned dst, X86Assembler::JmpSrc* wroteJSNumberCell, X86Assembler::XMMRegisterID tempXmm, RegisterID tempReg1, RegisterID tempReg2);
393
void compileFastArith_op_add(Instruction*);
394
void compileFastArith_op_mul(Instruction*);
395
void compileFastArith_op_mod(unsigned result, unsigned op1, unsigned op2);
396
void compileFastArith_op_bitand(unsigned result, unsigned op1, unsigned op2);
397
void compileFastArith_op_lshift(unsigned result, unsigned op1, unsigned op2);
398
void compileFastArith_op_rshift(unsigned result, unsigned op1, unsigned op2);
399
void compileFastArith_op_pre_inc(unsigned srcDst);
400
void compileFastArith_op_pre_dec(unsigned srcDst);
401
void compileFastArith_op_post_inc(unsigned result, unsigned srcDst);
402
void compileFastArith_op_post_dec(unsigned result, unsigned srcDst);
403
void compileFastArithSlow_op_add(Instruction*, Vector<SlowCaseEntry>::iterator&);
404
void compileFastArithSlow_op_mul(Instruction*, Vector<SlowCaseEntry>::iterator&);
405
void compileFastArithSlow_op_mod(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);
406
void compileFastArithSlow_op_bitand(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);
407
void compileFastArithSlow_op_lshift(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);
408
void compileFastArithSlow_op_rshift(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);
409
void compileFastArithSlow_op_pre_inc(unsigned srcDst, Vector<SlowCaseEntry>::iterator&);
410
void compileFastArithSlow_op_pre_dec(unsigned srcDst, Vector<SlowCaseEntry>::iterator&);
411
void compileFastArithSlow_op_post_inc(unsigned result, unsigned srcDst, Vector<SlowCaseEntry>::iterator&);
412
void compileFastArithSlow_op_post_dec(unsigned result, unsigned srcDst, Vector<SlowCaseEntry>::iterator&);
413
void compileBinaryArithOp(OpcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi);
414
void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi);
382
bool isOperandConstantImmediateDouble(unsigned src);
384
void emitLoadDouble(unsigned index, FPRegisterID value);
385
void emitLoadInt32ToDouble(unsigned index, FPRegisterID value);
387
Address addressFor(unsigned index, RegisterID base = callFrameRegister);
389
#if USE(JSVALUE32_64)
390
Address tagFor(unsigned index, RegisterID base = callFrameRegister);
391
Address payloadFor(unsigned index, RegisterID base = callFrameRegister);
393
bool getOperandConstantImmediateInt(unsigned op1, unsigned op2, unsigned& op, int32_t& constant);
395
void emitLoadTag(unsigned index, RegisterID tag);
396
void emitLoadPayload(unsigned index, RegisterID payload);
398
void emitLoad(const JSValue& v, RegisterID tag, RegisterID payload);
399
void emitLoad(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
400
void emitLoad2(unsigned index1, RegisterID tag1, RegisterID payload1, unsigned index2, RegisterID tag2, RegisterID payload2);
402
void emitStore(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
403
void emitStore(unsigned index, const JSValue constant, RegisterID base = callFrameRegister);
404
void emitStoreInt32(unsigned index, RegisterID payload, bool indexIsInt32 = false);
405
void emitStoreInt32(unsigned index, Imm32 payload, bool indexIsInt32 = false);
406
void emitStoreCell(unsigned index, RegisterID payload, bool indexIsCell = false);
407
void emitStoreBool(unsigned index, RegisterID tag, bool indexIsBool = false);
408
void emitStoreDouble(unsigned index, FPRegisterID value);
410
bool isLabeled(unsigned bytecodeIndex);
411
void map(unsigned bytecodeIndex, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload);
412
void unmap(RegisterID);
414
bool isMapped(unsigned virtualRegisterIndex);
415
bool getMappedPayload(unsigned virtualRegisterIndex, RegisterID& payload);
416
bool getMappedTag(unsigned virtualRegisterIndex, RegisterID& tag);
418
void emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex);
419
void emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex, RegisterID tag);
420
void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, unsigned virtualRegisterIndex);
422
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
423
void compileGetByIdHotPath();
424
void compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident, Vector<SlowCaseEntry>::iterator& iter, bool isMethodCheck = false);
426
void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, Structure* structure, size_t cachedOffset);
427
void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID resultTag, RegisterID resultPayload, size_t cachedOffset);
428
void compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, Structure* structure, size_t cachedOffset);
430
// Arithmetic opcode helpers
431
void emitAdd32Constant(unsigned dst, unsigned op, int32_t constant, ResultType opType);
432
void emitSub32Constant(unsigned dst, unsigned op, int32_t constant, ResultType opType);
433
void emitBinaryDoubleOp(OpcodeID, unsigned dst, unsigned op1, unsigned op2, OperandTypes, JumpList& notInt32Op1, JumpList& notInt32Op2, bool op1IsInRegisters = true, bool op2IsInRegisters = true);
436
// These architecture specific value are used to enable patching - see comment on op_put_by_id.
437
static const int patchOffsetPutByIdStructure = 7;
438
static const int patchOffsetPutByIdExternalLoad = 13;
439
static const int patchLengthPutByIdExternalLoad = 3;
440
static const int patchOffsetPutByIdPropertyMapOffset1 = 22;
441
static const int patchOffsetPutByIdPropertyMapOffset2 = 28;
442
// These architecture specific value are used to enable patching - see comment on op_get_by_id.
443
static const int patchOffsetGetByIdStructure = 7;
444
static const int patchOffsetGetByIdBranchToSlowCase = 13;
445
static const int patchOffsetGetByIdExternalLoad = 13;
446
static const int patchLengthGetByIdExternalLoad = 3;
447
static const int patchOffsetGetByIdPropertyMapOffset1 = 22;
448
static const int patchOffsetGetByIdPropertyMapOffset2 = 28;
449
static const int patchOffsetGetByIdPutResult = 28;
450
#if ENABLE(OPCODE_SAMPLING) && USE(JIT_STUB_ARGUMENT_VA_LIST)
451
static const int patchOffsetGetByIdSlowCaseCall = 35;
452
#elif ENABLE(OPCODE_SAMPLING)
453
static const int patchOffsetGetByIdSlowCaseCall = 37;
454
#elif USE(JIT_STUB_ARGUMENT_VA_LIST)
455
static const int patchOffsetGetByIdSlowCaseCall = 25;
457
static const int patchOffsetGetByIdSlowCaseCall = 27;
459
static const int patchOffsetOpCallCompareToJump = 6;
461
static const int patchOffsetMethodCheckProtoObj = 11;
462
static const int patchOffsetMethodCheckProtoStruct = 18;
463
static const int patchOffsetMethodCheckPutFunction = 29;
465
#error "JSVALUE32_64 not supported on this platform."
468
#else // USE(JSVALUE32_64)
416
469
void emitGetVirtualRegister(int src, RegisterID dst);
417
470
void emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2);
418
void emitPutVirtualRegister(unsigned dst, RegisterID from = X86::eax);
471
void emitPutVirtualRegister(unsigned dst, RegisterID from = regT0);
473
int32_t getConstantOperandImmediateInt(unsigned src);
475
void emitGetVariableObjectRegister(RegisterID variableObject, int index, RegisterID dst);
476
void emitPutVariableObjectRegister(RegisterID src, RegisterID variableObject, int index);
478
void killLastResultRegister();
480
Jump emitJumpIfJSCell(RegisterID);
481
Jump emitJumpIfBothJSCells(RegisterID, RegisterID, RegisterID);
482
void emitJumpSlowCaseIfJSCell(RegisterID);
483
Jump emitJumpIfNotJSCell(RegisterID);
484
void emitJumpSlowCaseIfNotJSCell(RegisterID);
485
void emitJumpSlowCaseIfNotJSCell(RegisterID, int VReg);
487
JIT::Jump emitJumpIfImmediateNumber(RegisterID);
488
JIT::Jump emitJumpIfNotImmediateNumber(RegisterID);
490
JIT::Jump emitJumpIfImmediateNumber(RegisterID reg)
492
return emitJumpIfImmediateInteger(reg);
495
JIT::Jump emitJumpIfNotImmediateNumber(RegisterID reg)
497
return emitJumpIfNotImmediateInteger(reg);
500
JIT::Jump emitJumpIfImmediateInteger(RegisterID);
501
JIT::Jump emitJumpIfNotImmediateInteger(RegisterID);
502
JIT::Jump emitJumpIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
503
void emitJumpSlowCaseIfNotImmediateInteger(RegisterID);
504
void emitJumpSlowCaseIfNotImmediateNumber(RegisterID);
505
void emitJumpSlowCaseIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
508
void emitFastArithDeTagImmediate(RegisterID);
509
Jump emitFastArithDeTagImmediateJumpIfZero(RegisterID);
511
void emitFastArithReTagImmediate(RegisterID src, RegisterID dest);
512
void emitFastArithImmToInt(RegisterID);
513
void emitFastArithIntToImmNoCheck(RegisterID src, RegisterID dest);
515
void emitTagAsBoolImmediate(RegisterID reg);
516
void compileBinaryArithOp(OpcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi);
518
void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase);
520
void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes);
523
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
524
void compileGetByIdHotPath(int resultVReg, int baseVReg, Identifier* ident, unsigned propertyAccessInstructionIndex);
525
void compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident, Vector<SlowCaseEntry>::iterator& iter, bool isMethodCheck = false);
527
void compileGetDirectOffset(RegisterID base, RegisterID result, Structure* structure, size_t cachedOffset);
528
void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID result, size_t cachedOffset);
529
void compilePutDirectOffset(RegisterID base, RegisterID value, Structure* structure, size_t cachedOffset);
532
// These architecture specific value are used to enable patching - see comment on op_put_by_id.
533
static const int patchOffsetPutByIdStructure = 10;
534
static const int patchOffsetPutByIdExternalLoad = 20;
535
static const int patchLengthPutByIdExternalLoad = 4;
536
static const int patchOffsetPutByIdPropertyMapOffset = 31;
537
// These architecture specific value are used to enable patching - see comment on op_get_by_id.
538
static const int patchOffsetGetByIdStructure = 10;
539
static const int patchOffsetGetByIdBranchToSlowCase = 20;
540
static const int patchOffsetGetByIdExternalLoad = 20;
541
static const int patchLengthGetByIdExternalLoad = 4;
542
static const int patchOffsetGetByIdPropertyMapOffset = 31;
543
static const int patchOffsetGetByIdPutResult = 31;
544
#if ENABLE(OPCODE_SAMPLING)
545
static const int patchOffsetGetByIdSlowCaseCall = 64;
547
static const int patchOffsetGetByIdSlowCaseCall = 41;
549
static const int patchOffsetOpCallCompareToJump = 9;
551
static const int patchOffsetMethodCheckProtoObj = 20;
552
static const int patchOffsetMethodCheckProtoStruct = 30;
553
static const int patchOffsetMethodCheckPutFunction = 50;
555
// These architecture specific value are used to enable patching - see comment on op_put_by_id.
556
static const int patchOffsetPutByIdStructure = 7;
557
static const int patchOffsetPutByIdExternalLoad = 13;
558
static const int patchLengthPutByIdExternalLoad = 3;
559
static const int patchOffsetPutByIdPropertyMapOffset = 22;
560
// These architecture specific value are used to enable patching - see comment on op_get_by_id.
561
static const int patchOffsetGetByIdStructure = 7;
562
static const int patchOffsetGetByIdBranchToSlowCase = 13;
563
static const int patchOffsetGetByIdExternalLoad = 13;
564
static const int patchLengthGetByIdExternalLoad = 3;
565
static const int patchOffsetGetByIdPropertyMapOffset = 22;
566
static const int patchOffsetGetByIdPutResult = 22;
567
#if ENABLE(OPCODE_SAMPLING) && USE(JIT_STUB_ARGUMENT_VA_LIST)
568
static const int patchOffsetGetByIdSlowCaseCall = 31;
569
#elif ENABLE(OPCODE_SAMPLING)
570
static const int patchOffsetGetByIdSlowCaseCall = 33;
571
#elif USE(JIT_STUB_ARGUMENT_VA_LIST)
572
static const int patchOffsetGetByIdSlowCaseCall = 21;
574
static const int patchOffsetGetByIdSlowCaseCall = 23;
576
static const int patchOffsetOpCallCompareToJump = 6;
578
static const int patchOffsetMethodCheckProtoObj = 11;
579
static const int patchOffsetMethodCheckProtoStruct = 18;
580
static const int patchOffsetMethodCheckPutFunction = 29;
581
#elif PLATFORM(ARM_THUMB2)
582
// These architecture specific value are used to enable patching - see comment on op_put_by_id.
583
static const int patchOffsetPutByIdStructure = 10;
584
static const int patchOffsetPutByIdExternalLoad = 20;
585
static const int patchLengthPutByIdExternalLoad = 12;
586
static const int patchOffsetPutByIdPropertyMapOffset = 40;
587
// These architecture specific value are used to enable patching - see comment on op_get_by_id.
588
static const int patchOffsetGetByIdStructure = 10;
589
static const int patchOffsetGetByIdBranchToSlowCase = 20;
590
static const int patchOffsetGetByIdExternalLoad = 20;
591
static const int patchLengthGetByIdExternalLoad = 12;
592
static const int patchOffsetGetByIdPropertyMapOffset = 40;
593
static const int patchOffsetGetByIdPutResult = 44;
594
#if ENABLE(OPCODE_SAMPLING)
595
static const int patchOffsetGetByIdSlowCaseCall = 0; // FIMXE
597
static const int patchOffsetGetByIdSlowCaseCall = 28;
599
static const int patchOffsetOpCallCompareToJump = 10;
601
static const int patchOffsetMethodCheckProtoObj = 18;
602
static const int patchOffsetMethodCheckProtoStruct = 28;
603
static const int patchOffsetMethodCheckPutFunction = 46;
604
#elif PLATFORM(ARM_TRADITIONAL)
605
// These architecture specific value are used to enable patching - see comment on op_put_by_id.
606
static const int patchOffsetPutByIdStructure = 4;
607
static const int patchOffsetPutByIdExternalLoad = 16;
608
static const int patchLengthPutByIdExternalLoad = 4;
609
static const int patchOffsetPutByIdPropertyMapOffset = 20;
610
// These architecture specific value are used to enable patching - see comment on op_get_by_id.
611
static const int patchOffsetGetByIdStructure = 4;
612
static const int patchOffsetGetByIdBranchToSlowCase = 16;
613
static const int patchOffsetGetByIdExternalLoad = 16;
614
static const int patchLengthGetByIdExternalLoad = 4;
615
static const int patchOffsetGetByIdPropertyMapOffset = 20;
616
static const int patchOffsetGetByIdPutResult = 28;
617
#if ENABLE(OPCODE_SAMPLING)
618
#error "OPCODE_SAMPLING is not yet supported"
620
static const int patchOffsetGetByIdSlowCaseCall = 36;
622
static const int patchOffsetOpCallCompareToJump = 12;
624
static const int patchOffsetMethodCheckProtoObj = 12;
625
static const int patchOffsetMethodCheckProtoStruct = 20;
626
static const int patchOffsetMethodCheckPutFunction = 32;
628
#endif // USE(JSVALUE32_64)
630
#if PLATFORM(ARM_TRADITIONAL)
632
static const int sequenceOpCallInstructionSpace = 12;
633
static const int sequenceOpCallConstantSpace = 2;
634
// sequenceMethodCheck
635
static const int sequenceMethodCheckInstructionSpace = 40;
636
static const int sequenceMethodCheckConstantSpace = 6;
637
// sequenceGetByIdHotPath
638
static const int sequenceGetByIdHotPathInstructionSpace = 28;
639
static const int sequenceGetByIdHotPathConstantSpace = 3;
640
// sequenceGetByIdSlowCase
641
static const int sequenceGetByIdSlowCaseInstructionSpace = 40;
642
static const int sequenceGetByIdSlowCaseConstantSpace = 2;
644
static const int sequencePutByIdInstructionSpace = 28;
645
static const int sequencePutByIdConstantSpace = 3;
648
#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
649
#define BEGIN_UNINTERRUPTED_SEQUENCE(name) beginUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace)
650
#define END_UNINTERRUPTED_SEQUENCE(name) endUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace)
652
void beginUninterruptedSequence(int, int);
653
void endUninterruptedSequence(int, int);
656
#define BEGIN_UNINTERRUPTED_SEQUENCE(name)
657
#define END_UNINTERRUPTED_SEQUENCE(name)
660
void emit_op_add(Instruction*);
661
void emit_op_bitand(Instruction*);
662
void emit_op_bitnot(Instruction*);
663
void emit_op_bitor(Instruction*);
664
void emit_op_bitxor(Instruction*);
665
void emit_op_call(Instruction*);
666
void emit_op_call_eval(Instruction*);
667
void emit_op_call_varargs(Instruction*);
668
void emit_op_catch(Instruction*);
669
void emit_op_construct(Instruction*);
670
void emit_op_construct_verify(Instruction*);
671
void emit_op_convert_this(Instruction*);
672
void emit_op_create_arguments(Instruction*);
673
void emit_op_debug(Instruction*);
674
void emit_op_del_by_id(Instruction*);
675
void emit_op_div(Instruction*);
676
void emit_op_end(Instruction*);
677
void emit_op_enter(Instruction*);
678
void emit_op_enter_with_activation(Instruction*);
679
void emit_op_eq(Instruction*);
680
void emit_op_eq_null(Instruction*);
681
void emit_op_get_by_id(Instruction*);
682
void emit_op_get_by_val(Instruction*);
683
void emit_op_get_global_var(Instruction*);
684
void emit_op_get_scoped_var(Instruction*);
685
void emit_op_init_arguments(Instruction*);
686
void emit_op_instanceof(Instruction*);
687
void emit_op_jeq_null(Instruction*);
688
void emit_op_jfalse(Instruction*);
689
void emit_op_jmp(Instruction*);
690
void emit_op_jmp_scopes(Instruction*);
691
void emit_op_jneq_null(Instruction*);
692
void emit_op_jneq_ptr(Instruction*);
693
void emit_op_jnless(Instruction*);
694
void emit_op_jnlesseq(Instruction*);
695
void emit_op_jsr(Instruction*);
696
void emit_op_jtrue(Instruction*);
697
void emit_op_load_varargs(Instruction*);
698
void emit_op_loop(Instruction*);
699
void emit_op_loop_if_less(Instruction*);
700
void emit_op_loop_if_lesseq(Instruction*);
701
void emit_op_loop_if_true(Instruction*);
702
void emit_op_lshift(Instruction*);
703
void emit_op_method_check(Instruction*);
704
void emit_op_mod(Instruction*);
705
void emit_op_mov(Instruction*);
706
void emit_op_mul(Instruction*);
707
void emit_op_negate(Instruction*);
708
void emit_op_neq(Instruction*);
709
void emit_op_neq_null(Instruction*);
710
void emit_op_new_array(Instruction*);
711
void emit_op_new_error(Instruction*);
712
void emit_op_new_func(Instruction*);
713
void emit_op_new_func_exp(Instruction*);
714
void emit_op_new_object(Instruction*);
715
void emit_op_new_regexp(Instruction*);
716
void emit_op_next_pname(Instruction*);
717
void emit_op_not(Instruction*);
718
void emit_op_nstricteq(Instruction*);
719
void emit_op_pop_scope(Instruction*);
720
void emit_op_post_dec(Instruction*);
721
void emit_op_post_inc(Instruction*);
722
void emit_op_pre_dec(Instruction*);
723
void emit_op_pre_inc(Instruction*);
724
void emit_op_profile_did_call(Instruction*);
725
void emit_op_profile_will_call(Instruction*);
726
void emit_op_push_new_scope(Instruction*);
727
void emit_op_push_scope(Instruction*);
728
void emit_op_put_by_id(Instruction*);
729
void emit_op_put_by_index(Instruction*);
730
void emit_op_put_by_val(Instruction*);
731
void emit_op_put_getter(Instruction*);
732
void emit_op_put_global_var(Instruction*);
733
void emit_op_put_scoped_var(Instruction*);
734
void emit_op_put_setter(Instruction*);
735
void emit_op_resolve(Instruction*);
736
void emit_op_resolve_base(Instruction*);
737
void emit_op_resolve_global(Instruction*);
738
void emit_op_resolve_skip(Instruction*);
739
void emit_op_resolve_with_base(Instruction*);
740
void emit_op_ret(Instruction*);
741
void emit_op_rshift(Instruction*);
742
void emit_op_sret(Instruction*);
743
void emit_op_strcat(Instruction*);
744
void emit_op_stricteq(Instruction*);
745
void emit_op_sub(Instruction*);
746
void emit_op_switch_char(Instruction*);
747
void emit_op_switch_imm(Instruction*);
748
void emit_op_switch_string(Instruction*);
749
void emit_op_tear_off_activation(Instruction*);
750
void emit_op_tear_off_arguments(Instruction*);
751
void emit_op_throw(Instruction*);
752
void emit_op_to_jsnumber(Instruction*);
753
void emit_op_to_primitive(Instruction*);
754
void emit_op_unexpected_load(Instruction*);
756
void emitSlow_op_add(Instruction*, Vector<SlowCaseEntry>::iterator&);
757
void emitSlow_op_bitand(Instruction*, Vector<SlowCaseEntry>::iterator&);
758
void emitSlow_op_bitnot(Instruction*, Vector<SlowCaseEntry>::iterator&);
759
void emitSlow_op_bitor(Instruction*, Vector<SlowCaseEntry>::iterator&);
760
void emitSlow_op_bitxor(Instruction*, Vector<SlowCaseEntry>::iterator&);
761
void emitSlow_op_call(Instruction*, Vector<SlowCaseEntry>::iterator&);
762
void emitSlow_op_call_eval(Instruction*, Vector<SlowCaseEntry>::iterator&);
763
void emitSlow_op_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
764
void emitSlow_op_construct(Instruction*, Vector<SlowCaseEntry>::iterator&);
765
void emitSlow_op_construct_verify(Instruction*, Vector<SlowCaseEntry>::iterator&);
766
void emitSlow_op_convert_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
767
void emitSlow_op_div(Instruction*, Vector<SlowCaseEntry>::iterator&);
768
void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&);
769
void emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
770
void emitSlow_op_get_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
771
void emitSlow_op_instanceof(Instruction*, Vector<SlowCaseEntry>::iterator&);
772
void emitSlow_op_jfalse(Instruction*, Vector<SlowCaseEntry>::iterator&);
773
void emitSlow_op_jnless(Instruction*, Vector<SlowCaseEntry>::iterator&);
774
void emitSlow_op_jnlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
775
void emitSlow_op_jtrue(Instruction*, Vector<SlowCaseEntry>::iterator&);
776
void emitSlow_op_loop_if_less(Instruction*, Vector<SlowCaseEntry>::iterator&);
777
void emitSlow_op_loop_if_lesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
778
void emitSlow_op_loop_if_true(Instruction*, Vector<SlowCaseEntry>::iterator&);
779
void emitSlow_op_lshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
780
void emitSlow_op_method_check(Instruction*, Vector<SlowCaseEntry>::iterator&);
781
void emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&);
782
void emitSlow_op_mul(Instruction*, Vector<SlowCaseEntry>::iterator&);
783
void emitSlow_op_negate(Instruction*, Vector<SlowCaseEntry>::iterator&);
784
void emitSlow_op_neq(Instruction*, Vector<SlowCaseEntry>::iterator&);
785
void emitSlow_op_not(Instruction*, Vector<SlowCaseEntry>::iterator&);
786
void emitSlow_op_nstricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
787
void emitSlow_op_post_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
788
void emitSlow_op_post_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
789
void emitSlow_op_pre_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
790
void emitSlow_op_pre_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
791
void emitSlow_op_put_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
792
void emitSlow_op_put_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
793
void emitSlow_op_resolve_global(Instruction*, Vector<SlowCaseEntry>::iterator&);
794
void emitSlow_op_rshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
795
void emitSlow_op_stricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
796
void emitSlow_op_sub(Instruction*, Vector<SlowCaseEntry>::iterator&);
797
void emitSlow_op_to_jsnumber(Instruction*, Vector<SlowCaseEntry>::iterator&);
798
void emitSlow_op_to_primitive(Instruction*, Vector<SlowCaseEntry>::iterator&);
800
/* These functions are deprecated: Please use JITStubCall instead. */
420
801
void emitPutJITStubArg(RegisterID src, unsigned argumentNumber);
802
#if USE(JSVALUE32_64)
803
void emitPutJITStubArg(RegisterID tag, RegisterID payload, unsigned argumentNumber);
804
void emitPutJITStubArgFromVirtualRegister(unsigned src, unsigned argumentNumber, RegisterID scratch1, RegisterID scratch2);
421
806
void emitPutJITStubArgFromVirtualRegister(unsigned src, unsigned argumentNumber, RegisterID scratch);
422
808
void emitPutJITStubArgConstant(unsigned value, unsigned argumentNumber);
423
809
void emitPutJITStubArgConstant(void* value, unsigned argumentNumber);
424
810
void emitGetJITStubArg(unsigned argumentNumber, RegisterID dst);
426
812
void emitInitRegister(unsigned dst);
428
void emitPutCTIParam(void* value, unsigned name);
429
void emitPutCTIParam(RegisterID from, unsigned name);
430
void emitGetCTIParam(unsigned name, RegisterID to);
432
814
void emitPutToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry);
433
815
void emitPutImmediateToCallFrameHeader(void* value, RegisterFile::CallFrameHeaderEntry entry);
434
void emitGetFromCallFrameHeader(RegisterFile::CallFrameHeaderEntry entry, RegisterID to);
816
void emitGetFromCallFrameHeaderPtr(RegisterFile::CallFrameHeaderEntry entry, RegisterID to, RegisterID from = callFrameRegister);
817
void emitGetFromCallFrameHeader32(RegisterFile::CallFrameHeaderEntry entry, RegisterID to, RegisterID from = callFrameRegister);
436
JSValuePtr getConstantOperand(unsigned src);
437
int32_t getConstantOperandImmediateInt(unsigned src);
819
JSValue getConstantOperand(unsigned src);
438
820
bool isOperandConstantImmediateInt(unsigned src);
440
Jump emitJumpIfJSCell(RegisterID);
441
void emitJumpSlowCaseIfJSCell(RegisterID);
442
Jump emitJumpIfNotJSCell(RegisterID);
443
void emitJumpSlowCaseIfNotJSCell(RegisterID);
444
void emitJumpSlowCaseIfNotJSCell(RegisterID, int VReg);
446
822
Jump getSlowCase(Vector<SlowCaseEntry>::iterator& iter)
448
824
return iter++->from;