Turbofan needs a code handle and a CallInterfaceDescriptor. At the same time we spread knowledge about how to create the initial IC code object too widely. Consolidate code creation and unify it with a descriptor via CodeFactory.
R=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/567433002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23877 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
90dc5c9e66
commit
af495313d4
2
BUILD.gn
2
BUILD.gn
@ -452,6 +452,8 @@ source_set("v8_base") {
|
||||
"src/checks.h",
|
||||
"src/circular-queue-inl.h",
|
||||
"src/circular-queue.h",
|
||||
"src/code-factory.cc",
|
||||
"src/code-factory.h",
|
||||
"src/code-stubs.cc",
|
||||
"src/code-stubs.h",
|
||||
"src/code-stubs-hydrogen.cc",
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#if V8_TARGET_ARCH_ARM
|
||||
|
||||
#include "src/code-factory.h"
|
||||
#include "src/code-stubs.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/compiler.h"
|
||||
@ -1053,7 +1054,8 @@ 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);
|
||||
Handle<Code> ic =
|
||||
CodeFactory::CompareIC(isolate(), Token::EQ_STRICT).code();
|
||||
CallIC(ic, clause->CompareId());
|
||||
patch_site.EmitPatchInfo();
|
||||
|
||||
@ -2090,7 +2092,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
||||
__ mov(VectorLoadICDescriptor::SlotRegister(),
|
||||
Operand(Smi::FromInt(expr->KeyedLoadFeedbackSlot())));
|
||||
}
|
||||
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
CallIC(ic, TypeFeedbackId::None());
|
||||
__ mov(r1, r0);
|
||||
__ str(r1, MemOperand(sp, 2 * kPointerSize));
|
||||
@ -2310,7 +2312,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
||||
|
||||
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
|
||||
SetSourcePosition(prop->position());
|
||||
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
if (FLAG_vector_ics) {
|
||||
__ mov(VectorLoadICDescriptor::SlotRegister(),
|
||||
Operand(Smi::FromInt(prop->PropertyFeedbackSlot())));
|
||||
@ -2343,8 +2345,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
|
||||
patch_site.EmitJumpIfSmi(scratch1, &smi_case);
|
||||
|
||||
__ bind(&stub_call);
|
||||
BinaryOpICStub stub(isolate(), op, mode);
|
||||
CallIC(stub.GetCode(), expr->BinaryOperationFeedbackId());
|
||||
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
|
||||
CallIC(code, expr->BinaryOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
__ jmp(&done);
|
||||
|
||||
@ -2419,9 +2421,9 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
|
||||
Token::Value op,
|
||||
OverwriteMode mode) {
|
||||
__ pop(r1);
|
||||
BinaryOpICStub stub(isolate(), op, mode);
|
||||
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
|
||||
JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
|
||||
CallIC(stub.GetCode(), expr->BinaryOperationFeedbackId());
|
||||
CallIC(code, expr->BinaryOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
context()->Plug(r0);
|
||||
}
|
||||
@ -2465,9 +2467,8 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
||||
__ Move(StoreDescriptor::NameRegister(), r0);
|
||||
__ Pop(StoreDescriptor::ValueRegister(),
|
||||
StoreDescriptor::ReceiverRegister());
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic);
|
||||
break;
|
||||
}
|
||||
@ -2583,9 +2584,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
||||
__ Pop(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister());
|
||||
DCHECK(StoreDescriptor::ValueRegister().is(r0));
|
||||
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic = CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic, expr->AssignmentFeedbackId());
|
||||
|
||||
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
||||
@ -4357,8 +4356,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
// Record position before stub call.
|
||||
SetSourcePosition(expr->position());
|
||||
|
||||
BinaryOpICStub stub(isolate(), Token::ADD, NO_OVERWRITE);
|
||||
CallIC(stub.GetCode(), expr->CountBinOpFeedbackId());
|
||||
Handle<Code> code =
|
||||
CodeFactory::BinaryOpIC(isolate(), Token::ADD, NO_OVERWRITE).code();
|
||||
CallIC(code, expr->CountBinOpFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
__ bind(&done);
|
||||
|
||||
@ -4402,9 +4402,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
case KEYED_PROPERTY: {
|
||||
__ Pop(StoreDescriptor::ReceiverRegister(),
|
||||
StoreDescriptor::NameRegister());
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic, expr->CountStoreFeedbackId());
|
||||
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
||||
if (expr->is_postfix()) {
|
||||
@ -4594,7 +4593,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
|
||||
|
||||
// Record position and call the compare IC.
|
||||
SetSourcePosition(expr->position());
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallIC(ic, expr->CompareOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "src/arm/lithium-codegen-arm.h"
|
||||
#include "src/arm/lithium-gap-resolver-arm.h"
|
||||
#include "src/base/bits.h"
|
||||
#include "src/code-factory.h"
|
||||
#include "src/code-stubs.h"
|
||||
#include "src/hydrogen-osr.h"
|
||||
#include "src/ic/stub-cache.h"
|
||||
@ -2173,11 +2174,12 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
|
||||
DCHECK(ToRegister(instr->right()).is(r0));
|
||||
DCHECK(ToRegister(instr->result()).is(r0));
|
||||
|
||||
BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE);
|
||||
Handle<Code> code =
|
||||
CodeFactory::BinaryOpIC(isolate(), instr->op(), NO_OVERWRITE).code();
|
||||
// Block literal pool emission to ensure nop indicating no inlined smi code
|
||||
// is in the correct position.
|
||||
Assembler::BlockConstPoolScope block_const_pool(masm());
|
||||
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
|
||||
CallCode(code, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
|
||||
@ -2609,7 +2611,7 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
|
||||
DCHECK(ToRegister(instr->context()).is(cp));
|
||||
Token::Value op = instr->op();
|
||||
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
// This instruction also signals no smi code inlined.
|
||||
__ cmp(r0, Operand::Zero());
|
||||
@ -2925,7 +2927,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) {
|
||||
DCHECK(ToRegister(instr->context()).is(cp));
|
||||
Token::Value op = instr->op();
|
||||
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
// This instruction also signals no smi code inlined.
|
||||
__ cmp(r0, Operand::Zero());
|
||||
@ -3016,7 +3018,7 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
|
||||
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
|
||||
}
|
||||
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
|
||||
Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode);
|
||||
Handle<Code> ic = CodeFactory::LoadIC(isolate(), mode).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
@ -3138,7 +3140,7 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
|
||||
if (FLAG_vector_ics) {
|
||||
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
|
||||
}
|
||||
Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL);
|
||||
Handle<Code> ic = CodeFactory::LoadIC(isolate(), NOT_CONTEXTUAL).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
|
||||
}
|
||||
|
||||
@ -3429,7 +3431,7 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
|
||||
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
|
||||
}
|
||||
|
||||
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
|
||||
}
|
||||
|
||||
@ -4456,9 +4458,8 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
|
||||
DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
|
||||
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
|
||||
|
||||
Handle<Code> ic = instr->strict_mode() == STRICT
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#if V8_TARGET_ARCH_ARM64
|
||||
|
||||
#include "src/code-factory.h"
|
||||
#include "src/code-stubs.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/compiler.h"
|
||||
@ -1050,7 +1051,8 @@ 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);
|
||||
Handle<Code> ic =
|
||||
CodeFactory::CompareIC(isolate(), Token::EQ_STRICT).code();
|
||||
CallIC(ic, clause->CompareId());
|
||||
patch_site.EmitPatchInfo();
|
||||
|
||||
@ -1960,7 +1962,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
||||
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();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
if (FLAG_vector_ics) {
|
||||
__ Mov(VectorLoadICDescriptor::SlotRegister(),
|
||||
Smi::FromInt(prop->PropertyFeedbackSlot()));
|
||||
@ -1990,10 +1992,11 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
|
||||
patch_site.EmitJumpIfSmi(x10, &both_smis);
|
||||
|
||||
__ Bind(&stub_call);
|
||||
BinaryOpICStub stub(isolate(), op, mode);
|
||||
|
||||
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
|
||||
{
|
||||
Assembler::BlockPoolsScope scope(masm_);
|
||||
CallIC(stub.GetCode(), expr->BinaryOperationFeedbackId());
|
||||
CallIC(code, expr->BinaryOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
}
|
||||
__ B(&done);
|
||||
@ -2074,11 +2077,11 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
|
||||
Token::Value op,
|
||||
OverwriteMode mode) {
|
||||
__ Pop(x1);
|
||||
BinaryOpICStub stub(isolate(), op, mode);
|
||||
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
|
||||
JumpPatchSite patch_site(masm_); // Unbound, signals no inlined smi code.
|
||||
{
|
||||
Assembler::BlockPoolsScope scope(masm_);
|
||||
CallIC(stub.GetCode(), expr->BinaryOperationFeedbackId());
|
||||
CallIC(code, expr->BinaryOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
}
|
||||
context()->Plug(x0);
|
||||
@ -2125,9 +2128,8 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
||||
__ Mov(StoreDescriptor::NameRegister(), x0);
|
||||
__ Pop(StoreDescriptor::ReceiverRegister(),
|
||||
StoreDescriptor::ValueRegister());
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic);
|
||||
break;
|
||||
}
|
||||
@ -2247,9 +2249,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
||||
__ Pop(StoreDescriptor::NameRegister(), StoreDescriptor::ReceiverRegister());
|
||||
DCHECK(StoreDescriptor::ValueRegister().is(x0));
|
||||
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic = CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic, expr->AssignmentFeedbackId());
|
||||
|
||||
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
||||
@ -4022,8 +4022,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
|
||||
{
|
||||
Assembler::BlockPoolsScope scope(masm_);
|
||||
BinaryOpICStub stub(isolate(), Token::ADD, NO_OVERWRITE);
|
||||
CallIC(stub.GetCode(), expr->CountBinOpFeedbackId());
|
||||
Handle<Code> code =
|
||||
CodeFactory::BinaryOpIC(isolate(), Token::ADD, NO_OVERWRITE).code();
|
||||
CallIC(code, expr->CountBinOpFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
}
|
||||
__ Bind(&done);
|
||||
@ -4068,9 +4069,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
case KEYED_PROPERTY: {
|
||||
__ Pop(StoreDescriptor::NameRegister());
|
||||
__ Pop(StoreDescriptor::ReceiverRegister());
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic, expr->CountStoreFeedbackId());
|
||||
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
||||
if (expr->is_postfix()) {
|
||||
@ -4268,7 +4268,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
|
||||
|
||||
// Record position and call the compare IC.
|
||||
SetSourcePosition(expr->position());
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallIC(ic, expr->CompareOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
|
||||
@ -4454,7 +4454,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
||||
__ Mov(VectorLoadICDescriptor::SlotRegister(),
|
||||
Smi::FromInt(expr->KeyedLoadFeedbackSlot()));
|
||||
}
|
||||
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
CallIC(ic, TypeFeedbackId::None());
|
||||
__ Mov(x1, x0);
|
||||
__ Poke(x1, 2 * kPointerSize);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "src/arm64/lithium-codegen-arm64.h"
|
||||
#include "src/arm64/lithium-gap-resolver-arm64.h"
|
||||
#include "src/base/bits.h"
|
||||
#include "src/code-factory.h"
|
||||
#include "src/code-stubs.h"
|
||||
#include "src/hydrogen-osr.h"
|
||||
#include "src/ic/stub-cache.h"
|
||||
@ -1782,8 +1783,9 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
|
||||
DCHECK(ToRegister(instr->right()).is(x0));
|
||||
DCHECK(ToRegister(instr->result()).is(x0));
|
||||
|
||||
BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE);
|
||||
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
|
||||
Handle<Code> code =
|
||||
CodeFactory::BinaryOpIC(isolate(), instr->op(), NO_OVERWRITE).code();
|
||||
CallCode(code, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
|
||||
@ -2548,7 +2550,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) {
|
||||
|
||||
DCHECK(ToRegister(instr->left()).Is(x1));
|
||||
DCHECK(ToRegister(instr->right()).Is(x0));
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
// Signal that we don't inline smi code before this stub.
|
||||
InlineSmiCheckInfo::EmitNotInlined(masm());
|
||||
@ -3396,7 +3398,7 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
|
||||
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
|
||||
}
|
||||
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
|
||||
Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode);
|
||||
Handle<Code> ic = CodeFactory::LoadIC(isolate(), mode).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
@ -3651,7 +3653,7 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
|
||||
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
|
||||
}
|
||||
|
||||
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
|
||||
DCHECK(ToRegister(instr->result()).Is(x0));
|
||||
@ -3707,7 +3709,7 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
|
||||
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
|
||||
}
|
||||
|
||||
Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL);
|
||||
Handle<Code> ic = CodeFactory::LoadIC(isolate(), NOT_CONTEXTUAL).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
|
||||
DCHECK(ToRegister(instr->result()).is(x0));
|
||||
@ -5345,9 +5347,8 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
|
||||
DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
|
||||
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
|
||||
|
||||
Handle<Code> ic = instr->strict_mode() == STRICT
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
@ -5564,7 +5565,7 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
|
||||
DCHECK(ToRegister(instr->context()).is(cp));
|
||||
Token::Value op = instr->op();
|
||||
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
InlineSmiCheckInfo::EmitNotInlined(masm());
|
||||
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include "src/debug.h"
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/execution.h"
|
||||
#include "src/ic/ic.h"
|
||||
#include "src/ic/stub-cache.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/jsregexp.h"
|
||||
|
92
src/code-factory.cc
Normal file
92
src/code-factory.cc
Normal file
@ -0,0 +1,92 @@
|
||||
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/v8.h"
|
||||
|
||||
#include "src/bootstrapper.h"
|
||||
#include "src/code-factory.h"
|
||||
#include "src/ic/ic.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// static
|
||||
Callable CodeFactory::LoadIC(Isolate* isolate, ContextualMode mode) {
|
||||
return Callable(
|
||||
LoadIC::initialize_stub(isolate, LoadIC::State(mode).GetExtraICState()),
|
||||
LoadDescriptor(isolate));
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
Callable CodeFactory::KeyedLoadIC(Isolate* isolate) {
|
||||
return Callable(isolate->builtins()->KeyedLoadIC_Initialize(),
|
||||
LoadDescriptor(isolate));
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
Callable CodeFactory::StoreIC(Isolate* isolate, StrictMode mode) {
|
||||
return Callable(StoreIC::initialize_stub(isolate, mode),
|
||||
StoreDescriptor(isolate));
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
Callable CodeFactory::KeyedStoreIC(Isolate* isolate, StrictMode mode) {
|
||||
Handle<Code> ic = mode == SLOPPY
|
||||
? isolate->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
return Callable(ic, StoreDescriptor(isolate));
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
Callable CodeFactory::CompareIC(Isolate* isolate, Token::Value op) {
|
||||
Handle<Code> code = CompareIC::GetUninitialized(isolate, op);
|
||||
return Callable(code, BinaryOpDescriptor(isolate));
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
Callable CodeFactory::BinaryOpIC(Isolate* isolate, Token::Value op,
|
||||
OverwriteMode mode) {
|
||||
BinaryOpICStub stub(isolate, op, mode);
|
||||
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
Callable CodeFactory::ToBoolean(Isolate* isolate,
|
||||
ToBooleanStub::ResultMode mode,
|
||||
ToBooleanStub::Types types) {
|
||||
ToBooleanStub stub(isolate, mode, types);
|
||||
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
Callable CodeFactory::ToNumber(Isolate* isolate) {
|
||||
ToNumberStub stub(isolate);
|
||||
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags,
|
||||
PretenureFlag pretenure_flag) {
|
||||
StringAddStub stub(isolate, flags, pretenure_flag);
|
||||
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
Callable CodeFactory::CallFunction(Isolate* isolate, int argc,
|
||||
CallFunctionFlags flags) {
|
||||
CallFunctionStub stub(isolate, argc, flags);
|
||||
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
61
src/code-factory.h
Normal file
61
src/code-factory.h
Normal file
@ -0,0 +1,61 @@
|
||||
// Copyright 2012 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef V8_CODE_FACTORY_H_
|
||||
#define V8_CODE_FACTORY_H_
|
||||
|
||||
#include "src/allocation.h"
|
||||
#include "src/assembler.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/interface-descriptors.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// Associates a body of code with an interface descriptor.
|
||||
class Callable FINAL BASE_EMBEDDED {
|
||||
public:
|
||||
Callable(Handle<Code> code, CallInterfaceDescriptor descriptor)
|
||||
: code_(code), descriptor_(descriptor) {}
|
||||
|
||||
Handle<Code> code() const { return code_; }
|
||||
CallInterfaceDescriptor descriptor() const { return descriptor_; }
|
||||
|
||||
private:
|
||||
const Handle<Code> code_;
|
||||
const CallInterfaceDescriptor descriptor_;
|
||||
};
|
||||
|
||||
|
||||
class CodeFactory FINAL {
|
||||
public:
|
||||
// Initial states for ICs.
|
||||
static Callable LoadIC(Isolate* isolate, ContextualMode mode);
|
||||
static Callable KeyedLoadIC(Isolate* isolate);
|
||||
static Callable StoreIC(Isolate* isolate, StrictMode mode);
|
||||
static Callable KeyedStoreIC(Isolate* isolate, StrictMode mode);
|
||||
|
||||
static Callable CompareIC(Isolate* isolate, Token::Value op);
|
||||
|
||||
static Callable BinaryOpIC(Isolate* isolate, Token::Value op,
|
||||
OverwriteMode mode = NO_OVERWRITE);
|
||||
|
||||
// Code stubs. Add methods here as needed to reduce dependency on
|
||||
// code-stubs.h.
|
||||
static Callable ToBoolean(
|
||||
Isolate* isolate, ToBooleanStub::ResultMode mode,
|
||||
ToBooleanStub::Types types = ToBooleanStub::Types());
|
||||
|
||||
static Callable ToNumber(Isolate* isolate);
|
||||
|
||||
static Callable StringAdd(Isolate* isolate, StringAddFlags flags,
|
||||
PretenureFlag pretenure_flag);
|
||||
|
||||
static Callable CallFunction(Isolate* isolate, int argc,
|
||||
CallFunctionFlags flags);
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // V8_CODE_FACTORY_H_
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/code-factory.h"
|
||||
#include "src/code-stubs.h"
|
||||
#include "src/compiler/common-operator.h"
|
||||
#include "src/compiler/graph-inl.h"
|
||||
@ -15,103 +16,6 @@ namespace v8 {
|
||||
namespace internal {
|
||||
namespace compiler {
|
||||
|
||||
|
||||
// TODO(mstarzinger): This is a temporary shim to be able to call an IC stub
|
||||
// which doesn't have an interface descriptor yet. It mimics a hydrogen code
|
||||
// stub for the underlying IC stub code.
|
||||
class LoadICStubShim : public HydrogenCodeStub {
|
||||
public:
|
||||
LoadICStubShim(Isolate* isolate, ContextualMode contextual_mode)
|
||||
: HydrogenCodeStub(isolate), contextual_mode_(contextual_mode) {}
|
||||
|
||||
virtual Handle<Code> GenerateCode() OVERRIDE {
|
||||
ExtraICState extra_state = LoadIC::ComputeExtraICState(contextual_mode_);
|
||||
return LoadIC::initialize_stub(isolate(), extra_state);
|
||||
}
|
||||
|
||||
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
|
||||
return LoadDescriptor(isolate());
|
||||
}
|
||||
|
||||
private:
|
||||
virtual Major MajorKey() const OVERRIDE { return NoCache; }
|
||||
virtual bool UseSpecialCache() OVERRIDE { return true; }
|
||||
|
||||
ContextualMode contextual_mode_;
|
||||
};
|
||||
|
||||
|
||||
// TODO(mstarzinger): This is a temporary shim to be able to call an IC stub
|
||||
// which doesn't have an interface descriptor yet. It mimics a hydrogen code
|
||||
// stub for the underlying IC stub code.
|
||||
class KeyedLoadICStubShim : public HydrogenCodeStub {
|
||||
public:
|
||||
explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) {}
|
||||
|
||||
virtual Handle<Code> GenerateCode() OVERRIDE {
|
||||
return isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
}
|
||||
|
||||
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
|
||||
return LoadDescriptor(isolate());
|
||||
}
|
||||
|
||||
private:
|
||||
virtual Major MajorKey() const OVERRIDE { return NoCache; }
|
||||
virtual bool UseSpecialCache() OVERRIDE { return true; }
|
||||
};
|
||||
|
||||
|
||||
// TODO(mstarzinger): This is a temporary shim to be able to call an IC stub
|
||||
// which doesn't have an interface descriptor yet. It mimics a hydrogen code
|
||||
// stub for the underlying IC stub code.
|
||||
class StoreICStubShim : public HydrogenCodeStub {
|
||||
public:
|
||||
StoreICStubShim(Isolate* isolate, StrictMode strict_mode)
|
||||
: HydrogenCodeStub(isolate), strict_mode_(strict_mode) {}
|
||||
|
||||
virtual Handle<Code> GenerateCode() OVERRIDE {
|
||||
return StoreIC::initialize_stub(isolate(), strict_mode_);
|
||||
}
|
||||
|
||||
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
|
||||
return StoreDescriptor(isolate());
|
||||
}
|
||||
|
||||
private:
|
||||
virtual Major MajorKey() const OVERRIDE { return NoCache; }
|
||||
virtual bool UseSpecialCache() OVERRIDE { return true; }
|
||||
|
||||
StrictMode strict_mode_;
|
||||
};
|
||||
|
||||
|
||||
// TODO(mstarzinger): This is a temporary shim to be able to call an IC stub
|
||||
// which doesn't have an interface descriptor yet. It mimics a hydrogen code
|
||||
// stub for the underlying IC stub code.
|
||||
class KeyedStoreICStubShim : public HydrogenCodeStub {
|
||||
public:
|
||||
KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode)
|
||||
: HydrogenCodeStub(isolate), strict_mode_(strict_mode) {}
|
||||
|
||||
virtual Handle<Code> GenerateCode() OVERRIDE {
|
||||
return strict_mode_ == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
}
|
||||
|
||||
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
|
||||
return StoreDescriptor(isolate());
|
||||
}
|
||||
|
||||
private:
|
||||
virtual Major MajorKey() const OVERRIDE { return NoCache; }
|
||||
virtual bool UseSpecialCache() OVERRIDE { return true; }
|
||||
|
||||
StrictMode strict_mode_;
|
||||
};
|
||||
|
||||
|
||||
JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph,
|
||||
MachineOperatorBuilder* machine)
|
||||
: info_(info),
|
||||
@ -175,12 +79,11 @@ Reduction JSGenericLowering::Reduce(Node* node) {
|
||||
}
|
||||
|
||||
|
||||
#define REPLACE_BINARY_OP_IC_CALL(op, token) \
|
||||
Node* JSGenericLowering::Lower##op(Node* node) { \
|
||||
BinaryOpICStub stub(isolate(), token); \
|
||||
ReplaceWithStubCall(node, &stub, \
|
||||
CallDescriptor::kPatchableCallSiteWithNop); \
|
||||
return node; \
|
||||
#define REPLACE_BINARY_OP_IC_CALL(op, token) \
|
||||
Node* JSGenericLowering::Lower##op(Node* node) { \
|
||||
ReplaceWithStubCall(node, CodeFactory::BinaryOpIC(isolate(), token), \
|
||||
CallDescriptor::kPatchableCallSiteWithNop); \
|
||||
return node; \
|
||||
}
|
||||
REPLACE_BINARY_OP_IC_CALL(JSBitwiseOr, Token::BIT_OR)
|
||||
REPLACE_BINARY_OP_IC_CALL(JSBitwiseXor, Token::BIT_XOR)
|
||||
@ -196,14 +99,14 @@ REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD)
|
||||
#undef REPLACE_BINARY_OP_IC_CALL
|
||||
|
||||
|
||||
#define REPLACE_STUB_CALL(op, StubDeclaration) \
|
||||
Node* JSGenericLowering::Lower##op(Node* node) { \
|
||||
StubDeclaration; \
|
||||
ReplaceWithStubCall(node, &stub, CallDescriptor::kNoFlags); \
|
||||
return node; \
|
||||
#define REPLACE_FACTORY_CALL(op, FactoryDeclaration) \
|
||||
Node* JSGenericLowering::Lower##op(Node* node) { \
|
||||
Callable callable = FactoryDeclaration; \
|
||||
ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags); \
|
||||
return node; \
|
||||
}
|
||||
REPLACE_STUB_CALL(JSToNumber, ToNumberStub stub(isolate()))
|
||||
#undef REPLACE_STUB_CALL
|
||||
REPLACE_FACTORY_CALL(JSToNumber, CodeFactory::ToNumber(isolate()))
|
||||
#undef REPLACE_FACTORY_CALL
|
||||
|
||||
|
||||
#define REPLACE_COMPARE_IC_CALL(op, token, pure) \
|
||||
@ -260,15 +163,14 @@ static CallDescriptor::Flags FlagsForNode(Node* node) {
|
||||
|
||||
void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token,
|
||||
bool pure) {
|
||||
BinaryOpICStub stub(isolate(), Token::ADD); // TODO(mstarzinger): Hack.
|
||||
CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
|
||||
Callable callable = CodeFactory::CompareIC(isolate(), token);
|
||||
bool has_frame_state = OperatorProperties::HasFrameStateInput(node->op());
|
||||
CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor(
|
||||
d, 0, CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node));
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token);
|
||||
callable.descriptor(), 0,
|
||||
CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node));
|
||||
NodeVector inputs(zone());
|
||||
inputs.reserve(node->InputCount() + 1);
|
||||
inputs.push_back(CodeConstant(ic));
|
||||
inputs.push_back(CodeConstant(callable.code()));
|
||||
inputs.push_back(NodeProperties::GetValueInput(node, 0));
|
||||
inputs.push_back(NodeProperties::GetValueInput(node, 1));
|
||||
inputs.push_back(NodeProperties::GetContextInput(node));
|
||||
@ -309,12 +211,11 @@ void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token,
|
||||
}
|
||||
|
||||
|
||||
void JSGenericLowering::ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub,
|
||||
void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable,
|
||||
CallDescriptor::Flags flags) {
|
||||
CallInterfaceDescriptor d = stub->GetCallInterfaceDescriptor();
|
||||
CallDescriptor* desc =
|
||||
linkage()->GetStubCallDescriptor(d, 0, flags | FlagsForNode(node));
|
||||
Node* stub_code = CodeConstant(stub->GetCode());
|
||||
CallDescriptor* desc = linkage()->GetStubCallDescriptor(
|
||||
callable.descriptor(), 0, flags | FlagsForNode(node));
|
||||
Node* stub_code = CodeConstant(callable.code());
|
||||
PatchInsertInput(node, 0, stub_code);
|
||||
PatchOperator(node, common()->Call(desc));
|
||||
}
|
||||
@ -323,14 +224,15 @@ void JSGenericLowering::ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub,
|
||||
void JSGenericLowering::ReplaceWithBuiltinCall(Node* node,
|
||||
Builtins::JavaScript id,
|
||||
int nargs) {
|
||||
CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS);
|
||||
CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
|
||||
CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, nargs);
|
||||
Callable callable =
|
||||
CodeFactory::CallFunction(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS);
|
||||
CallDescriptor* desc =
|
||||
linkage()->GetStubCallDescriptor(callable.descriptor(), nargs);
|
||||
// TODO(mstarzinger): Accessing the builtins object this way prevents sharing
|
||||
// of code across native contexts. Fix this by loading from given context.
|
||||
Handle<JSFunction> function(
|
||||
JSFunction::cast(info()->context()->builtins()->javascript_builtin(id)));
|
||||
Node* stub_code = CodeConstant(stub.GetCode());
|
||||
Node* stub_code = CodeConstant(callable.code());
|
||||
Node* function_node = FunctionConstant(function);
|
||||
PatchInsertInput(node, 0, stub_code);
|
||||
PatchInsertInput(node, 1, function_node);
|
||||
@ -372,15 +274,17 @@ Node* JSGenericLowering::LowerBranch(Node* node) {
|
||||
|
||||
|
||||
Node* JSGenericLowering::LowerJSUnaryNot(Node* node) {
|
||||
ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL);
|
||||
ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
|
||||
Callable callable = CodeFactory::ToBoolean(
|
||||
isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL);
|
||||
ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
Node* JSGenericLowering::LowerJSToBoolean(Node* node) {
|
||||
ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_ODDBALL);
|
||||
ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
|
||||
Callable callable =
|
||||
CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL);
|
||||
ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
|
||||
return node;
|
||||
}
|
||||
|
||||
@ -398,34 +302,34 @@ Node* JSGenericLowering::LowerJSToObject(Node* node) {
|
||||
|
||||
|
||||
Node* JSGenericLowering::LowerJSLoadProperty(Node* node) {
|
||||
KeyedLoadICStubShim stub(isolate());
|
||||
ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
|
||||
Callable callable = CodeFactory::KeyedLoadIC(isolate());
|
||||
ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
Node* JSGenericLowering::LowerJSLoadNamed(Node* node) {
|
||||
LoadNamedParameters p = OpParameter<LoadNamedParameters>(node);
|
||||
LoadICStubShim stub(isolate(), p.contextual_mode);
|
||||
PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name));
|
||||
ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
|
||||
Callable callable = CodeFactory::LoadIC(isolate(), p.contextual_mode);
|
||||
ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
Node* JSGenericLowering::LowerJSStoreProperty(Node* node) {
|
||||
StrictMode strict_mode = OpParameter<StrictMode>(node);
|
||||
KeyedStoreICStubShim stub(isolate(), strict_mode);
|
||||
ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
|
||||
Callable callable = CodeFactory::KeyedStoreIC(isolate(), strict_mode);
|
||||
ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
Node* JSGenericLowering::LowerJSStoreNamed(Node* node) {
|
||||
StoreNamedParameters params = OpParameter<StoreNamedParameters>(node);
|
||||
StoreICStubShim stub(isolate(), params.strict_mode);
|
||||
Callable callable = CodeFactory::StoreIC(isolate(), params.strict_mode);
|
||||
PatchInsertInput(node, 1, jsgraph()->HeapConstant(params.name));
|
||||
ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
|
||||
ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/v8.h"
|
||||
|
||||
#include "src/allocation.h"
|
||||
#include "src/code-factory.h"
|
||||
#include "src/compiler/graph.h"
|
||||
#include "src/compiler/graph-reducer.h"
|
||||
#include "src/compiler/js-graph.h"
|
||||
@ -16,10 +17,6 @@
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// Forward declarations.
|
||||
class HydrogenCodeStub;
|
||||
|
||||
namespace compiler {
|
||||
|
||||
// Forward declarations.
|
||||
@ -55,7 +52,7 @@ class JSGenericLowering : public Reducer {
|
||||
|
||||
// Helpers to replace existing nodes with a generic call.
|
||||
void ReplaceWithCompareIC(Node* node, Token::Value token, bool pure);
|
||||
void ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub,
|
||||
void ReplaceWithStubCall(Node* node, Callable callable,
|
||||
CallDescriptor::Flags flags);
|
||||
void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args);
|
||||
void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1);
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/code-factory.h"
|
||||
#include "src/compiler/pipeline.h"
|
||||
#include "src/compiler/raw-machine-assembler.h"
|
||||
#include "src/compiler/scheduler.h"
|
||||
@ -83,11 +84,10 @@ void RawMachineAssembler::Return(Node* value) {
|
||||
Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver,
|
||||
Node* context, Node* frame_state,
|
||||
CallFunctionFlags flags) {
|
||||
CallFunctionStub stub(isolate(), 0, flags);
|
||||
CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
|
||||
Callable callable = CodeFactory::CallFunction(isolate(), 0, flags);
|
||||
CallDescriptor* desc = Linkage::GetStubCallDescriptor(
|
||||
d, 1, CallDescriptor::kNeedsFrameState, zone());
|
||||
Node* stub_code = HeapConstant(stub.GetCode());
|
||||
callable.descriptor(), 1, CallDescriptor::kNeedsFrameState, zone());
|
||||
Node* stub_code = HeapConstant(callable.code());
|
||||
Node* call = graph()->NewNode(common()->Call(desc), stub_code, function,
|
||||
receiver, context, frame_state);
|
||||
schedule()->AddNode(CurrentBlock(), call);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "src/compiler/simplified-lowering.h"
|
||||
|
||||
#include "src/base/bits.h"
|
||||
#include "src/code-factory.h"
|
||||
#include "src/compiler/common-operator.h"
|
||||
#include "src/compiler/graph-inl.h"
|
||||
#include "src/compiler/node-properties-inl.h"
|
||||
@ -851,12 +852,13 @@ void SimplifiedLowering::DoStoreElement(Node* node) {
|
||||
|
||||
|
||||
void SimplifiedLowering::DoStringAdd(Node* node) {
|
||||
StringAddStub stub(zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
|
||||
CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
|
||||
Callable callable = CodeFactory::StringAdd(
|
||||
zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
|
||||
CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
|
||||
CallDescriptor* desc = Linkage::GetStubCallDescriptor(d, 0, flags, zone());
|
||||
CallDescriptor* desc =
|
||||
Linkage::GetStubCallDescriptor(callable.descriptor(), 0, flags, zone());
|
||||
node->set_op(common()->Call(desc));
|
||||
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(stub.GetCode()));
|
||||
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(callable.code()));
|
||||
node->AppendInput(zone(), jsgraph()->UndefinedConstant());
|
||||
node->AppendInput(zone(), graph()->start());
|
||||
node->AppendInput(zone(), graph()->start());
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "src/v8.h"
|
||||
|
||||
#include "src/code-factory.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/compiler.h"
|
||||
#include "src/debug.h"
|
||||
@ -408,14 +409,13 @@ void FullCodeGenerator::PrepareForBailout(Expression* node, State state) {
|
||||
|
||||
void FullCodeGenerator::CallLoadIC(ContextualMode contextual_mode,
|
||||
TypeFeedbackId id) {
|
||||
ExtraICState extra_state = LoadIC::ComputeExtraICState(contextual_mode);
|
||||
Handle<Code> ic = LoadIC::initialize_stub(isolate(), extra_state);
|
||||
Handle<Code> ic = CodeFactory::LoadIC(isolate(), contextual_mode).code();
|
||||
CallIC(ic, id);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::CallStoreIC(TypeFeedbackId id) {
|
||||
Handle<Code> ic = StoreIC::initialize_stub(isolate(), strict_mode());
|
||||
Handle<Code> ic = CodeFactory::StoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic, id);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#if V8_TARGET_ARCH_IA32
|
||||
|
||||
#include "src/code-factory.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/full-codegen.h"
|
||||
@ -1006,7 +1007,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
|
||||
__ mov(VectorLoadICDescriptor::SlotRegister(),
|
||||
Immediate(Smi::FromInt(0)));
|
||||
}
|
||||
Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(masm->isolate()).code();
|
||||
__ call(ic, RelocInfo::CODE_TARGET);
|
||||
// It is important that we do not have a test instruction after the
|
||||
// call. A test instruction after the call is used to indicate that
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#if V8_TARGET_ARCH_IA32
|
||||
|
||||
#include "src/code-factory.h"
|
||||
#include "src/code-stubs.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/compiler.h"
|
||||
@ -987,7 +988,8 @@ 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);
|
||||
Handle<Code> ic =
|
||||
CodeFactory::CompareIC(isolate(), Token::EQ_STRICT).code();
|
||||
CallIC(ic, clause->CompareId());
|
||||
patch_site.EmitPatchInfo();
|
||||
|
||||
@ -2024,7 +2026,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
||||
__ mov(VectorLoadICDescriptor::SlotRegister(),
|
||||
Immediate(Smi::FromInt(expr->KeyedLoadFeedbackSlot())));
|
||||
}
|
||||
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
CallIC(ic, TypeFeedbackId::None());
|
||||
__ mov(edi, eax);
|
||||
__ mov(Operand(esp, 2 * kPointerSize), edi);
|
||||
@ -2230,7 +2232,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
||||
|
||||
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
|
||||
SetSourcePosition(prop->position());
|
||||
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
if (FLAG_vector_ics) {
|
||||
__ mov(VectorLoadICDescriptor::SlotRegister(),
|
||||
Immediate(Smi::FromInt(prop->PropertyFeedbackSlot())));
|
||||
@ -2257,8 +2259,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
|
||||
|
||||
__ bind(&stub_call);
|
||||
__ mov(eax, ecx);
|
||||
BinaryOpICStub stub(isolate(), op, mode);
|
||||
CallIC(stub.GetCode(), expr->BinaryOperationFeedbackId());
|
||||
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
|
||||
CallIC(code, expr->BinaryOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
__ jmp(&done, Label::kNear);
|
||||
|
||||
@ -2340,9 +2342,9 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
|
||||
Token::Value op,
|
||||
OverwriteMode mode) {
|
||||
__ pop(edx);
|
||||
BinaryOpICStub stub(isolate(), op, mode);
|
||||
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
|
||||
JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
|
||||
CallIC(stub.GetCode(), expr->BinaryOperationFeedbackId());
|
||||
CallIC(code, expr->BinaryOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
context()->Plug(eax);
|
||||
}
|
||||
@ -2386,9 +2388,8 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
||||
__ Move(StoreDescriptor::NameRegister(), eax);
|
||||
__ pop(StoreDescriptor::ReceiverRegister()); // Receiver.
|
||||
__ pop(StoreDescriptor::ValueRegister()); // Restore value.
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic);
|
||||
break;
|
||||
}
|
||||
@ -2505,9 +2506,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
||||
DCHECK(StoreDescriptor::ValueRegister().is(eax));
|
||||
// Record source code position before IC call.
|
||||
SetSourcePosition(expr->position());
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic = CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic, expr->AssignmentFeedbackId());
|
||||
|
||||
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
||||
@ -4325,8 +4324,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
__ bind(&stub_call);
|
||||
__ mov(edx, eax);
|
||||
__ mov(eax, Immediate(Smi::FromInt(1)));
|
||||
BinaryOpICStub stub(isolate(), expr->binary_op(), NO_OVERWRITE);
|
||||
CallIC(stub.GetCode(), expr->CountBinOpFeedbackId());
|
||||
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(),
|
||||
NO_OVERWRITE).code();
|
||||
CallIC(code, expr->CountBinOpFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
__ bind(&done);
|
||||
|
||||
@ -4372,9 +4372,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
case KEYED_PROPERTY: {
|
||||
__ pop(StoreDescriptor::NameRegister());
|
||||
__ pop(StoreDescriptor::ReceiverRegister());
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic, expr->CountStoreFeedbackId());
|
||||
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
||||
if (expr->is_postfix()) {
|
||||
@ -4563,7 +4562,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
|
||||
|
||||
// Record position and call the compare IC.
|
||||
SetSourcePosition(expr->position());
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallIC(ic, expr->CompareOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#if V8_TARGET_ARCH_IA32
|
||||
|
||||
#include "src/base/bits.h"
|
||||
#include "src/code-factory.h"
|
||||
#include "src/code-stubs.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/deoptimizer.h"
|
||||
@ -2033,8 +2034,9 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
|
||||
DCHECK(ToRegister(instr->right()).is(eax));
|
||||
DCHECK(ToRegister(instr->result()).is(eax));
|
||||
|
||||
BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE);
|
||||
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
|
||||
Handle<Code> code =
|
||||
CodeFactory::BinaryOpIC(isolate(), instr->op(), NO_OVERWRITE).code();
|
||||
CallCode(code, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
|
||||
@ -2459,7 +2461,7 @@ static Condition ComputeCompareCondition(Token::Value op) {
|
||||
void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
|
||||
Token::Value op = instr->op();
|
||||
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
|
||||
Condition condition = ComputeCompareCondition(op);
|
||||
@ -2730,7 +2732,7 @@ void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
|
||||
void LCodeGen::DoCmpT(LCmpT* instr) {
|
||||
Token::Value op = instr->op();
|
||||
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
|
||||
Condition condition = ComputeCompareCondition(op);
|
||||
@ -2854,7 +2856,7 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
|
||||
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
|
||||
}
|
||||
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
|
||||
Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode);
|
||||
Handle<Code> ic = CodeFactory::LoadIC(isolate(), mode).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
@ -2990,7 +2992,7 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
|
||||
if (FLAG_vector_ics) {
|
||||
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
|
||||
}
|
||||
Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL);
|
||||
Handle<Code> ic = CodeFactory::LoadIC(isolate(), NOT_CONTEXTUAL).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
@ -3216,7 +3218,7 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
|
||||
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
|
||||
}
|
||||
|
||||
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
@ -4282,9 +4284,8 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
|
||||
DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
|
||||
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
|
||||
|
||||
Handle<Code> ic = instr->strict_mode() == STRICT
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#if V8_TARGET_ARCH_X64
|
||||
|
||||
#include "src/code-factory.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/full-codegen.h"
|
||||
@ -1076,8 +1077,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
|
||||
if (FLAG_vector_ics) {
|
||||
__ Move(VectorLoadICDescriptor::SlotRegister(), Smi::FromInt(0));
|
||||
}
|
||||
Handle<Code> ic =
|
||||
masm->isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(masm->isolate()).code();
|
||||
__ Call(ic, RelocInfo::CODE_TARGET);
|
||||
// It is important that we do not have a test instruction after the
|
||||
// call. A test instruction after the call is used to indicate that
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#if V8_TARGET_ARCH_X64
|
||||
|
||||
#include "src/code-factory.h"
|
||||
#include "src/code-stubs.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/compiler.h"
|
||||
@ -1010,7 +1011,8 @@ 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);
|
||||
Handle<Code> ic =
|
||||
CodeFactory::CompareIC(isolate(), Token::EQ_STRICT).code();
|
||||
CallIC(ic, clause->CompareId());
|
||||
patch_site.EmitPatchInfo();
|
||||
|
||||
@ -2057,7 +2059,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
||||
__ Move(VectorLoadICDescriptor::SlotRegister(),
|
||||
Smi::FromInt(expr->KeyedLoadFeedbackSlot()));
|
||||
}
|
||||
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
CallIC(ic, TypeFeedbackId::None());
|
||||
__ movp(rdi, rax);
|
||||
__ movp(Operand(rsp, 2 * kPointerSize), rdi);
|
||||
@ -2262,7 +2264,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
||||
|
||||
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
|
||||
SetSourcePosition(prop->position());
|
||||
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
if (FLAG_vector_ics) {
|
||||
__ Move(VectorLoadICDescriptor::SlotRegister(),
|
||||
Smi::FromInt(prop->PropertyFeedbackSlot()));
|
||||
@ -2290,8 +2292,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
|
||||
|
||||
__ bind(&stub_call);
|
||||
__ movp(rax, rcx);
|
||||
BinaryOpICStub stub(isolate(), op, mode);
|
||||
CallIC(stub.GetCode(), expr->BinaryOperationFeedbackId());
|
||||
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
|
||||
CallIC(code, expr->BinaryOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
__ jmp(&done, Label::kNear);
|
||||
|
||||
@ -2338,9 +2340,9 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
|
||||
Token::Value op,
|
||||
OverwriteMode mode) {
|
||||
__ Pop(rdx);
|
||||
BinaryOpICStub stub(isolate(), op, mode);
|
||||
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
|
||||
JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
|
||||
CallIC(stub.GetCode(), expr->BinaryOperationFeedbackId());
|
||||
CallIC(code, expr->BinaryOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
context()->Plug(rax);
|
||||
}
|
||||
@ -2384,9 +2386,8 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
||||
__ Move(StoreDescriptor::NameRegister(), rax);
|
||||
__ Pop(StoreDescriptor::ReceiverRegister());
|
||||
__ Pop(StoreDescriptor::ValueRegister()); // Restore value.
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic);
|
||||
break;
|
||||
}
|
||||
@ -2498,9 +2499,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
||||
DCHECK(StoreDescriptor::ValueRegister().is(rax));
|
||||
// Record source code position before IC call.
|
||||
SetSourcePosition(expr->position());
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic = CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic, expr->AssignmentFeedbackId());
|
||||
|
||||
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
||||
@ -4333,8 +4332,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
__ bind(&stub_call);
|
||||
__ movp(rdx, rax);
|
||||
__ Move(rax, Smi::FromInt(1));
|
||||
BinaryOpICStub stub(isolate(), expr->binary_op(), NO_OVERWRITE);
|
||||
CallIC(stub.GetCode(), expr->CountBinOpFeedbackId());
|
||||
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(),
|
||||
NO_OVERWRITE).code();
|
||||
CallIC(code, expr->CountBinOpFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
__ bind(&done);
|
||||
|
||||
@ -4380,9 +4380,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
case KEYED_PROPERTY: {
|
||||
__ Pop(StoreDescriptor::NameRegister());
|
||||
__ Pop(StoreDescriptor::ReceiverRegister());
|
||||
Handle<Code> ic = strict_mode() == SLOPPY
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
|
||||
CallIC(ic, expr->CountStoreFeedbackId());
|
||||
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
||||
if (expr->is_postfix()) {
|
||||
@ -4570,7 +4569,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
|
||||
|
||||
// Record position and call the compare IC.
|
||||
SetSourcePosition(expr->position());
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallIC(ic, expr->CompareOperationFeedbackId());
|
||||
patch_site.EmitPatchInfo();
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#if V8_TARGET_ARCH_X64
|
||||
|
||||
#include "src/base/bits.h"
|
||||
#include "src/code-factory.h"
|
||||
#include "src/code-stubs.h"
|
||||
#include "src/hydrogen-osr.h"
|
||||
#include "src/ic/stub-cache.h"
|
||||
@ -2058,8 +2059,9 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
|
||||
DCHECK(ToRegister(instr->right()).is(rax));
|
||||
DCHECK(ToRegister(instr->result()).is(rax));
|
||||
|
||||
BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE);
|
||||
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
|
||||
Handle<Code> code =
|
||||
CodeFactory::BinaryOpIC(isolate(), instr->op(), NO_OVERWRITE).code();
|
||||
CallCode(code, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
|
||||
@ -2501,7 +2503,7 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
|
||||
DCHECK(ToRegister(instr->context()).is(rsi));
|
||||
Token::Value op = instr->op();
|
||||
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
|
||||
Condition condition = TokenToCondition(op, false);
|
||||
@ -2785,7 +2787,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) {
|
||||
DCHECK(ToRegister(instr->context()).is(rsi));
|
||||
Token::Value op = instr->op();
|
||||
|
||||
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
|
||||
Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
|
||||
Condition condition = TokenToCondition(op, false);
|
||||
@ -2872,7 +2874,7 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
|
||||
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
|
||||
}
|
||||
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
|
||||
Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode);
|
||||
Handle<Code> ic = CodeFactory::LoadIC(isolate(), mode).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
@ -3014,7 +3016,7 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
|
||||
if (FLAG_vector_ics) {
|
||||
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
|
||||
}
|
||||
Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL);
|
||||
Handle<Code> ic = CodeFactory::LoadIC(isolate(), NOT_CONTEXTUAL).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
@ -3296,7 +3298,7 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
|
||||
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
|
||||
}
|
||||
|
||||
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
||||
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
@ -4483,9 +4485,8 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
|
||||
DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
|
||||
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
|
||||
|
||||
Handle<Code> ic = instr->strict_mode() == STRICT
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize();
|
||||
Handle<Code> ic =
|
||||
CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code();
|
||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
||||
}
|
||||
|
||||
|
@ -364,6 +364,8 @@
|
||||
'../../src/checks.h',
|
||||
'../../src/circular-queue-inl.h',
|
||||
'../../src/circular-queue.h',
|
||||
'../../src/code-factory.cc',
|
||||
'../../src/code-factory.h',
|
||||
'../../src/code-stubs.cc',
|
||||
'../../src/code-stubs.h',
|
||||
'../../src/code-stubs-hydrogen.cc',
|
||||
|
Loading…
Reference in New Issue
Block a user