Fix CALL_NON_FUNCTION.
Using two flags to specify the state of targets: 1) FixupIsPCRelative specifies where to patch (relative to pc or at pc); 2) FixupUseCodeObject specifies what to patch (code object or start address). Review URL: http://codereview.chromium.org/10233 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@727 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
b14a2e4cb7
commit
3ccdce6d83
@ -205,11 +205,20 @@ bool PendingFixups::Process(Handle<JSBuiltinsObject> builtins) {
|
||||
Code* code = Code::cast(code_[i]);
|
||||
Address pc = code->instruction_start() + pc_[i];
|
||||
bool is_pc_relative = Bootstrapper::FixupFlagsIsPCRelative::decode(flags);
|
||||
bool use_code_object = Bootstrapper::FixupFlagsUseCodeObject::decode(flags);
|
||||
|
||||
if (use_code_object) {
|
||||
if (is_pc_relative) {
|
||||
Assembler::set_target_address_at(pc, f->code()->instruction_start());
|
||||
Assembler::set_target_address_at(
|
||||
pc, reinterpret_cast<Address>(f->code()));
|
||||
} else {
|
||||
*reinterpret_cast<Object**>(pc) = f->code();
|
||||
}
|
||||
} else {
|
||||
ASSERT(is_pc_relative);
|
||||
Assembler::set_target_address_at(pc, f->code()->instruction_start());
|
||||
}
|
||||
|
||||
LOG(StringEvent("resolved", name));
|
||||
}
|
||||
Clear();
|
||||
|
@ -66,7 +66,8 @@ class Bootstrapper : public AllStatic {
|
||||
|
||||
// Encoding/decoding support for fixup flags.
|
||||
class FixupFlagsIsPCRelative: public BitField<bool, 0, 1> {};
|
||||
class FixupFlagsArgumentsCount: public BitField<uint32_t, 1, 32-1> {};
|
||||
class FixupFlagsUseCodeObject: public BitField<bool, 1, 1> {};
|
||||
class FixupFlagsArgumentsCount: public BitField<uint32_t, 2, 32-2> {};
|
||||
};
|
||||
|
||||
}} // namespace v8::internal
|
||||
|
@ -4283,7 +4283,10 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
|
||||
// Slow-case: Non-function called.
|
||||
__ bind(&slow);
|
||||
__ mov(r0, Operand(argc_)); // Setup the number of arguments.
|
||||
__ InvokeBuiltin(Builtins::CALL_NON_FUNCTION, JUMP_JS);
|
||||
__ mov(r2, Operand(0));
|
||||
__ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION);
|
||||
__ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)),
|
||||
RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
|
||||
|
@ -818,7 +818,8 @@ void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id,
|
||||
int argc = Builtins::GetArgumentsCount(id);
|
||||
uint32_t flags =
|
||||
Bootstrapper::FixupFlagsArgumentsCount::encode(argc) |
|
||||
Bootstrapper::FixupFlagsIsPCRelative::encode(true);
|
||||
Bootstrapper::FixupFlagsIsPCRelative::encode(true) |
|
||||
Bootstrapper::FixupFlagsUseCodeObject::encode(false);
|
||||
Unresolved entry = { pc_offset() - sizeof(Instr), flags, name };
|
||||
unresolved_.Add(entry);
|
||||
}
|
||||
@ -835,10 +836,13 @@ void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) {
|
||||
int argc = Builtins::GetArgumentsCount(id);
|
||||
uint32_t flags =
|
||||
Bootstrapper::FixupFlagsArgumentsCount::encode(argc) |
|
||||
Bootstrapper::FixupFlagsIsPCRelative::encode(true);
|
||||
Bootstrapper::FixupFlagsIsPCRelative::encode(true) |
|
||||
Bootstrapper::FixupFlagsUseCodeObject::encode(true);
|
||||
Unresolved entry = { pc_offset() - sizeof(Instr), flags, name };
|
||||
unresolved_.Add(entry);
|
||||
}
|
||||
|
||||
add(target, target, Operand(Code::kHeaderSize - kHeapObjectTag));
|
||||
}
|
||||
|
||||
|
||||
|
@ -873,7 +873,8 @@ void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag) {
|
||||
if (!resolved) {
|
||||
uint32_t flags =
|
||||
Bootstrapper::FixupFlagsArgumentsCount::encode(argc) |
|
||||
Bootstrapper::FixupFlagsIsPCRelative::encode(true);
|
||||
Bootstrapper::FixupFlagsIsPCRelative::encode(true) |
|
||||
Bootstrapper::FixupFlagsUseCodeObject::encode(false);
|
||||
Unresolved entry = { pc_offset() - sizeof(int32_t), flags, name };
|
||||
unresolved_.Add(entry);
|
||||
}
|
||||
@ -891,7 +892,8 @@ void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) {
|
||||
if (!resolved) {
|
||||
uint32_t flags =
|
||||
Bootstrapper::FixupFlagsArgumentsCount::encode(argc) |
|
||||
Bootstrapper::FixupFlagsIsPCRelative::encode(false);
|
||||
Bootstrapper::FixupFlagsIsPCRelative::encode(false) |
|
||||
Bootstrapper::FixupFlagsUseCodeObject::encode(true);
|
||||
Unresolved entry = { pc_offset() - sizeof(int32_t), flags, name };
|
||||
unresolved_.Add(entry);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user