Index: src/x64/full-codegen-x64.cc |
=================================================================== |
--- src/x64/full-codegen-x64.cc (revision 8463) |
+++ src/x64/full-codegen-x64.cc (working copy) |
@@ -78,16 +78,18 @@ |
} |
void EmitPatchInfo() { |
- int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(&patch_site_); |
- ASSERT(is_int8(delta_to_patch_site)); |
- __ testl(rax, Immediate(delta_to_patch_site)); |
+ if (patch_site_.is_bound()) { |
+ int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(&patch_site_); |
+ ASSERT(is_int8(delta_to_patch_site)); |
+ __ testl(rax, Immediate(delta_to_patch_site)); |
#ifdef DEBUG |
- info_emitted_ = true; |
+ info_emitted_ = true; |
#endif |
+ } else { |
+ __ nop(); // Signals no inlined code. |
+ } |
} |
- bool is_bound() const { return patch_site_.is_bound(); } |
- |
private: |
// jc will be patched with jz, jnc will become jnz. |
void EmitJump(Condition cc, Label* target, Label::Distance near_jump) { |
@@ -822,7 +824,8 @@ |
// Record position before stub call for type feedback. |
SetSourcePosition(clause->position()); |
Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT); |
- EmitCallIC(ic, &patch_site, clause->CompareId()); |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId()); |
+ patch_site.EmitPatchInfo(); |
__ testq(rax, rax); |
__ j(not_equal, &next_test); |
@@ -1636,7 +1639,8 @@ |
__ bind(&stub_call); |
__ movq(rax, rcx); |
BinaryOpStub stub(op, mode); |
- EmitCallIC(stub.GetCode(), &patch_site, expr->id()); |
+ EmitCallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id()); |
+ patch_site.EmitPatchInfo(); |
__ jmp(&done, Label::kNear); |
__ bind(&smi_case); |
@@ -1683,8 +1687,9 @@ |
OverwriteMode mode) { |
__ pop(rdx); |
BinaryOpStub stub(op, mode); |
- // NULL signals no inlined smi code. |
- EmitCallIC(stub.GetCode(), NULL, expr->id()); |
+ JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
+ EmitCallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id()); |
+ patch_site.EmitPatchInfo(); |
context()->Plug(rax); |
} |
@@ -3795,7 +3800,8 @@ |
__ movq(rdx, rax); |
__ Move(rax, Smi::FromInt(1)); |
} |
- EmitCallIC(stub.GetCode(), &patch_site, expr->CountId()); |
+ EmitCallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->CountId()); |
+ patch_site.EmitPatchInfo(); |
__ bind(&done); |
// Store the value returned in rax. |
@@ -4067,7 +4073,8 @@ |
// Record position and call the compare IC. |
SetSourcePosition(expr->position()); |
Handle<Code> ic = CompareIC::GetUninitialized(op); |
- EmitCallIC(ic, &patch_site, expr->id()); |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id()); |
+ patch_site.EmitPatchInfo(); |
PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
__ testq(rax, rax); |
@@ -4131,54 +4138,10 @@ |
unsigned ast_id) { |
ASSERT(mode == RelocInfo::CODE_TARGET || |
mode == RelocInfo::CODE_TARGET_CONTEXT); |
- Counters* counters = isolate()->counters(); |
- 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, ast_id); |
} |
-void FullCodeGenerator::EmitCallIC(Handle<Code> ic, |
- JumpPatchSite* patch_site, |
- unsigned ast_id) { |
- Counters* counters = isolate()->counters(); |
- 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, RelocInfo::CODE_TARGET, ast_id); |
- if (patch_site != NULL && patch_site->is_bound()) { |
- patch_site->EmitPatchInfo(); |
- } else { |
- __ nop(); // Signals no inlined code. |
- } |
-} |
- |
- |
void FullCodeGenerator::StoreToFrameField(int frame_offset, Register value) { |
ASSERT(IsAligned(frame_offset, kPointerSize)); |
__ movq(Operand(rbp, frame_offset), value); |