[webkit-dev] Fwd: Native code generation for put_global_var instruction on X86_64 platform

wingoog moon wingoog91 at gmail.com
Thu Feb 23 03:13:15 PST 2012

---------- Forwarded message ----------
From: wingoog moon <wingoog91 at gmail.com>
Date: Wed, Feb 22, 2012 at 1:50 AM
Subject: Native code generation for put_global_var instruction on X86_64
To: squirrelfish-dev at lists.webkit.org

Trying to understand how  put_global_var is translated to x86_64 native
code. But still have several questions
Lets say i have following bytecode instruction

put_global_var 4, Int32: 6(@k1)

Lets look at the source code

void JIT::emit_op_put_global_var(Instruction* currentInstruction)
    JSGlobalObject* globalObject = m_codeBlock->globalObject();

    emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);

    move(TrustedImmPtr(globalObject), regT1);
    loadPtr(Address(regT1, JSVariableObject::offsetOfRegisters()), regT1);
    storePtr(regT0, Address(regT1, currentInstruction[1].u.operand *
    emitWriteBarrier(globalObject, regT0, regT2, ShouldFilterImmediates,

1.  What is mean of currentInstruction[2]?  As I Understand it's holds
information about "Int32: 6(@k1)". Am I right??

2.  As I
understand  after emitGetVirtualRegister(currentInstruction[2].u.operand,
regT0) we have encoded value of "Int32: 6(@k1)" in regT0.

3.  Cant't understad mean of  move(TrustedImmPtr(globalObject), regT1).
globalObject is a pretty big class. Can't figure out what is happening here

4.  loadPtr(Address(regT1, JSVariableObject::offsetOfRegisters()), regT1);
// What the mean of JSVariableObject::offsetOfRegisters()??

5.   storePtr(regT0, Address(regT1, currentInstruction[1].u.operand *
sizeof(Register))); // As I understand currentInstruction[1].u.operand
holds address where to put my constant, i.e "4". Am I right?

And question about mov instruction on x86_64 platform


void movq_i64r(int64_t imm, RegisterID dst)


              m_formatter.oneByteOp64(OP_MOV_EAXIv, dst);



How will look appropriate assembly for this code??

Thanks for attention!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120223/9eac0f18/attachment.html>

More information about the webkit-dev mailing list