Index: src/mips/full-codegen-mips.cc |
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc |
index 74b3807882733a4540c742f6a5dfd72f071ad534..d4e356672abf31ac9c14a72c7d14b2b7a2c3b1db 100644 |
--- a/src/mips/full-codegen-mips.cc |
+++ b/src/mips/full-codegen-mips.cc |
@@ -671,7 +671,7 @@ void FullCodeGenerator::DoTest(Expression* condition, |
Label* fall_through) { |
__ mov(a0, result_register()); |
Handle<Code> ic = ToBooleanStub::GetUninitialized(isolate()); |
- CallIC(ic, RelocInfo::CODE_TARGET, condition->test_id()); |
+ CallIC(ic, NOT_CONTEXTUAL, condition->test_id()); |
__ mov(at, zero_reg); |
Split(ne, v0, Operand(at), if_true, if_false, fall_through); |
} |
@@ -1036,7 +1036,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(); |
__ Branch(&next_test, ne, v0, Operand(zero_reg)); |
@@ -1390,11 +1390,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, |
__ lw(a0, GlobalObjectOperand()); |
__ li(a2, 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); |
} |
@@ -1477,8 +1476,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { |
// object (receiver) in a0. |
__ lw(a0, GlobalObjectOperand()); |
__ li(a2, Operand(var->name())); |
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
- CallIC(ic, RelocInfo::CODE_TARGET_CONTEXT); |
+ CallLoadIC(CONTEXTUAL); |
context()->Plug(v0); |
break; |
} |
@@ -1690,10 +1688,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
__ mov(a0, result_register()); |
__ li(a2, Operand(key->value())); |
__ lw(a1, 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); |
@@ -2108,8 +2103,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { |
__ mov(a0, v0); |
__ push(a0); // save result |
__ LoadRoot(a2, Heap::kdone_stringRootIndex); // "done" |
- Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize(); |
- CallIC(done_ic); // result.done in v0 |
+ CallLoadIC(NOT_CONTEXTUAL); // result.done in v0 |
__ mov(a0, v0); |
Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
CallIC(bool_ic); |
@@ -2118,8 +2112,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { |
// result.value |
__ pop(a0); // result |
__ LoadRoot(a2, Heap::kvalue_stringRootIndex); // "value" |
- Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); |
- CallIC(value_ic); // result.value in v0 |
+ CallLoadIC(NOT_CONTEXTUAL); // result.value in v0 |
context()->DropAndPlug(2, v0); // drop iter and g |
break; |
} |
@@ -2267,8 +2260,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
__ mov(a0, result_register()); |
__ li(a2, Operand(key->value())); |
// Call load IC. It has arguments receiver and property name a0 and a2. |
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
- CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); |
+ CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
} |
@@ -2277,7 +2269,7 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
__ mov(a0, result_register()); |
// Call keyed load IC. It has arguments key and receiver in a0 and a1. |
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
- CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); |
+ CallIC(ic, NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
} |
@@ -2305,8 +2297,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
__ bind(&stub_call); |
BinaryOpICStub stub(op, mode); |
- CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
- expr->BinaryOperationFeedbackId()); |
+ CallIC(stub.GetCode(isolate()), NOT_CONTEXTUAL, |
+ expr->BinaryOperationFeedbackId()); |
patch_site.EmitPatchInfo(); |
__ jmp(&done); |
@@ -2388,7 +2380,7 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
__ pop(a1); |
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(v0); |
@@ -2427,10 +2419,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { |
__ mov(a1, result_register()); |
__ pop(a0); // Restore value. |
__ li(a2, 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: { |
@@ -2457,11 +2446,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, |
__ mov(a0, result_register()); |
__ li(a2, Operand(var->name())); |
__ lw(a1, 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. |
@@ -2559,10 +2544,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
__ li(a2, Operand(prop->key()->AsLiteral()->value())); |
__ pop(a1); |
- 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(v0); |
@@ -2585,7 +2567,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(v0); |
@@ -2612,16 +2594,17 @@ void FullCodeGenerator::VisitProperty(Property* expr) { |
void FullCodeGenerator::CallIC(Handle<Code> code, |
- RelocInfo::Mode rmode, |
+ ContextualMode mode, |
TypeFeedbackId id) { |
ic_total_count_++; |
- __ Call(code, rmode, id); |
+ ASSERT(mode != CONTEXTUAL || id.IsNone()); |
+ __ Call(code, RelocInfo::CODE_TARGET, id); |
} |
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(); |
@@ -2636,7 +2619,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. |
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
@@ -2669,7 +2655,7 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
Handle<Code> ic = |
isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); |
__ lw(a2, 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. |
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
@@ -2785,7 +2771,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
// Push global object as receiver for the call IC. |
__ lw(a0, GlobalObjectOperand()); |
__ push(a0); |
- 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; |
@@ -2832,7 +2818,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()); |
} |
@@ -4206,7 +4192,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
if (expr->is_jsruntime()) { |
// Call the JS runtime function. |
__ li(a2, 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()); |
@@ -4460,7 +4446,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); |
@@ -4491,10 +4477,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
__ mov(a0, result_register()); // Value. |
__ li(a2, Operand(prop->key()->AsLiteral()->value())); // Name. |
__ pop(a1); // Receiver. |
- 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()) { |
@@ -4511,7 +4494,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()) { |
@@ -4534,10 +4517,9 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
Comment cmnt(masm_, "Global variable"); |
__ lw(a0, GlobalObjectOperand()); |
__ li(a2, 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(v0); |
} else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
@@ -4697,7 +4679,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); |
Split(cc, v0, Operand(zero_reg), if_true, if_false, fall_through); |
@@ -4731,7 +4713,7 @@ void FullCodeGenerator::EmitLiteralCompareNil(CompareOperation* expr, |
Split(eq, a0, Operand(a1), 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()); |
Split(ne, v0, Operand(zero_reg), if_true, if_false, fall_through); |
} |
context()->Plug(if_true, if_false); |