本文整理汇总了C++中Address函数的典型用法代码示例。如果您正苦于以下问题:C++ Address函数的具体用法?C++ Address怎么用?C++ Address使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Address函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: compileLoadVarargs
void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned callLinkInfoIndex)
{
int callee = instruction[1].u.operand;
/* Caller always:
- Updates callFrameRegister to callee callFrame.
- Initializes ArgumentCount; CallerFrame; Callee.
For a JS call:
- Caller initializes ScopeChain.
- Callee initializes ReturnPC; CodeBlock.
- Callee restores callFrameRegister before return.
For a non-JS call:
- Caller initializes ScopeChain; ReturnPC; CodeBlock.
- Caller restores callFrameRegister after return.
*/
if (opcodeID == op_call_varargs)
compileLoadVarargs(instruction);
else {
int argCount = instruction[2].u.operand;
int registerOffset = instruction[3].u.operand;
if (opcodeID == op_call && shouldEmitProfiling()) {
emitGetVirtualRegister(registerOffset + CallFrame::argumentOffsetIncludingThis(0), regT0);
Jump done = emitJumpIfNotJSCell(regT0);
loadPtr(Address(regT0, JSCell::structureOffset()), regT0);
storePtr(regT0, instruction[5].u.arrayProfile->addressOfLastSeenStructure());
done.link(this);
}
addPtr(TrustedImm32(registerOffset * sizeof(Register)), callFrameRegister, regT1);
store32(TrustedImm32(argCount), Address(regT1, JSStack::ArgumentCount * static_cast<int>(sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)));
} // regT1 holds newCallFrame with ArgumentCount initialized.
store32(TrustedImm32(instruction - m_codeBlock->instructions().begin()), Address(callFrameRegister, JSStack::ArgumentCount * static_cast<int>(sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag)));
emitGetVirtualRegister(callee, regT0); // regT0 holds callee.
store64(callFrameRegister, Address(regT1, JSStack::CallerFrame * static_cast<int>(sizeof(Register))));
store64(regT0, Address(regT1, JSStack::Callee * static_cast<int>(sizeof(Register))));
move(regT1, callFrameRegister);
if (opcodeID == op_call_eval) {
compileCallEval();
return;
}
DataLabelPtr addressOfLinkedFunctionCheck;
BEGIN_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
Jump slowCase = branchPtrWithPatch(NotEqual, regT0, addressOfLinkedFunctionCheck, TrustedImmPtr(0));
END_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
addSlowCase(slowCase);
ASSERT(m_callStructureStubCompilationInfo.size() == callLinkInfoIndex);
m_callStructureStubCompilationInfo.append(StructureStubCompilationInfo());
m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck;
m_callStructureStubCompilationInfo[callLinkInfoIndex].callType = CallLinkInfo::callTypeFor(opcodeID);
m_callStructureStubCompilationInfo[callLinkInfoIndex].bytecodeIndex = m_bytecodeOffset;
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scope)), regT1);
emitPutToCallFrameHeader(regT1, JSStack::ScopeChain);
m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
sampleCodeBlock(m_codeBlock);
}
开发者ID:BennyH26,项目名称:phantomjs,代码行数:66,代码来源:JITCall.cpp
示例2: case
char* StubRoutines::generate_megamorphic_ic(MacroAssembler* masm) {
// Called from within a MIC (megamorphic inline cache), the special
// variant of PICs for compiled code (see compiledPIC.hpp/cpp).
// The MIC layout is as follows:
//
// call <this stub routine>
// selector <--- return address (tos)
//
// Note: Don't use this for megamorphic super sends!
Label is_smi, probe_primary_cache, probe_secondary_cache, call_method, is_methodOop, do_lookup;
masm->bind(is_smi); // smi case (assumed to be infrequent)
masm->movl(ecx, Address((int)&smiKlassObj, relocInfo::external_word_type));
masm->jmp(probe_primary_cache);
// eax : receiver
// tos : return address pointing to selector in MIC
// tos + 4: return address of megamorphic send in compiled code
// tos + 8: last argument/receiver
char* entry_point = masm->pc();
masm->popl(ebx); // get return address (MIC cache)
masm->test(eax, Mem_Tag); // check if smi
masm->jcc(Assembler::zero, is_smi); // if so, get smi class directly
masm->movl(ecx, Address(eax, memOopDesc::klass_byte_offset())); // otherwise, load receiver class
// probe primary cache
//
// eax: receiver
// ebx: MIC cache pointer
// ecx: receiver klass
// tos: return address of megamorphic send in compiled code (ic)
masm->bind(probe_primary_cache); // compute hash value
masm->movl(edx, Address(ebx)); // get selector
// compute hash value
masm->movl(edi, ecx);
masm->xorl(edi, edx);
masm->andl(edi, (primary_cache_size - 1) << 4);
// probe cache
masm->cmpl(ecx, Address(edi, lookupCache::primary_cache_address() + 0*oopSize));
masm->jcc(Assembler::notEqual, probe_secondary_cache);
masm->cmpl(edx, Address(edi, lookupCache::primary_cache_address() + 1*oopSize));
masm->jcc(Assembler::notEqual, probe_secondary_cache);
masm->movl(ecx, Address(edi, lookupCache::primary_cache_address() + 2*oopSize));
// call method
//
// eax: receiver
// ecx: methodOop/nmethod
// tos: return address of megamorphic send in compiled code (ic)
masm->bind(call_method);
masm->test(ecx, Mem_Tag); // check if methodOop
masm->jcc(Assembler::notZero, is_methodOop); // otherwise
masm->jmp(ecx); // call nmethod
// call methodOop - setup registers
masm->bind(is_methodOop);
masm->xorl(ebx, ebx); // clear ebx for interpreter
masm->movl(edx, Address(int(&method_entry_point), relocInfo::external_word_type));
// (Note: cannot use value in method_entry_point directly since interpreter is generated afterwards)
//
// eax: receiver
// ebx: 00000000
// ecx: methodOop
// edx: entry point
// tos: return address of megamorphic send in compiled code (ic)
masm->jmp(edx); // call method_entry
// probe secondary cache
//
// eax: receiver
// ebx: MIC cache pointer
// ecx: receiver klass
// edx: selector
// edi: primary cache index
// tos: return address of megamorphic send in compiled code (ic)
masm->bind(probe_secondary_cache); // compute hash value
masm->andl(edi, (secondary_cache_size - 1) << 4);
// probe cache
masm->cmpl(ecx, Address(edi, lookupCache::secondary_cache_address() + 0*oopSize));
masm->jcc(Assembler::notEqual, do_lookup);
masm->cmpl(edx, Address(edi, lookupCache::secondary_cache_address() + 1*oopSize));
masm->jcc(Assembler::notEqual, do_lookup);
masm->movl(ecx, Address(edi, lookupCache::secondary_cache_address() + 2*oopSize));
masm->jmp(call_method);
// do lookup
//
// eax: receiver
// ebx: MIC cache pointer
// ecx: receiver klass
// edx: selector
// edi: secondary cache index
// tos: return address of megamorphic send in compiled code (ic)
masm->bind(do_lookup);
masm->set_last_Delta_frame_after_call();
masm->pushl(eax); // save receiver
masm->pushl(edx); // pass 2nd argument: selector
masm->pushl(ecx); // pass 1st argument: receiver klass
masm->call((char*)lookupCache::normal_lookup, relocInfo::runtime_call_type);
//.........这里部分代码省略.........
开发者ID:sebkirche,项目名称:strongtalk,代码行数:101,代码来源:stubRoutines.cpp
示例3: Address
char* StubRoutines::generate_PIC_stub(MacroAssembler* masm, int pic_size) {
// Called from within a PIC (polymorphic inline cache).
// The stub interprets the methodOop section of compiled PICs.
// The methodOop section layout is as follows:
//
// call <this stub routine>
// cached klass 1 <--- return address (tos)
// cached methodOop 1
// cached klass 2
// cached methodOop2
// ...
//
// cached klass n
// cached methodOop n
//
// Note: Don't use this for polymorphic super sends!
Label found, loop;
// entry found at index
//
// eax: receiver
// ebx: PIC table pointer
// ecx: methodOop
// edx: receiver klass
// tos: return address of polymorphic send in compiled code
masm->bind(found);
masm->movl(edx, Address(int(&method_entry_point), relocInfo::external_word_type));
// (Note: cannot use value in method_entry_point directly since interpreter is generated afterwards)
masm->xorl(ebx, ebx);
// eax: receiver
// ebx: 000000xx
// ecx: methodOop
masm->jmp(edx);
// eax : receiver
// tos : return address pointing to table in PIC
// tos + 4: return address of polymorphic send in compiled code
// tos + 8: last argument/receiver
char* entry_point = masm->pc();
masm->popl(ebx); // get return address (PIC table pointer)
masm->movl(edx, Address((int)&smiKlassObj, relocInfo::external_word_type));
masm->test(eax, Mem_Tag); // check if smi
masm->jcc(Assembler::zero, loop); // if so, class is already in ecx
masm->movl(edx, Address(eax, memOopDesc::klass_byte_offset())); // otherwise, load receiver class
// eax: receiver
// ebx: PIC table pointer
// edx: receiver klass
// tos: return address of polymorphic send in compiled code
masm->bind(loop);
for (int i = 0; i < pic_size; i++) {
// compare receiver klass with klass in PIC table at index
masm->cmpl(edx, Address(ebx, i * PIC::PIC_methodOop_entry_size + PIC::PIC_methodOop_klass_offset));
masm->movl(ecx, Address(ebx, i * PIC::PIC_methodOop_entry_size + PIC::PIC_methodOop_offset));
masm->jcc(Assembler::equal, found);
}
assert(ic_normal_lookup_entry() != NULL, "ic_normal_lookup_entry must be generated before");
masm->jmp(ic_normal_lookup_entry(), relocInfo::runtime_call_type);
return entry_point;
}
开发者ID:sebkirche,项目名称:strongtalk,代码行数:62,代码来源:stubRoutines.cpp
示例4: Address
Address operator&(uintptr_t mask) const {
return Address(reinterpret_cast<void*>(address_ & mask));
}
开发者ID:Energy0124,项目名称:rubinius,代码行数:3,代码来源:address.hpp
示例5: compileSetupVarargsFrame
void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned callLinkInfoIndex)
{
int callee = instruction[2].u.operand;
/* Caller always:
- Updates callFrameRegister to callee callFrame.
- Initializes ArgumentCount; CallerFrame; Callee.
For a JS call:
- Callee initializes ReturnPC; CodeBlock.
- Callee restores callFrameRegister before return.
For a non-JS call:
- Caller initializes ReturnPC; CodeBlock.
- Caller restores callFrameRegister after return.
*/
CallLinkInfo* info;
if (opcodeID != op_call_eval)
info = m_codeBlock->addCallLinkInfo();
if (opcodeID == op_call_varargs || opcodeID == op_construct_varargs)
compileSetupVarargsFrame(instruction, info);
else {
int argCount = instruction[3].u.operand;
int registerOffset = -instruction[4].u.operand;
if (opcodeID == op_call && shouldEmitProfiling()) {
emitLoad(registerOffset + CallFrame::argumentOffsetIncludingThis(0), regT0, regT1);
Jump done = branch32(NotEqual, regT0, TrustedImm32(JSValue::CellTag));
loadPtr(Address(regT1, JSCell::structureIDOffset()), regT1);
storePtr(regT1, instruction[OPCODE_LENGTH(op_call) - 2].u.arrayProfile->addressOfLastSeenStructureID());
done.link(this);
}
addPtr(TrustedImm32(registerOffset * sizeof(Register) + sizeof(CallerFrameAndPC)), callFrameRegister, stackPointerRegister);
store32(TrustedImm32(argCount), Address(stackPointerRegister, JSStack::ArgumentCount * static_cast<int>(sizeof(Register)) + PayloadOffset - sizeof(CallerFrameAndPC)));
} // SP holds newCallFrame + sizeof(CallerFrameAndPC), with ArgumentCount initialized.
uint32_t locationBits = CallSiteIndex(instruction).bits();
store32(TrustedImm32(locationBits), tagFor(JSStack::ArgumentCount, callFrameRegister));
emitLoad(callee, regT1, regT0); // regT1, regT0 holds callee.
store32(regT0, Address(stackPointerRegister, JSStack::Callee * static_cast<int>(sizeof(Register)) + PayloadOffset - sizeof(CallerFrameAndPC)));
store32(regT1, Address(stackPointerRegister, JSStack::Callee * static_cast<int>(sizeof(Register)) + TagOffset - sizeof(CallerFrameAndPC)));
if (opcodeID == op_call_eval) {
compileCallEval(instruction);
return;
}
addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag)));
DataLabelPtr addressOfLinkedFunctionCheck;
Jump slowCase = branchPtrWithPatch(NotEqual, regT0, addressOfLinkedFunctionCheck, TrustedImmPtr(0));
addSlowCase(slowCase);
ASSERT(m_callCompilationInfo.size() == callLinkInfoIndex);
info->setUpCall(CallLinkInfo::callTypeFor(opcodeID), CodeOrigin(m_bytecodeOffset), regT0);
m_callCompilationInfo.append(CallCompilationInfo());
m_callCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck;
m_callCompilationInfo[callLinkInfoIndex].callLinkInfo = info;
checkStackPointerAlignment();
m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, stackPointerRegister);
checkStackPointerAlignment();
sampleCodeBlock(m_codeBlock);
emitPutCallResult(instruction);
}
开发者ID:nickooms,项目名称:webkit,代码行数:72,代码来源:JITCall32_64.cpp
示例6: switch
AssemblyHelpers::JumpList AssemblyHelpers::branchIfNotType(
JSValueRegs regs, GPRReg tempGPR, const InferredType::Descriptor& descriptor, TagRegistersMode mode)
{
AssemblyHelpers::JumpList result;
switch (descriptor.kind()) {
case InferredType::Bottom:
result.append(jump());
break;
case InferredType::Boolean:
result.append(branchIfNotBoolean(regs, tempGPR));
break;
case InferredType::Other:
result.append(branchIfNotOther(regs, tempGPR));
break;
case InferredType::Int32:
result.append(branchIfNotInt32(regs, mode));
break;
case InferredType::Number:
result.append(branchIfNotNumber(regs, tempGPR, mode));
break;
case InferredType::String:
result.append(branchIfNotCell(regs, mode));
result.append(branchIfNotString(regs.payloadGPR()));
break;
case InferredType::ObjectWithStructure:
result.append(branchIfNotCell(regs, mode));
result.append(
branchStructure(
NotEqual,
Address(regs.payloadGPR(), JSCell::structureIDOffset()),
descriptor.structure()));
break;
case InferredType::ObjectWithStructureOrOther: {
Jump ok = branchIfOther(regs, tempGPR);
result.append(branchIfNotCell(regs, mode));
result.append(
branchStructure(
NotEqual,
Address(regs.payloadGPR(), JSCell::structureIDOffset()),
descriptor.structure()));
ok.link(this);
break;
}
case InferredType::Object:
result.append(branchIfNotCell(regs, mode));
result.append(branchIfNotObject(regs.payloadGPR()));
break;
case InferredType::ObjectOrOther: {
Jump ok = branchIfOther(regs, tempGPR);
result.append(branchIfNotCell(regs, mode));
result.append(branchIfNotObject(regs.payloadGPR()));
ok.link(this);
break;
}
case InferredType::Top:
break;
}
return result;
}
开发者ID:rodrigo-speller,项目名称:webkit,代码行数:71,代码来源:AssemblyHelpers.cpp
示例7: get
Address get(T offset) const {
return Address(reinterpret_cast<uintptr_t>(m_ptr)+offset);
}
开发者ID:musivian,项目名称:Source2Gen,代码行数:3,代码来源:Address.hpp
示例8: main
int main(int argc, const char * argv[])
{
Buffer buffer;
Storage disk;
Record::buffer=&buffer;
Bptree_node::buffer=&buffer;
Bptree::buffer=&buffer;
Record record;
Table_info table;
table.table_name="friendg";
table.database="zyh";
Attribute attribute;
Tuple_data tuple_data(90);
Tuple_info tuple;
table.tuple_size=21;
attribute.type=SQL_INT;
attribute.size=4;
table.attribute_list.push_back(attribute);
attribute.type=SQL_STRING;
attribute.size=6;
table.attribute_list.push_back(attribute);
attribute.type=SQL_STRING;
attribute.size=4;
table.attribute_list.push_back(attribute);
attribute.type=SQL_STRING;
attribute.size=3;
table.attribute_list.push_back(attribute);
attribute.attribute_name="result";
attribute.type=SQL_FLOAT;
attribute.size=4;
table.attribute_list.push_back(attribute);
tuple.info.push_back("44");
tuple.info.push_back("abcde");
tuple.info.push_back("ac");
tuple.info.push_back("ac");
tuple.info.push_back("44.4");
Tuple_info tuple_unpack;
for (int i=0;i<5;i++)
tuple_unpack.info.push_back("");
try
{
record.pack(table,tuple,&tuple_data);
}
catch (Error error)
{
error.print_error();
}
printf("before unpack\n");
printf("\n");
record.unpack(table,&tuple_unpack,&tuple_data);
for (int i=0;i<5;i++)
std::cout<<tuple_unpack.info[i]<<std::endl;
for (int i=0;i<30;i++)
printf("%X ",tuple_data.data[i]);
printf("\n");
Storage storage;
record.create_table(table);
record.insert_tuple(table, tuple_unpack);
record.insert_tuple(table, tuple_unpack);
record.insert_tuple(table, tuple_unpack);
Address del_address;
del_address=record.int_to_address(table, 12);
record.delete_tuple(table, del_address);
del_address=record.int_to_address(table, 41);
record.delete_tuple(table, del_address);
record.insert_tuple(table, tuple_unpack);
Tuple_info new_tuple;
new_tuple.info.push_back("55");
new_tuple.info.push_back("qqqq");
new_tuple.info.push_back("ac");
new_tuple.info.push_back("ac");
new_tuple.info.push_back("32.2");
record.insert_tuple(table, new_tuple);
Tuple_info get_tuple(5);
Address next_address;
record.get_first_tuple(table, &get_tuple, &next_address);
while (!(next_address.block_offset==0 && next_address.file_offset==0))
{
for (int i=0;i<5;i++)
{
std::cout<<get_tuple.info[i]<<std::endl;
}
std::cout<<"next"<<std::endl;
Address address=next_address;
record.get_tuple(table, address,&get_tuple, &next_address);
}
for (int i=0;i<5;i++)
{
std::cout<<get_tuple.info[i]<<std::endl;
}
Bptree bptree;
Table_info table2;
table2.table_name="friendindex";
table2.database="zyh";
table2.tuple_size=2400;
attribute.type=SQL_STRING;
attribute.size=2400;
table2.attribute_list.push_back(attribute);
// Tuple_info tuple2;
// Address add;
//.........这里部分代码省略.........
开发者ID:denil1111,项目名称:ZJU_MiniSQL,代码行数:101,代码来源:main.cpp
示例9: Address
Address Address::rootAddress()
{
return Address();
}
开发者ID:Sciss,项目名称:i-score,代码行数:4,代码来源:Address.cpp
示例10: pc
address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) {
// rbx,: Method*
// rcx: scratrch
// rsi: sender sp
if (!InlineIntrinsics) return NULL; // Generate a vanilla entry
address entry_point = __ pc();
// These don't need a safepoint check because they aren't virtually
// callable. We won't enter these intrinsics from compiled code.
// If in the future we added an intrinsic which was virtually callable
// we'd have to worry about how to safepoint so that this code is used.
// mathematical functions inlined by compiler
// (interpreter must provide identical implementation
// in order to avoid monotonicity bugs when switching
// from interpreter to compiler in the middle of some
// computation)
//
// stack: [ ret adr ] <-- rsp
// [ lo(arg) ]
// [ hi(arg) ]
//
if (kind == Interpreter::java_lang_math_fmaD) {
__ movdbl(xmm2, Address(rsp, 5 * wordSize));
__ movdbl(xmm1, Address(rsp, 3 * wordSize));
__ movdbl(xmm0, Address(rsp, 1 * wordSize));
__ fmad(xmm0, xmm1, xmm2, xmm0);
__ pop(rdi); // get return address
__ mov(rsp, rsi); // set sp to sender sp
__ jmp(rdi);
return entry_point;
} else if (kind == Interpreter::java_lang_math_fmaF) {
__ movflt(xmm2, Address(rsp, 3 * wordSize));
__ movflt(xmm1, Address(rsp, 2 * wordSize));
__ movflt(xmm0, Address(rsp, 1 * wordSize));
__ fmaf(xmm0, xmm1, xmm2, xmm0);
__ pop(rdi); // get return address
__ mov(rsp, rsi); // set sp to sender sp
__ jmp(rdi);
return entry_point;
}
__ fld_d(Address(rsp, 1*wordSize));
switch (kind) {
case Interpreter::java_lang_math_sin :
__ subptr(rsp, 2 * wordSize);
__ fstp_d(Address(rsp, 0));
if (VM_Version::supports_sse2() && StubRoutines::dsin() != NULL) {
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dsin())));
} else {
__ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dsin));
}
__ addptr(rsp, 2 * wordSize);
break;
case Interpreter::java_lang_math_cos :
__ subptr(rsp, 2 * wordSize);
__ fstp_d(Address(rsp, 0));
if (VM_Version::supports_sse2() && StubRoutines::dcos() != NULL) {
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dcos())));
} else {
__ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dcos));
}
__ addptr(rsp, 2 * wordSize);
break;
case Interpreter::java_lang_math_tan :
__ subptr(rsp, 2 * wordSize);
__ fstp_d(Address(rsp, 0));
if (StubRoutines::dtan() != NULL) {
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dtan())));
} else {
__ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dtan));
}
__ addptr(rsp, 2 * wordSize);
break;
case Interpreter::java_lang_math_sqrt:
__ fsqrt();
break;
case Interpreter::java_lang_math_abs:
__ fabs();
break;
case Interpreter::java_lang_math_log:
__ subptr(rsp, 2 * wordSize);
__ fstp_d(Address(rsp, 0));
if (StubRoutines::dlog() != NULL) {
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog())));
} else {
__ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dlog));
}
__ addptr(rsp, 2 * wordSize);
break;
case Interpreter::java_lang_math_log10:
__ subptr(rsp, 2 * wordSize);
__ fstp_d(Address(rsp, 0));
if (StubRoutines::dlog10() != NULL) {
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog10())));
//.........这里部分代码省略.........
开发者ID:netroby,项目名称:jdk9-dev,代码行数:101,代码来源:templateInterpreterGenerator_x86_32.cpp
示例11: killLastResultRegister
void JIT::compileLoadVarargs(Instruction* instruction)
{
int thisValue = instruction[2].u.operand;
int arguments = instruction[3].u.operand;
int firstFreeRegister = instruction[4].u.operand;
killLastResultRegister();
JumpList slowCase;
JumpList end;
bool canOptimize = m_codeBlock->usesArguments()
&& arguments == m_codeBlock->argumentsRegister()
&& !m_codeBlock->symbolTable()->slowArguments();
if (canOptimize) {
emitGetVirtualRegister(arguments, regT0);
slowCase.append(branch64(NotEqual, regT0, TrustedImm64(JSValue::encode(JSValue()))));
emitGetFromCallFrameHeader32(JSStack::ArgumentCount, regT0);
slowCase.append(branch32(Above, regT0, TrustedImm32(Arguments::MaxArguments + 1)));
// regT0: argumentCountIncludingThis
move(regT0, regT1);
add32(TrustedImm32(firstFreeRegister + JSStack::CallFrameHeaderSize), regT1);
lshift32(TrustedImm32(3), regT1);
addPtr(callFrameRegister, regT1);
// regT1: newCallFrame
slowCase.append(branchPtr(Below, AbsoluteAddress(m_vm->interpreter->stack().addressOfEnd()), regT1));
// Initialize ArgumentCount.
store32(regT0, Address(regT1, JSStack::ArgumentCount * static_cast<int>(sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)));
// Initialize 'this'.
emitGetVirtualRegister(thisValue, regT2);
store64(regT2, Address(regT1, CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))));
// Copy arguments.
neg32(regT0);
signExtend32ToPtr(regT0, regT0);
end.append(branchAdd64(Zero, TrustedImm32(1), regT0));
// regT0: -argumentCount
Label copyLoop = label();
load64(BaseIndex(callFrameRegister, regT0, TimesEight, CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))), regT2);
store64(regT2, BaseIndex(regT1, regT0, TimesEight, CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))));
branchAdd64(NonZero, TrustedImm32(1), regT0).linkTo(copyLoop, this);
end.append(jump());
}
if (canOptimize)
slowCase.link(this);
JITStubCall stubCall(this, cti_op_load_varargs);
stubCall.addArgument(thisValue, regT0);
stubCall.addArgument(arguments, regT0);
stubCall.addArgument(Imm32(firstFreeRegister));
stubCall.call(regT1);
if (canOptimize)
end.link(this);
}
开发者ID:BennyH26,项目名称:phantomjs,代码行数:63,代码来源:JITCall.cpp
示例12: Address
TObject *luaA_Address(lua_Object o) {
return Address(o);
}
开发者ID:jvprat,项目名称:residual,代码行数:3,代码来源:lapi.cpp
示例13: lua_isnil
int32 lua_isnil(lua_Object o) {
return (o == LUA_NOOBJECT) || (ttype(Address(o)) == LUA_T_NIL);
}
开发者ID:jvprat,项目名称:residual,代码行数:3,代码来源:lapi.cpp
示例14: lua_currentline
int32 lua_currentline(lua_Function func) {
TObject *f = Address(func);
return (f + 1 < lua_state->stack.top && (f + 1)->ttype == LUA_T_LINE) ? (f + 1)->value.i : -1;
}
开发者ID:jvprat,项目名称:residual,代码行数:4,代码来源:lapi.cpp
示例15: lua_istable
int32 lua_istable(lua_Object o) {
return (o != LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_ARRAY);
}
开发者ID:jvprat,项目名称:residual,代码行数:3,代码来源:lapi.cpp
示例16: buffer
void OptoRuntime::generate_exception_blob() {
// Capture info about frame layout
enum layout {
thread_off, // last_java_sp
// The frame sender code expects that rbp will be in the "natural" place and
// will override any oopMap setting for it. We must therefore force the layout
// so that it agrees with the frame sender code.
rbp_off,
return_off, // slot for return address
framesize
};
// allocate space for the code
ResourceMark rm;
// setup code generation tools
CodeBuffer buffer("exception_blob", 512, 512);
MacroAssembler* masm = new MacroAssembler(&buffer);
OopMapSet *oop_maps = new OopMapSet();
address start = __ pc();
__ push(rdx);
__ subptr(rsp, return_off * wordSize); // Prolog!
// rbp, location is implicitly known
__ movptr(Address(rsp,rbp_off *wordSize), rbp);
// Store exception in Thread object. We cannot pass any arguments to the
// handle_exception call, since we do not want to make any assumption
// about the size of the frame where the exception happened in.
__ get_thread(rcx);
__ movptr(Address(rcx, JavaThread::exception_oop_offset()), rax);
__ movptr(Address(rcx, JavaThread::exception_pc_offset()), rdx);
// This call does all the hard work. It checks if an exception handler
// exists in the method.
// If so, it returns the handler address.
// If not, it prepares for stack-unwinding, restoring the callee-save
// registers of the frame being removed.
//
__ movptr(Address(rsp, thread_off * wordSize), rcx); // Thread is first argument
__ set_last_Java_frame(rcx, noreg, noreg, NULL);
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, OptoRuntime::handle_exception_C)));
// No registers to map, rbp is known implicitly
oop_maps->add_gc_map( __ pc() - start, new OopMap( framesize, 0 ));
__ get_thread(rcx);
__ reset_last_Java_frame(rcx, false, false);
// Restore callee-saved registers
__ movptr(rbp, Address(rsp, rbp_off * wordSize));
__ addptr(rsp, return_off * wordSize); // Epilog!
__ pop(rdx); // Exception pc
// rax: exception handler for given <exception oop/exception pc>
// Restore SP from BP if the exception PC is a MethodHandle call.
__ cmpl(Address(rcx, JavaThread::is_method_handle_exception_offset()), 0);
__ cmovptr(Assembler::notEqual, rsp, rbp);
// We have a handler in rax, (could be deopt blob)
// rdx - throwing pc, deopt blob will need it.
__ push(rax);
// Get the exception
__ movptr(rax, Address(rcx, JavaThread::exception_oop_offset()));
// Get the exception pc in case we are deoptimized
__ movptr(rdx, Address(rcx, JavaThread::exception_pc_offset()));
#ifdef ASSERT
__ movptr(Address(rcx, JavaThread::exception_handler_pc_offset()), NULL_WORD);
__ movptr(Address(rcx, JavaThread::exception_pc_offset()), NULL_WORD);
#endif
// Clear the exception oop so GC no longer processes it as a root.
__ movptr(Address(rcx, JavaThread::exception_oop_offset()), NULL_WORD);
__ pop(rcx);
// rax: exception oop
// rcx: exception handler
// rdx: exception pc
__ jmp (rcx);
// -------------
// make sure all code is generated
masm->flush();
_exception_blob = ExceptionBlob::create(&buffer, oop_maps, framesize);
}
开发者ID:AllenWeb,项目名称:openjdk-1,代码行数:93,代码来源:runtime_x86_32.cpp
示例17: lua_isuserdata
int32 lua_isuserdata(lua_Object o) {
return (o != LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_USERDATA);
}
开发者ID:jvprat,项目名称:residual,代码行数:3,代码来源:lapi.cpp
示例18: lua_isnumber
int32 lua_isnumber(lua_Object o) {
return (o!= LUA_NOOBJECT) && (tonumber(Address(o)) == 0);
}
开发者ID:jvprat,项目名称:residual,代码行数:3,代码来源:lapi.cpp
示例19: RBX_MEMORY_ALIGN
Address operator-(int change) const {
change = RBX_MEMORY_ALIGN(change);
return Address(reinterpret_cast<void*>(address_ - change));
}
开发者ID:Energy0124,项目名称:rubinius,代码行数:4,代码来源:address.hpp
示例20: return
const char *lua_getstring (lua_Object object) {
if (object == LUA_NOOBJECT || tostring(Address(object)))
return NULL;
else
return (svalue(Address(object)));
}
开发者ID:jvprat,项目名称:residual,代码行数:6,代码来源:lapi.cpp
注:本文中的Address函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论