| Index: src/ia32/full-codegen-ia32.cc
|
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
|
| index f3125666f829fb291e371059118041518446656f..1e0b6f1f0960fffa3cec07f1c674955b4ee507bd 100644
|
| --- a/src/ia32/full-codegen-ia32.cc
|
| +++ b/src/ia32/full-codegen-ia32.cc
|
| @@ -118,6 +118,9 @@ void FullCodeGenerator::Generate() {
|
| CompilationInfo* info = info_;
|
| handler_table_ =
|
| isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED);
|
| +
|
| + InitializeFeedbackVector();
|
| +
|
| profiling_counter_ = isolate()->factory()->NewCell(
|
| Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate()));
|
| SetFunctionPosition(function());
|
| @@ -626,7 +629,7 @@ void FullCodeGenerator::DoTest(Expression* condition,
|
| Label* if_false,
|
| Label* fall_through) {
|
| Handle<Code> ic = ToBooleanStub::GetUninitialized(isolate());
|
| - CallIC(ic, NOT_CONTEXTUAL, condition->test_id());
|
| + CallIC(ic, condition->test_id());
|
| __ test(result_register(), result_register());
|
| // The stub returns nonzero for true.
|
| Split(not_zero, if_true, if_false, fall_through);
|
| @@ -977,7 +980,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, NOT_CONTEXTUAL, clause->CompareId());
|
| + CallIC(ic, clause->CompareId());
|
| patch_site.EmitPatchInfo();
|
|
|
| Label skip;
|
| @@ -1021,6 +1024,8 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
|
|
|
| void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
| Comment cmnt(masm_, "[ ForInStatement");
|
| + int slot = stmt->ForInFeedbackSlot();
|
| +
|
| SetStatementPosition(stmt);
|
|
|
| Label loop, exit;
|
| @@ -1099,13 +1104,15 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
| Label non_proxy;
|
| __ bind(&fixed_array);
|
|
|
| - Handle<Cell> cell = isolate()->factory()->NewCell(
|
| - Handle<Object>(Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker),
|
| - isolate()));
|
| - RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell);
|
| - __ LoadHeapObject(ebx, cell);
|
| - __ mov(FieldOperand(ebx, Cell::kValueOffset),
|
| - Immediate(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker)));
|
| + Handle<Object> feedback = Handle<Object>(
|
| + Smi::FromInt(TypeFeedbackInfo::kForInFastCaseMarker),
|
| + isolate());
|
| + StoreFeedbackVectorSlot(slot, feedback);
|
| +
|
| + // No need for a write barrier, we are storing a Smi in the feedback vector.
|
| + __ LoadHeapObject(ebx, FeedbackVector());
|
| + __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(slot)),
|
| + Immediate(Smi::FromInt(TypeFeedbackInfo::kForInSlowCaseMarker)));
|
|
|
| __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check
|
| __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object
|
| @@ -1633,7 +1640,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| VisitForAccumulatorValue(value);
|
| __ mov(ecx, Immediate(key->value()));
|
| __ mov(edx, Operand(esp, 0));
|
| - CallStoreIC(NOT_CONTEXTUAL, key->LiteralFeedbackId());
|
| + CallStoreIC(key->LiteralFeedbackId());
|
| PrepareForBailoutForId(key->id(), NO_REGISTERS);
|
| } else {
|
| VisitForEffect(value);
|
| @@ -2047,7 +2054,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
| __ bind(&l_call);
|
| __ mov(edx, Operand(esp, kPointerSize));
|
| Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
| - CallIC(ic, NOT_CONTEXTUAL, TypeFeedbackId::None());
|
| + CallIC(ic, TypeFeedbackId::None());
|
| __ mov(edi, eax);
|
| __ mov(Operand(esp, 2 * kPointerSize), edi);
|
| CallFunctionStub stub(1, CALL_AS_METHOD);
|
| @@ -2237,7 +2244,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
| void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
|
| SetSourcePosition(prop->position());
|
| Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
| - CallIC(ic, NOT_CONTEXTUAL, prop->PropertyFeedbackId());
|
| + CallIC(ic, prop->PropertyFeedbackId());
|
| }
|
|
|
|
|
| @@ -2258,8 +2265,7 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
|
| __ bind(&stub_call);
|
| __ mov(eax, ecx);
|
| BinaryOpICStub stub(op, mode);
|
| - CallIC(stub.GetCode(isolate()), NOT_CONTEXTUAL,
|
| - expr->BinaryOperationFeedbackId());
|
| + CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId());
|
| patch_site.EmitPatchInfo();
|
| __ jmp(&done, Label::kNear);
|
|
|
| @@ -2344,8 +2350,7 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
|
| __ pop(edx);
|
| BinaryOpICStub stub(op, mode);
|
| JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
|
| - CallIC(stub.GetCode(isolate()), NOT_CONTEXTUAL,
|
| - expr->BinaryOperationFeedbackId());
|
| + CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId());
|
| patch_site.EmitPatchInfo();
|
| context()->Plug(eax);
|
| }
|
| @@ -2383,7 +2388,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
| __ mov(edx, eax);
|
| __ pop(eax); // Restore value.
|
| __ mov(ecx, prop->key()->AsLiteral()->value());
|
| - CallStoreIC(NOT_CONTEXTUAL);
|
| + CallStoreIC();
|
| break;
|
| }
|
| case KEYED_PROPERTY: {
|
| @@ -2410,7 +2415,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
|
| // Global var, const, or let.
|
| __ mov(ecx, var->name());
|
| __ mov(edx, GlobalObjectOperand());
|
| - CallStoreIC(CONTEXTUAL);
|
| + CallStoreIC();
|
| } else if (op == Token::INIT_CONST) {
|
| // Const initializers need a write barrier.
|
| ASSERT(!var->IsParameter()); // No const parameters.
|
| @@ -2504,7 +2509,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
|
| SetSourcePosition(expr->position());
|
| __ mov(ecx, prop->key()->AsLiteral()->value());
|
| __ pop(edx);
|
| - CallStoreIC(NOT_CONTEXTUAL, expr->AssignmentFeedbackId());
|
| + CallStoreIC(expr->AssignmentFeedbackId());
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| context()->Plug(eax);
|
| }
|
| @@ -2523,7 +2528,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
| Handle<Code> ic = is_classic_mode()
|
| ? isolate()->builtins()->KeyedStoreIC_Initialize()
|
| : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
| - CallIC(ic, NOT_CONTEXTUAL, expr->AssignmentFeedbackId());
|
| + CallIC(ic, expr->AssignmentFeedbackId());
|
|
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| context()->Plug(eax);
|
| @@ -2552,10 +2557,8 @@ void FullCodeGenerator::VisitProperty(Property* expr) {
|
|
|
|
|
| void FullCodeGenerator::CallIC(Handle<Code> code,
|
| - ContextualMode mode,
|
| TypeFeedbackId ast_id) {
|
| ic_total_count_++;
|
| - ASSERT(mode != CONTEXTUAL || ast_id.IsNone());
|
| __ call(code, RelocInfo::CODE_TARGET, ast_id);
|
| }
|
|
|
| @@ -2668,15 +2671,15 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr) {
|
| SetSourcePosition(expr->position());
|
|
|
| Handle<Object> uninitialized =
|
| - TypeFeedbackCells::UninitializedSentinel(isolate());
|
| - Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized);
|
| - RecordTypeFeedbackCell(expr->CallFeedbackId(), cell);
|
| - __ mov(ebx, cell);
|
| + TypeFeedbackInfo::UninitializedSentinel(isolate());
|
| + StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized);
|
| + __ LoadHeapObject(ebx, FeedbackVector());
|
| + __ mov(edx, Immediate(Smi::FromInt(expr->CallFeedbackSlot())));
|
|
|
| // Record call targets in unoptimized code.
|
| CallFunctionStub stub(arg_count, RECORD_CALL_TARGET);
|
| __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
|
| - __ CallStub(&stub, expr->CallFeedbackId());
|
| + __ CallStub(&stub);
|
|
|
| RecordJSReturnSite(expr);
|
| // Restore context register.
|
| @@ -2848,10 +2851,10 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) {
|
|
|
| // Record call targets in unoptimized code.
|
| Handle<Object> uninitialized =
|
| - TypeFeedbackCells::UninitializedSentinel(isolate());
|
| - Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized);
|
| - RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell);
|
| - __ mov(ebx, cell);
|
| + TypeFeedbackInfo::UninitializedSentinel(isolate());
|
| + StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized);
|
| + __ LoadHeapObject(ebx, FeedbackVector());
|
| + __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot())));
|
|
|
| CallConstructStub stub(RECORD_CALL_TARGET);
|
| __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL);
|
| @@ -4416,9 +4419,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| __ mov(edx, eax);
|
| __ mov(eax, Immediate(Smi::FromInt(1)));
|
| BinaryOpICStub stub(expr->binary_op(), NO_OVERWRITE);
|
| - CallIC(stub.GetCode(isolate()),
|
| - NOT_CONTEXTUAL,
|
| - expr->CountBinOpFeedbackId());
|
| + CallIC(stub.GetCode(isolate()), expr->CountBinOpFeedbackId());
|
| patch_site.EmitPatchInfo();
|
| __ bind(&done);
|
|
|
| @@ -4449,7 +4450,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| case NAMED_PROPERTY: {
|
| __ mov(ecx, prop->key()->AsLiteral()->value());
|
| __ pop(edx);
|
| - CallStoreIC(NOT_CONTEXTUAL, expr->CountStoreFeedbackId());
|
| + CallStoreIC(expr->CountStoreFeedbackId());
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| if (expr->is_postfix()) {
|
| if (!context()->IsEffect()) {
|
| @@ -4466,7 +4467,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| Handle<Code> ic = is_classic_mode()
|
| ? isolate()->builtins()->KeyedStoreIC_Initialize()
|
| : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
| - CallIC(ic, NOT_CONTEXTUAL, expr->CountStoreFeedbackId());
|
| + CallIC(ic, expr->CountStoreFeedbackId());
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| if (expr->is_postfix()) {
|
| // Result is on the stack
|
| @@ -4655,7 +4656,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, NOT_CONTEXTUAL, expr->CompareOperationFeedbackId());
|
| + CallIC(ic, expr->CompareOperationFeedbackId());
|
| patch_site.EmitPatchInfo();
|
|
|
| PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
|
| @@ -4691,7 +4692,7 @@ void FullCodeGenerator::EmitLiteralCompareNil(CompareOperation* expr,
|
| Split(equal, if_true, if_false, fall_through);
|
| } else {
|
| Handle<Code> ic = CompareNilICStub::GetUninitialized(isolate(), nil);
|
| - CallIC(ic, NOT_CONTEXTUAL, expr->CompareOperationFeedbackId());
|
| + CallIC(ic, expr->CompareOperationFeedbackId());
|
| __ test(eax, eax);
|
| Split(not_zero, if_true, if_false, fall_through);
|
| }
|
|
|