X64: Add Crankshaft operation LoadGlobal.

Copied some serializer-related checks and counters from ia32.

Review URL: http://codereview.chromium.org/6312186

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6667 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
lrn@chromium.org 2011-02-07 14:15:05 +00:00
parent 596b25511d
commit 254915608e
3 changed files with 43 additions and 9 deletions

View File

@ -3076,10 +3076,15 @@ void Assembler::dd(uint32_t data) {
void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
ASSERT(rmode != RelocInfo::NONE);
// Don't record external references unless the heap will be serialized.
if (rmode == RelocInfo::EXTERNAL_REFERENCE &&
!Serializer::enabled() &&
!FLAG_debug_code) {
return;
if (rmode == RelocInfo::EXTERNAL_REFERENCE) {
#ifdef DEBUG
if (!Serializer::enabled()) {
Serializer::TooLateToEnableNow();
}
#endif
if (!Serializer::enabled() && !FLAG_debug_code) {
return;
}
}
RelocInfo rinfo(pc_, rmode, data);
reloc_info_writer.Write(&rinfo);

View File

@ -3575,10 +3575,30 @@ Register FullCodeGenerator::context_register() {
void FullCodeGenerator::EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode) {
ASSERT(mode == RelocInfo::CODE_TARGET ||
mode == RelocInfo::CODE_TARGET_CONTEXT);
switch (ic->kind()) {
case Code::LOAD_IC:
__ IncrementCounter(&Counters::named_load_full, 1);
break;
case Code::KEYED_LOAD_IC:
__ IncrementCounter(&Counters::keyed_load_full, 1);
break;
case Code::STORE_IC:
__ IncrementCounter(&Counters::named_store_full, 1);
break;
case Code::KEYED_STORE_IC:
__ IncrementCounter(&Counters::keyed_store_full, 1);
default:
break;
}
__ call(ic, mode);
// Crankshaft doesn't need patching of inlined loads and stores.
if (V8::UseCrankshaft()) return;
// When compiling the snapshot we need to produce code that works
// with and without Crankshaft.
if (V8::UseCrankshaft() && !Serializer::enabled()) {
return;
}
// If we're calling a (keyed) load or store stub, we have to mark
// the call as containing no inlined code so we will not attempt to

View File

@ -1516,7 +1516,18 @@ void LCodeGen::DoReturn(LReturn* instr) {
void LCodeGen::DoLoadGlobal(LLoadGlobal* instr) {
Abort("Unimplemented: %s", "DoLoadGlobal");
Register result = ToRegister(instr->result());
if (result.is(rax)) {
__ load_rax(instr->hydrogen()->cell().location(),
RelocInfo::GLOBAL_PROPERTY_CELL);
} else {
__ movq(result, instr->hydrogen()->cell(), RelocInfo::GLOBAL_PROPERTY_CELL);
__ movq(result, Operand(result, 0));
}
if (instr->hydrogen()->check_hole_value()) {
__ CompareRoot(result, Heap::kTheHoleValueRootIndex);
DeoptimizeIf(equal, instr->environment());
}
}
@ -1534,9 +1545,7 @@ void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) {
// been deleted from the property dictionary. In that case, we need
// to update the property details in the property dictionary to mark
// it as no longer deleted. We deoptimize in that case.
__ movq(temp,
Handle<Object>::cast(instr->hydrogen()->cell()),
RelocInfo::GLOBAL_PROPERTY_CELL);
__ movq(temp, instr->hydrogen()->cell(), RelocInfo::GLOBAL_PROPERTY_CELL);
if (check_hole) {
__ CompareRoot(Operand(temp, 0), Heap::kTheHoleValueRootIndex);
DeoptimizeIf(equal, instr->environment());