| Index: src/x64/full-codegen-x64.cc
|
| diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
|
| index 621eacc7089e0b4066942d18110d504989c245b2..9380f190c365701af523d6c6d65cb155d78d1639 100644
|
| --- a/src/x64/full-codegen-x64.cc
|
| +++ b/src/x64/full-codegen-x64.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());
|
| @@ -638,7 +641,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());
|
| __ testq(result_register(), result_register());
|
| // The stub returns nonzero for true.
|
| Split(not_zero, if_true, if_false, fall_through);
|
| @@ -991,7 +994,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;
|
| @@ -1035,6 +1038,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
|
|
|
| void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
| Comment cmnt(masm_, "[ ForInStatement");
|
| + int slot = stmt->ForInFeedbackSlot();
|
| SetStatementPosition(stmt);
|
|
|
| Label loop, exit;
|
| @@ -1123,14 +1127,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);
|
| - __ Move(rbx, cell);
|
| - __ Move(FieldOperand(rbx, Cell::kValueOffset),
|
| - 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.
|
| + __ Move(rbx, FeedbackVector());
|
| + __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(slot)),
|
| + Smi::FromInt(TypeFeedbackInfo::kForInSlowCaseMarker));
|
| __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check
|
| __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object
|
| STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE);
|
| @@ -1658,7 +1663,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| VisitForAccumulatorValue(value);
|
| __ Move(rcx, key->value());
|
| __ movp(rdx, Operand(rsp, 0));
|
| - CallStoreIC(NOT_CONTEXTUAL, key->LiteralFeedbackId());
|
| + CallStoreIC(key->LiteralFeedbackId());
|
| PrepareForBailoutForId(key->id(), NO_REGISTERS);
|
| } else {
|
| VisitForEffect(value);
|
| @@ -2073,7 +2078,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
| __ movp(rdx, Operand(rsp, kPointerSize));
|
| __ movp(rax, Operand(rsp, 2 * kPointerSize));
|
| Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
| - CallIC(ic, NOT_CONTEXTUAL, TypeFeedbackId::None());
|
| + CallIC(ic, TypeFeedbackId::None());
|
| __ movp(rdi, rax);
|
| __ movp(Operand(rsp, 2 * kPointerSize), rdi);
|
| CallFunctionStub stub(1, CALL_AS_METHOD);
|
| @@ -2264,7 +2269,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());
|
| }
|
|
|
|
|
| @@ -2286,8 +2291,7 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
|
| __ bind(&stub_call);
|
| __ movp(rax, rcx);
|
| 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);
|
|
|
| @@ -2336,8 +2340,7 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
|
| __ pop(rdx);
|
| 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(rax);
|
| }
|
| @@ -2375,7 +2378,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
| __ movp(rdx, rax);
|
| __ pop(rax); // Restore value.
|
| __ Move(rcx, prop->key()->AsLiteral()->value());
|
| - CallStoreIC(NOT_CONTEXTUAL);
|
| + CallStoreIC();
|
| break;
|
| }
|
| case KEYED_PROPERTY: {
|
| @@ -2402,7 +2405,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
|
| // Global var, const, or let.
|
| __ Move(rcx, var->name());
|
| __ movp(rdx, GlobalObjectOperand());
|
| - CallStoreIC(CONTEXTUAL);
|
| + CallStoreIC();
|
| } else if (op == Token::INIT_CONST) {
|
| // Const initializers need a write barrier.
|
| ASSERT(!var->IsParameter()); // No const parameters.
|
| @@ -2493,7 +2496,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
|
| SetSourcePosition(expr->position());
|
| __ Move(rcx, prop->key()->AsLiteral()->value());
|
| __ pop(rdx);
|
| - CallStoreIC(NOT_CONTEXTUAL, expr->AssignmentFeedbackId());
|
| + CallStoreIC(expr->AssignmentFeedbackId());
|
|
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| context()->Plug(rax);
|
| @@ -2510,7 +2513,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(rax);
|
| @@ -2537,10 +2540,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);
|
| }
|
|
|
| @@ -2650,15 +2651,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);
|
| - __ Move(rbx, cell);
|
| + TypeFeedbackInfo::UninitializedSentinel(isolate());
|
| + StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized);
|
| + __ Move(rbx, FeedbackVector());
|
| + __ Move(rdx, Smi::FromInt(expr->CallFeedbackSlot()));
|
|
|
| // Record call targets in unoptimized code.
|
| CallFunctionStub stub(arg_count, RECORD_CALL_TARGET);
|
| __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize));
|
| - __ CallStub(&stub, expr->CallFeedbackId());
|
| + __ CallStub(&stub);
|
| RecordJSReturnSite(expr);
|
| // Restore context register.
|
| __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
|
| @@ -2830,10 +2831,10 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) {
|
|
|
| // Record call targets in unoptimized code, but not in the snapshot.
|
| Handle<Object> uninitialized =
|
| - TypeFeedbackCells::UninitializedSentinel(isolate());
|
| - Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized);
|
| - RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell);
|
| - __ Move(rbx, cell);
|
| + TypeFeedbackInfo::UninitializedSentinel(isolate());
|
| + StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized);
|
| + __ Move(rbx, FeedbackVector());
|
| + __ Move(rdx, Smi::FromInt(expr->CallNewFeedbackSlot()));
|
|
|
| CallConstructStub stub(RECORD_CALL_TARGET);
|
| __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL);
|
| @@ -4409,9 +4410,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| __ movp(rdx, rax);
|
| __ Move(rax, 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);
|
|
|
| @@ -4442,7 +4441,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| case NAMED_PROPERTY: {
|
| __ Move(rcx, prop->key()->AsLiteral()->value());
|
| __ pop(rdx);
|
| - CallStoreIC(NOT_CONTEXTUAL, expr->CountStoreFeedbackId());
|
| + CallStoreIC(expr->CountStoreFeedbackId());
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| if (expr->is_postfix()) {
|
| if (!context()->IsEffect()) {
|
| @@ -4459,7 +4458,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()) {
|
| if (!context()->IsEffect()) {
|
| @@ -4647,7 +4646,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);
|
| @@ -4682,7 +4681,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());
|
| __ testq(rax, rax);
|
| Split(not_zero, if_true, if_false, fall_through);
|
| }
|
|
|