Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index f6d3ea36ab8ce6e0ce21759ce369e8be34db2666..9517df9c1c41222edf28fa8a0a60acfa9bd7fdfb 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -661,7 +661,7 @@ void FullCodeGenerator::DoTest(Expression* condition, |
Label* if_false, |
Label* fall_through) { |
Handle<Code> ic = ToBooleanStub::GetUninitialized(isolate()); |
- CallIC(ic, RelocInfo::CODE_TARGET, condition->test_id()); |
+ CallIC(ic, NOT_CONTEXTUAL, condition->test_id()); |
__ tst(result_register(), result_register()); |
Split(ne, if_true, if_false, fall_through); |
} |
@@ -1022,7 +1022,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
// Record position before stub call for type feedback. |
SetSourcePosition(clause->position()); |
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), Token::EQ_STRICT); |
- CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId()); |
+ CallIC(ic, NOT_CONTEXTUAL, clause->CompareId()); |
patch_site.EmitPatchInfo(); |
__ cmp(r0, Operand::Zero()); |
@@ -1380,11 +1380,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, |
__ ldr(r0, GlobalObjectOperand()); |
__ mov(r2, Operand(var->name())); |
- RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF) |
- ? RelocInfo::CODE_TARGET |
- : RelocInfo::CODE_TARGET_CONTEXT; |
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
- CallIC(ic, mode); |
+ ContextualMode mode = (typeof_state == INSIDE_TYPEOF) |
+ ? NOT_CONTEXTUAL |
+ : CONTEXTUAL; |
+ CallLoadIC(mode); |
} |
@@ -1467,8 +1466,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { |
// object (receiver) in r0. |
__ ldr(r0, GlobalObjectOperand()); |
__ mov(r2, Operand(var->name())); |
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
- CallIC(ic, RelocInfo::CODE_TARGET_CONTEXT); |
+ CallLoadIC(CONTEXTUAL); |
context()->Plug(r0); |
break; |
} |
@@ -1677,10 +1675,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
VisitForAccumulatorValue(value); |
__ mov(r2, Operand(key->value())); |
__ ldr(r1, MemOperand(sp)); |
- Handle<Code> ic = is_classic_mode() |
- ? isolate()->builtins()->StoreIC_Initialize() |
- : isolate()->builtins()->StoreIC_Initialize_Strict(); |
- CallIC(ic, RelocInfo::CODE_TARGET, key->LiteralFeedbackId()); |
+ CallStoreIC(NOT_CONTEXTUAL, key->LiteralFeedbackId()); |
PrepareForBailoutForId(key->id(), NO_REGISTERS); |
} else { |
VisitForEffect(value); |
@@ -2088,8 +2083,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { |
__ bind(&l_loop); |
__ push(r0); // save result |
__ LoadRoot(r2, Heap::kdone_stringRootIndex); // "done" |
- Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize(); |
- CallIC(done_ic); // result.done in r0 |
+ CallLoadIC(NOT_CONTEXTUAL); // result.done in r0 |
Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
CallIC(bool_ic); |
__ cmp(r0, Operand(0)); |
@@ -2098,8 +2092,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { |
// result.value |
__ pop(r0); // result |
__ LoadRoot(r2, Heap::kvalue_stringRootIndex); // "value" |
- Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); |
- CallIC(value_ic); // result.value in r0 |
+ CallLoadIC(NOT_CONTEXTUAL); // result.value in r0 |
context()->DropAndPlug(2, r0); // drop iter and g |
break; |
} |
@@ -2248,8 +2241,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
Literal* key = prop->key()->AsLiteral(); |
__ mov(r2, Operand(key->value())); |
// Call load IC. It has arguments receiver and property name r0 and r2. |
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
- CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); |
+ CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
} |
@@ -2257,7 +2249,7 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
SetSourcePosition(prop->position()); |
// Call keyed load IC. It has arguments key and receiver in r0 and r1. |
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
- CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); |
+ CallIC(ic, NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
} |
@@ -2284,7 +2276,7 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
__ bind(&stub_call); |
BinaryOpICStub stub(op, mode); |
- CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
+ CallIC(stub.GetCode(isolate()), NOT_CONTEXTUAL, |
expr->BinaryOperationFeedbackId()); |
patch_site.EmitPatchInfo(); |
__ jmp(&done); |
@@ -2362,7 +2354,7 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
__ pop(r1); |
BinaryOpICStub stub(op, mode); |
JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
- CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
+ CallIC(stub.GetCode(isolate()), NOT_CONTEXTUAL, |
expr->BinaryOperationFeedbackId()); |
patch_site.EmitPatchInfo(); |
context()->Plug(r0); |
@@ -2401,10 +2393,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { |
__ mov(r1, r0); |
__ pop(r0); // Restore value. |
__ mov(r2, Operand(prop->key()->AsLiteral()->value())); |
- Handle<Code> ic = is_classic_mode() |
- ? isolate()->builtins()->StoreIC_Initialize() |
- : isolate()->builtins()->StoreIC_Initialize_Strict(); |
- CallIC(ic); |
+ CallStoreIC(NOT_CONTEXTUAL); |
break; |
} |
case KEYED_PROPERTY: { |
@@ -2430,11 +2419,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, |
// Global var, const, or let. |
__ mov(r2, Operand(var->name())); |
__ ldr(r1, GlobalObjectOperand()); |
- Handle<Code> ic = is_classic_mode() |
- ? isolate()->builtins()->StoreIC_Initialize() |
- : isolate()->builtins()->StoreIC_Initialize_Strict(); |
- CallIC(ic, RelocInfo::CODE_TARGET_CONTEXT); |
- |
+ CallStoreIC(CONTEXTUAL); |
} else if (op == Token::INIT_CONST) { |
// Const initializers need a write barrier. |
ASSERT(!var->IsParameter()); // No const parameters. |
@@ -2531,10 +2516,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
__ mov(r2, Operand(prop->key()->AsLiteral()->value())); |
__ pop(r1); |
- Handle<Code> ic = is_classic_mode() |
- ? isolate()->builtins()->StoreIC_Initialize() |
- : isolate()->builtins()->StoreIC_Initialize_Strict(); |
- CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); |
+ CallStoreIC(NOT_CONTEXTUAL, expr->AssignmentFeedbackId()); |
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
context()->Plug(r0); |
@@ -2551,7 +2533,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
Handle<Code> ic = is_classic_mode() |
? isolate()->builtins()->KeyedStoreIC_Initialize() |
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); |
- CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); |
+ CallIC(ic, NOT_CONTEXTUAL, expr->AssignmentFeedbackId()); |
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
context()->Plug(r0); |
@@ -2578,17 +2560,19 @@ void FullCodeGenerator::VisitProperty(Property* expr) { |
void FullCodeGenerator::CallIC(Handle<Code> code, |
- RelocInfo::Mode rmode, |
+ ContextualMode mode, |
TypeFeedbackId ast_id) { |
ic_total_count_++; |
// All calls must have a predictable size in full-codegen code to ensure that |
// the debugger can patch them correctly. |
- __ Call(code, rmode, ast_id, al, NEVER_INLINE_TARGET_ADDRESS); |
+ ASSERT(mode != CONTEXTUAL || ast_id.IsNone()); |
+ __ Call(code, RelocInfo::CODE_TARGET, ast_id, al, |
+ NEVER_INLINE_TARGET_ADDRESS); |
} |
void FullCodeGenerator::EmitCallWithIC(Call* expr, |
Handle<Object> name, |
- RelocInfo::Mode mode) { |
+ ContextualMode mode) { |
// Code common for calls using the IC. |
ZoneList<Expression*>* args = expr->arguments(); |
int arg_count = args->length(); |
@@ -2603,7 +2587,10 @@ void FullCodeGenerator::EmitCallWithIC(Call* expr, |
// Call the IC initialization code. |
Handle<Code> ic = |
isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); |
- CallIC(ic, mode, expr->CallFeedbackId()); |
+ TypeFeedbackId ast_id = mode == CONTEXTUAL |
+ ? TypeFeedbackId::None() |
+ : expr->CallFeedbackId(); |
+ CallIC(ic, mode, ast_id); |
RecordJSReturnSite(expr); |
// Restore context register. |
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
@@ -2636,7 +2623,7 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
Handle<Code> ic = |
isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); |
__ ldr(r2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. |
- CallIC(ic, RelocInfo::CODE_TARGET, expr->CallFeedbackId()); |
+ CallIC(ic, NOT_CONTEXTUAL, expr->CallFeedbackId()); |
RecordJSReturnSite(expr); |
// Restore context register. |
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
@@ -2753,7 +2740,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
// Push global object as receiver for the call IC. |
__ ldr(r0, GlobalObjectOperand()); |
__ push(r0); |
- EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); |
+ EmitCallWithIC(expr, proxy->name(), CONTEXTUAL); |
} else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
// Call to a lookup slot (dynamically introduced variable). |
Label slow, done; |
@@ -2800,7 +2787,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
if (property->key()->IsPropertyName()) { |
EmitCallWithIC(expr, |
property->key()->AsLiteral()->value(), |
- RelocInfo::CODE_TARGET); |
+ NOT_CONTEXTUAL); |
} else { |
EmitKeyedCallWithIC(expr, property->key()); |
} |
@@ -4151,7 +4138,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
if (expr->is_jsruntime()) { |
// Call the JS runtime function. |
__ mov(r2, Operand(expr->name())); |
- RelocInfo::Mode mode = RelocInfo::CODE_TARGET; |
+ ContextualMode mode = NOT_CONTEXTUAL; |
Handle<Code> ic = |
isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); |
CallIC(ic, mode, expr->CallRuntimeFeedbackId()); |
@@ -4402,7 +4389,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
BinaryOpICStub stub(Token::ADD, NO_OVERWRITE); |
CallIC(stub.GetCode(isolate()), |
- RelocInfo::CODE_TARGET, |
+ NOT_CONTEXTUAL, |
expr->CountBinOpFeedbackId()); |
patch_site.EmitPatchInfo(); |
__ bind(&done); |
@@ -4432,10 +4419,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
case NAMED_PROPERTY: { |
__ mov(r2, Operand(prop->key()->AsLiteral()->value())); |
__ pop(r1); |
- Handle<Code> ic = is_classic_mode() |
- ? isolate()->builtins()->StoreIC_Initialize() |
- : isolate()->builtins()->StoreIC_Initialize_Strict(); |
- CallIC(ic, RelocInfo::CODE_TARGET, expr->CountStoreFeedbackId()); |
+ CallStoreIC(NOT_CONTEXTUAL, expr->CountStoreFeedbackId()); |
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
if (expr->is_postfix()) { |
if (!context()->IsEffect()) { |
@@ -4451,7 +4435,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
Handle<Code> ic = is_classic_mode() |
? isolate()->builtins()->KeyedStoreIC_Initialize() |
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); |
- CallIC(ic, RelocInfo::CODE_TARGET, expr->CountStoreFeedbackId()); |
+ CallIC(ic, NOT_CONTEXTUAL, expr->CountStoreFeedbackId()); |
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
if (expr->is_postfix()) { |
if (!context()->IsEffect()) { |
@@ -4474,10 +4458,9 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
Comment cmnt(masm_, "Global variable"); |
__ ldr(r0, GlobalObjectOperand()); |
__ mov(r2, Operand(proxy->name())); |
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
// Use a regular load, not a contextual load, to avoid a reference |
// error. |
- CallIC(ic); |
+ CallLoadIC(NOT_CONTEXTUAL); |
PrepareForBailout(expr, TOS_REG); |
context()->Plug(r0); |
} else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
@@ -4642,7 +4625,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
// Record position and call the compare IC. |
SetSourcePosition(expr->position()); |
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); |
- CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId()); |
+ CallIC(ic, NOT_CONTEXTUAL, expr->CompareOperationFeedbackId()); |
patch_site.EmitPatchInfo(); |
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
__ cmp(r0, Operand::Zero()); |
@@ -4677,7 +4660,7 @@ void FullCodeGenerator::EmitLiteralCompareNil(CompareOperation* expr, |
Split(eq, if_true, if_false, fall_through); |
} else { |
Handle<Code> ic = CompareNilICStub::GetUninitialized(isolate(), nil); |
- CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId()); |
+ CallIC(ic, NOT_CONTEXTUAL, expr->CompareOperationFeedbackId()); |
__ cmp(r0, Operand(0)); |
Split(ne, if_true, if_false, fall_through); |
} |