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
Code* code = Code::cast(code_[i]);
Address pc = code->instruction_start() + pc_[i];
bool is_pc_relative = Bootstrapper::FixupFlagsIsPCRelative::decode(flags);
- if (is_pc_relative) {
- Assembler::set_target_address_at(pc, f->code()->instruction_start());
+ bool use_code_object = Bootstrapper::FixupFlagsUseCodeObject::decode(flags);
+
+ if (use_code_object) {
+ if (is_pc_relative) {
+ Assembler::set_target_address_at(
+ pc, reinterpret_cast<Address>(f->code()));
+ } else {
+ *reinterpret_cast<Object**>(pc) = f->code();
+ }
} else {
- *reinterpret_cast<Object**>(pc) = f->code();
+ ASSERT(is_pc_relative);
+ Assembler::set_target_address_at(pc, f->code()->instruction_start());
}
+
LOG(StringEvent("resolved", name));
}
Clear();
// 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
// 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);
}
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);
}
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));
}
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);
}
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);
}