Chromium Code Reviews| Index: src/arm/full-codegen-arm.cc |
| =================================================================== |
| --- src/arm/full-codegen-arm.cc (revision 8463) |
| +++ src/arm/full-codegen-arm.cc (working copy) |
| @@ -92,17 +92,19 @@ |
| } |
| void EmitPatchInfo() { |
| - int delta_to_patch_site = masm_->InstructionsGeneratedSince(&patch_site_); |
| - Register reg; |
| - reg.set_code(delta_to_patch_site / kOff12Mask); |
| - __ cmp_raw_immediate(reg, delta_to_patch_site % kOff12Mask); |
| + if (patch_site_.is_bound()) { |
| + int delta_to_patch_site = masm_->InstructionsGeneratedSince(&patch_site_); |
| + Register reg; |
| + reg.set_code(delta_to_patch_site / kOff12Mask); |
| + __ cmp_raw_immediate(reg, delta_to_patch_site % kOff12Mask); |
| #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: |
| MacroAssembler* masm_; |
| Label patch_site_; |
| @@ -860,7 +862,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()); |
|
fschneider
2011/06/29 13:00:39
I'd still prefer statically helping to never forge
Sven Panne
2011/06/29 13:16:43
After some semi-religious offline discussions invo
|
| + patch_site.EmitPatchInfo(); |
| __ cmp(r0, Operand(0)); |
| __ b(ne, &next_test); |
| @@ -1689,7 +1692,8 @@ |
| __ bind(&stub_call); |
| BinaryOpStub stub(op, mode); |
| - EmitCallIC(stub.GetCode(), &patch_site, expr->id()); |
| + EmitCallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id()); |
| + patch_site.EmitPatchInfo(); |
| __ jmp(&done); |
| __ bind(&smi_case); |
| @@ -1770,7 +1774,9 @@ |
| OverwriteMode mode) { |
| __ pop(r1); |
| BinaryOpStub stub(op, mode); |
| - 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(r0); |
| } |
| @@ -3853,7 +3859,8 @@ |
| SetSourcePosition(expr->position()); |
| BinaryOpStub stub(Token::ADD, NO_OVERWRITE); |
| - 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 r0. |
| @@ -4126,7 +4133,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); |
| __ cmp(r0, Operand(0)); |
| Split(cond, if_true, if_false, fall_through); |
| @@ -4192,62 +4200,15 @@ |
| 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, r1, r2); |
| - break; |
| - case Code::KEYED_LOAD_IC: |
| - __ IncrementCounter(counters->keyed_load_full(), 1, r1, r2); |
| - break; |
| - case Code::STORE_IC: |
| - __ IncrementCounter(counters->named_store_full(), 1, r1, r2); |
| - break; |
| - case Code::KEYED_STORE_IC: |
| - __ IncrementCounter(counters->keyed_store_full(), 1, r1, r2); |
| - default: |
| - break; |
| + if (StatsCounter* counter = ic->Counter(isolate())) { |
|
fschneider
2011/06/29 13:00:39
Do we really need those counters at all? We don't
Sven Panne
2011/06/29 13:16:43
OK, I'll nuke those 4 counters then.
|
| + __ IncrementCounter(counter, 1, r1, r2); |
| } |
| if (ast_id == kNoASTId || mode == RelocInfo::CODE_TARGET_CONTEXT) { |
| __ Call(ic, mode); |
| } else { |
| ASSERT(mode == RelocInfo::CODE_TARGET); |
| - mode = RelocInfo::CODE_TARGET_WITH_ID; |
| - __ CallWithAstId(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, r1, r2); |
| - break; |
| - case Code::KEYED_LOAD_IC: |
| - __ IncrementCounter(counters->keyed_load_full(), 1, r1, r2); |
| - break; |
| - case Code::STORE_IC: |
| - __ IncrementCounter(counters->named_store_full(), 1, r1, r2); |
| - break; |
| - case Code::KEYED_STORE_IC: |
| - __ IncrementCounter(counters->keyed_store_full(), 1, r1, r2); |
| - default: |
| - break; |
| - } |
| - |
| - if (ast_id == kNoASTId) { |
| - __ Call(ic, RelocInfo::CODE_TARGET); |
| - } else { |
| __ CallWithAstId(ic, RelocInfo::CODE_TARGET_WITH_ID, ast_id); |
| } |
| - if (patch_site != NULL && patch_site->is_bound()) { |
| - patch_site->EmitPatchInfo(); |
| - } else { |
| - __ nop(); // Signals no inlined code. |
| - } |
| } |