Simplify IC interfaces

BUG=

Review URL: https://codereview.chromium.org/1865873002

Cr-Commit-Position: refs/heads/master@{#35301}
This commit is contained in:
verwaest 2016-04-06 06:36:49 -07:00 committed by Commit bot
parent 604f5be5f7
commit 911a5768dc
6 changed files with 22 additions and 100 deletions

View File

@ -13,9 +13,8 @@ namespace internal {
// static
Callable CodeFactory::LoadIC(Isolate* isolate, TypeofMode typeof_mode) {
return Callable(LoadIC::initialize_stub(
isolate, LoadICState(typeof_mode).GetExtraICState()),
LoadDescriptor(isolate));
LoadICTrampolineStub stub(isolate, LoadICState(typeof_mode));
return Callable(stub.GetCode(), LoadDescriptor(isolate));
}
@ -32,8 +31,8 @@ Callable CodeFactory::LoadICInOptimizedCode(
// static
Callable CodeFactory::KeyedLoadIC(Isolate* isolate) {
return Callable(KeyedLoadIC::initialize_stub(isolate, kNoExtraICState),
LoadDescriptor(isolate));
KeyedLoadICTrampolineStub stub(isolate, LoadICState(kNoExtraICState));
return Callable(stub.GetCode(), LoadDescriptor(isolate));
}
@ -53,8 +52,8 @@ Callable CodeFactory::KeyedLoadICInOptimizedCode(
Callable CodeFactory::CallIC(Isolate* isolate, int argc,
ConvertReceiverMode mode,
TailCallMode tail_call_mode) {
return Callable(CallIC::initialize_stub(isolate, argc, mode, tail_call_mode),
CallFunctionWithFeedbackDescriptor(isolate));
CallICTrampolineStub stub(isolate, CallICState(argc, mode, tail_call_mode));
return Callable(stub.GetCode(), CallFunctionWithFeedbackDescriptor(isolate));
}
@ -70,9 +69,8 @@ Callable CodeFactory::CallICInOptimizedCode(Isolate* isolate, int argc,
// static
Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) {
return Callable(
StoreIC::initialize_stub(isolate, language_mode, UNINITIALIZED),
VectorStoreICTrampolineDescriptor(isolate));
VectorStoreICTrampolineStub stub(isolate, StoreICState(language_mode));
return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate));
}
@ -92,9 +90,8 @@ Callable CodeFactory::StoreICInOptimizedCode(
// static
Callable CodeFactory::KeyedStoreIC(Isolate* isolate,
LanguageMode language_mode) {
return Callable(
KeyedStoreIC::initialize_stub(isolate, language_mode, UNINITIALIZED),
VectorStoreICTrampolineDescriptor(isolate));
VectorKeyedStoreICTrampolineStub stub(isolate, StoreICState(language_mode));
return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate));
}

View File

@ -794,25 +794,11 @@ void IC::PatchCache(Handle<Name> name, Handle<Code> code) {
}
}
Handle<Code> LoadIC::initialize_stub(Isolate* isolate,
ExtraICState extra_state) {
return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode();
}
Handle<Code> LoadIC::initialize_stub_in_optimized_code(
Isolate* isolate, ExtraICState extra_state, State initialization_state) {
return LoadICStub(isolate, LoadICState(extra_state)).GetCode();
}
Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate,
ExtraICState extra_state) {
return KeyedLoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode();
}
Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code(
Isolate* isolate, State initialization_state, ExtraICState extra_state) {
if (initialization_state != MEGAMORPHIC) {
@ -822,50 +808,22 @@ Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code(
}
static Handle<Code> KeyedStoreICInitializeStubHelper(
Isolate* isolate, LanguageMode language_mode,
InlineCacheState initialization_state) {
switch (initialization_state) {
case MEGAMORPHIC:
return is_strict(language_mode)
? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict()
: isolate->builtins()->KeyedStoreIC_Megamorphic();
default:
UNREACHABLE();
}
return Handle<Code>();
}
Handle<Code> KeyedStoreIC::initialize_stub(Isolate* isolate,
LanguageMode language_mode,
State initialization_state) {
if (initialization_state != MEGAMORPHIC) {
VectorKeyedStoreICTrampolineStub stub(isolate, StoreICState(language_mode));
return stub.GetCode();
}
return KeyedStoreICInitializeStubHelper(isolate, language_mode,
initialization_state);
}
Handle<Code> KeyedStoreIC::initialize_stub_in_optimized_code(
Isolate* isolate, LanguageMode language_mode, State initialization_state) {
StoreICState state = StoreICState(language_mode);
if (initialization_state != MEGAMORPHIC) {
VectorKeyedStoreICStub stub(isolate, StoreICState(language_mode));
return stub.GetCode();
return VectorKeyedStoreICStub(isolate, state).GetCode();
}
return KeyedStoreICInitializeStubHelper(isolate, language_mode,
initialization_state);
return ChooseMegamorphicStub(isolate, state.GetExtraICState());
}
Handle<Code> KeyedStoreIC::ChooseMegamorphicStub(Isolate* isolate,
ExtraICState extra_state) {
LanguageMode mode = StoreICState::GetLanguageMode(extra_state);
return KeyedStoreICInitializeStubHelper(isolate, mode, MEGAMORPHIC);
return is_strict(mode)
? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict()
: isolate->builtins()->KeyedStoreIC_Megamorphic();
}
@ -1454,14 +1412,6 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name,
return value;
}
Handle<Code> CallIC::initialize_stub(Isolate* isolate, int argc,
ConvertReceiverMode mode,
TailCallMode tail_call_mode) {
CallICTrampolineStub stub(isolate, CallICState(argc, mode, tail_call_mode));
Handle<Code> code = stub.GetCode();
return code;
}
Handle<Code> CallIC::initialize_stub_in_optimized_code(
Isolate* isolate, int argc, ConvertReceiverMode mode,
TailCallMode tail_call_mode) {
@ -1471,17 +1421,6 @@ Handle<Code> CallIC::initialize_stub_in_optimized_code(
}
Handle<Code> StoreIC::initialize_stub(Isolate* isolate,
LanguageMode language_mode,
State initialization_state) {
DCHECK(initialization_state == UNINITIALIZED ||
initialization_state == PREMONOMORPHIC ||
initialization_state == MEGAMORPHIC);
VectorStoreICTrampolineStub stub(isolate, StoreICState(language_mode));
return stub.GetCode();
}
Handle<Code> StoreIC::initialize_stub_in_optimized_code(
Isolate* isolate, LanguageMode language_mode, State initialization_state) {
DCHECK(initialization_state == UNINITIALIZED ||

View File

@ -257,9 +257,6 @@ class CallIC : public IC {
void HandleMiss(Handle<Object> function);
// Code generator routines.
static Handle<Code> initialize_stub(Isolate* isolate, int argc,
ConvertReceiverMode mode,
TailCallMode tail_call_mode);
static Handle<Code> initialize_stub_in_optimized_code(
Isolate* isolate, int argc, ConvertReceiverMode mode,
TailCallMode tail_call_mode);
@ -294,8 +291,6 @@ class LoadIC : public IC {
static void GenerateRuntimeGetProperty(MacroAssembler* masm);
static void GenerateNormal(MacroAssembler* masm);
static Handle<Code> initialize_stub(Isolate* isolate,
ExtraICState extra_state);
static Handle<Code> initialize_stub_in_optimized_code(
Isolate* isolate, ExtraICState extra_state, State initialization_state);
@ -365,8 +360,6 @@ class KeyedLoadIC : public LoadIC {
static const int kSlowCaseBitFieldMask =
(1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
static Handle<Code> initialize_stub(Isolate* isolate,
ExtraICState extra_state);
static Handle<Code> initialize_stub_in_optimized_code(
Isolate* isolate, State initialization_state, ExtraICState extra_state);
static Handle<Code> ChooseMegamorphicStub(Isolate* isolate,
@ -406,9 +399,6 @@ class StoreIC : public IC {
static void GenerateRuntimeSetProperty(MacroAssembler* masm,
LanguageMode language_mode);
static Handle<Code> initialize_stub(Isolate* isolate,
LanguageMode language_mode,
State initialization_state);
static Handle<Code> initialize_stub_in_optimized_code(
Isolate* isolate, LanguageMode language_mode, State initialization_state);
@ -480,10 +470,6 @@ class KeyedStoreIC : public StoreIC {
static void GenerateMegamorphic(MacroAssembler* masm,
LanguageMode language_mode);
static Handle<Code> initialize_stub(Isolate* isolate,
LanguageMode language_mode,
State initialization_state);
static Handle<Code> initialize_stub_in_optimized_code(
Isolate* isolate, LanguageMode language_mode, State initialization_state);
static Handle<Code> ChooseMegamorphicStub(Isolate* isolate,

View File

@ -29,11 +29,11 @@
#include "src/v8.h"
#include "src/code-factory.h"
#include "src/debug/debug.h"
#include "src/disasm.h"
#include "src/disassembler.h"
#include "src/ia32/frames-ia32.h"
#include "src/ic/ic.h"
#include "src/macro-assembler.h"
#include "test/cctest/cctest.h"
@ -290,7 +290,7 @@ TEST(DisasmIa320) {
__ bind(&L2);
__ call(Operand(ebx, ecx, times_4, 10000));
__ nop();
Handle<Code> ic(LoadIC::initialize_stub(isolate, NOT_INSIDE_TYPEOF));
Handle<Code> ic(CodeFactory::LoadIC(isolate, NOT_INSIDE_TYPEOF).code());
__ call(ic, RelocInfo::CODE_TARGET);
__ nop();
__ call(FUNCTION_ADDR(DummyStaticFunction), RelocInfo::RUNTIME_ENTRY);

View File

@ -29,10 +29,10 @@
#include "src/v8.h"
#include "src/code-factory.h"
#include "src/debug/debug.h"
#include "src/disasm.h"
#include "src/disassembler.h"
#include "src/ic/ic.h"
#include "src/macro-assembler.h"
#include "test/cctest/cctest.h"
@ -282,7 +282,7 @@ TEST(DisasmX64) {
// TODO(mstarzinger): The following is protected.
// __ call(Operand(rbx, rcx, times_4, 10000));
__ nop();
Handle<Code> ic(LoadIC::initialize_stub(isolate, NOT_INSIDE_TYPEOF));
Handle<Code> ic(CodeFactory::LoadIC(isolate, NOT_INSIDE_TYPEOF).code());
__ call(ic, RelocInfo::CODE_TARGET);
__ nop();
__ nop();

View File

@ -29,10 +29,10 @@
#include "src/v8.h"
#include "src/code-factory.h"
#include "src/debug/debug.h"
#include "src/disasm.h"
#include "src/disassembler.h"
#include "src/ic/ic.h"
#include "src/macro-assembler.h"
#include "src/x87/frames-x87.h"
#include "test/cctest/cctest.h"
@ -290,7 +290,7 @@ TEST(DisasmIa320) {
__ bind(&L2);
__ call(Operand(ebx, ecx, times_4, 10000));
__ nop();
Handle<Code> ic(LoadIC::initialize_stub(isolate, NOT_INSIDE_TYPEOF));
Handle<Code> ic(CodeFactory::LoadIC(isolate, NOT_INSIDE_TYPEOF));
__ call(ic, RelocInfo::CODE_TARGET);
__ nop();
__ call(FUNCTION_ADDR(DummyStaticFunction), RelocInfo::RUNTIME_ENTRY);