Commit 89f5efb7 authored by jkummerow's avatar jkummerow Committed by Commit bot

[ic] Clean up handler boilerplate

- builtins-ic.cc takes the place of the AccessorAssembler shim
- AccessorAssemblerImpl can then be renamed
- some cleanup in code-factory.cc
- drop old _TF name suffixes
- fix Generate##Name##Impl in TF_BUILTIN macro

Review-Url: https://codereview.chromium.org/2647493002
Cr-Commit-Position: refs/heads/master@{#42520}
parent 5e44cc79
...@@ -1455,7 +1455,6 @@ v8_source_set("v8_base") { ...@@ -1455,7 +1455,6 @@ v8_source_set("v8_base") {
"src/ic/access-compiler-data.h", "src/ic/access-compiler-data.h",
"src/ic/access-compiler.cc", "src/ic/access-compiler.cc",
"src/ic/access-compiler.h", "src/ic/access-compiler.h",
"src/ic/accessor-assembler-impl.h",
"src/ic/accessor-assembler.cc", "src/ic/accessor-assembler.cc",
"src/ic/accessor-assembler.h", "src/ic/accessor-assembler.h",
"src/ic/call-optimization.cc", "src/ic/call-optimization.cc",
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "src/builtins/builtins-utils.h" #include "src/builtins/builtins-utils.h"
#include "src/builtins/builtins.h" #include "src/builtins/builtins.h"
#include "src/code-stub-assembler.h" #include "src/code-stub-assembler.h"
#include "src/ic/accessor-assembler.h"
#include "src/ic/handler-compiler.h" #include "src/ic/handler-compiler.h"
#include "src/ic/ic.h" #include "src/ic/ic.h"
#include "src/ic/keyed-store-generic.h" #include "src/ic/keyed-store-generic.h"
...@@ -13,45 +12,35 @@ ...@@ -13,45 +12,35 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
void Builtins::Generate_KeyedLoadIC_Megamorphic_TF( TF_BUILTIN(KeyedLoadIC_Miss, CodeStubAssembler) {
compiler::CodeAssemblerState* state) {
AccessorAssembler::GenerateKeyedLoadICMegamorphic(state);
}
void Builtins::Generate_KeyedLoadIC_Miss(compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
typedef LoadWithVectorDescriptor Descriptor; typedef LoadWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* receiver = assembler.Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* slot = assembler.Parameter(Descriptor::kSlot); Node* slot = Parameter(Descriptor::kSlot);
Node* vector = assembler.Parameter(Descriptor::kVector); Node* vector = Parameter(Descriptor::kVector);
Node* context = assembler.Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
assembler.TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, name, TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, name, slot,
slot, vector); vector);
} }
void Builtins::Generate_KeyedLoadIC_Slow(compiler::CodeAssemblerState* state) { TF_BUILTIN(KeyedLoadIC_Slow, CodeStubAssembler) {
typedef compiler::Node Node;
typedef LoadWithVectorDescriptor Descriptor; typedef LoadWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* receiver = assembler.Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* context = assembler.Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
assembler.TailCallRuntime(Runtime::kKeyedGetProperty, context, receiver, TailCallRuntime(Runtime::kKeyedGetProperty, context, receiver, name);
name);
} }
void Builtins::Generate_KeyedStoreIC_Megamorphic_TF( void Builtins::Generate_KeyedStoreIC_Megamorphic(
compiler::CodeAssemblerState* state) { compiler::CodeAssemblerState* state) {
KeyedStoreGenericGenerator::Generate(state, SLOPPY); KeyedStoreGenericGenerator::Generate(state, SLOPPY);
} }
void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict_TF( void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict(
compiler::CodeAssemblerState* state) { compiler::CodeAssemblerState* state) {
KeyedStoreGenericGenerator::Generate(state, STRICT); KeyedStoreGenericGenerator::Generate(state, STRICT);
} }
...@@ -64,48 +53,40 @@ void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { ...@@ -64,48 +53,40 @@ void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) {
KeyedStoreIC::GenerateSlow(masm); KeyedStoreIC::GenerateSlow(masm);
} }
void Builtins::Generate_LoadGlobalIC_Miss(compiler::CodeAssemblerState* state) { TF_BUILTIN(LoadGlobalIC_Miss, CodeStubAssembler) {
typedef compiler::Node Node;
typedef LoadGlobalWithVectorDescriptor Descriptor; typedef LoadGlobalWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* name = assembler.Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* slot = assembler.Parameter(Descriptor::kSlot); Node* slot = Parameter(Descriptor::kSlot);
Node* vector = assembler.Parameter(Descriptor::kVector); Node* vector = Parameter(Descriptor::kVector);
Node* context = assembler.Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
assembler.TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, name, slot, TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, name, slot, vector);
vector);
} }
void Builtins::Generate_LoadGlobalIC_Slow(compiler::CodeAssemblerState* state) { TF_BUILTIN(LoadGlobalIC_Slow, CodeStubAssembler) {
typedef compiler::Node Node;
typedef LoadGlobalWithVectorDescriptor Descriptor; typedef LoadGlobalWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* name = assembler.Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* context = assembler.Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
assembler.TailCallRuntime(Runtime::kLoadGlobalIC_Slow, context, name); TailCallRuntime(Runtime::kLoadGlobalIC_Slow, context, name);
} }
void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) {
NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm); NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm);
} }
void Builtins::Generate_LoadIC_Miss(compiler::CodeAssemblerState* state) { TF_BUILTIN(LoadIC_Miss, CodeStubAssembler) {
typedef compiler::Node Node;
typedef LoadWithVectorDescriptor Descriptor; typedef LoadWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* receiver = assembler.Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* slot = assembler.Parameter(Descriptor::kSlot); Node* slot = Parameter(Descriptor::kSlot);
Node* vector = assembler.Parameter(Descriptor::kVector); Node* vector = Parameter(Descriptor::kVector);
Node* context = assembler.Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
assembler.TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name, TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name, slot, vector);
slot, vector);
} }
TF_BUILTIN(LoadIC_Normal, CodeStubAssembler) { TF_BUILTIN(LoadIC_Normal, CodeStubAssembler) {
...@@ -138,32 +119,28 @@ TF_BUILTIN(LoadIC_Normal, CodeStubAssembler) { ...@@ -138,32 +119,28 @@ TF_BUILTIN(LoadIC_Normal, CodeStubAssembler) {
TailCallRuntime(Runtime::kGetProperty, context, receiver, name); TailCallRuntime(Runtime::kGetProperty, context, receiver, name);
} }
void Builtins::Generate_LoadIC_Slow(compiler::CodeAssemblerState* state) { TF_BUILTIN(LoadIC_Slow, CodeStubAssembler) {
typedef compiler::Node Node;
typedef LoadWithVectorDescriptor Descriptor; typedef LoadWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* receiver = assembler.Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* context = assembler.Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
assembler.TailCallRuntime(Runtime::kGetProperty, context, receiver, name); TailCallRuntime(Runtime::kGetProperty, context, receiver, name);
} }
void Builtins::Generate_StoreIC_Miss(compiler::CodeAssemblerState* state) { TF_BUILTIN(StoreIC_Miss, CodeStubAssembler) {
typedef compiler::Node Node;
typedef StoreWithVectorDescriptor Descriptor; typedef StoreWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* receiver = assembler.Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* value = assembler.Parameter(Descriptor::kValue); Node* value = Parameter(Descriptor::kValue);
Node* slot = assembler.Parameter(Descriptor::kSlot); Node* slot = Parameter(Descriptor::kSlot);
Node* vector = assembler.Parameter(Descriptor::kVector); Node* vector = Parameter(Descriptor::kVector);
Node* context = assembler.Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, vector,
vector, receiver, name); receiver, name);
} }
TF_BUILTIN(StoreIC_Normal, CodeStubAssembler) { TF_BUILTIN(StoreIC_Normal, CodeStubAssembler) {
......
...@@ -4,75 +4,47 @@ ...@@ -4,75 +4,47 @@
#include "src/builtins/builtins-utils.h" #include "src/builtins/builtins-utils.h"
#include "src/builtins/builtins.h" #include "src/builtins/builtins.h"
#include "src/code-stub-assembler.h"
#include "src/ic/accessor-assembler.h" #include "src/ic/accessor-assembler.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
TF_BUILTIN(LoadIC, CodeStubAssembler) { #define IC_BUILTIN(Name) \
AccessorAssembler::GenerateLoadIC(state()); void Builtins::Generate_##Name(compiler::CodeAssemblerState* state) { \
} AccessorAssembler assembler(state); \
assembler.Generate##Name(); \
TF_BUILTIN(KeyedLoadIC, CodeStubAssembler) { }
AccessorAssembler::GenerateKeyedLoadICTF(state());
} #define IC_BUILTIN_PARAM(BuiltinName, GeneratorName, parameter) \
void Builtins::Generate_##BuiltinName(compiler::CodeAssemblerState* state) { \
TF_BUILTIN(LoadICTrampoline, CodeStubAssembler) { AccessorAssembler assembler(state); \
AccessorAssembler::GenerateLoadICTrampoline(state()); assembler.Generate##GeneratorName(parameter); \
} }
TF_BUILTIN(KeyedLoadICTrampoline, CodeStubAssembler) { IC_BUILTIN(LoadIC)
AccessorAssembler::GenerateKeyedLoadICTrampolineTF(state()); IC_BUILTIN(KeyedLoadIC)
} IC_BUILTIN(LoadICTrampoline)
IC_BUILTIN(LoadField)
TF_BUILTIN(StoreIC, CodeStubAssembler) { IC_BUILTIN(KeyedLoadICTrampoline)
AccessorAssembler::GenerateStoreIC(state()); IC_BUILTIN(KeyedLoadIC_Megamorphic)
} IC_BUILTIN(StoreIC)
IC_BUILTIN(StoreICTrampoline)
TF_BUILTIN(StoreICTrampoline, CodeStubAssembler) {
AccessorAssembler::GenerateStoreICTrampoline(state()); IC_BUILTIN_PARAM(StoreICStrict, StoreIC, /* no param */)
} IC_BUILTIN_PARAM(StoreICStrictTrampoline, StoreICTrampoline, /* no param */)
TF_BUILTIN(StoreICStrict, CodeStubAssembler) { IC_BUILTIN_PARAM(KeyedStoreIC, KeyedStoreIC, SLOPPY)
AccessorAssembler::GenerateStoreIC(state()); IC_BUILTIN_PARAM(KeyedStoreICTrampoline, KeyedStoreICTrampoline, SLOPPY)
} IC_BUILTIN_PARAM(KeyedStoreICStrict, KeyedStoreIC, STRICT)
IC_BUILTIN_PARAM(KeyedStoreICStrictTrampoline, KeyedStoreICTrampoline, STRICT)
TF_BUILTIN(StoreICStrictTrampoline, CodeStubAssembler) { IC_BUILTIN_PARAM(LoadGlobalIC, LoadGlobalIC, NOT_INSIDE_TYPEOF)
AccessorAssembler::GenerateStoreICTrampoline(state()); IC_BUILTIN_PARAM(LoadGlobalICInsideTypeof, LoadGlobalIC, INSIDE_TYPEOF)
} IC_BUILTIN_PARAM(LoadGlobalICTrampoline, LoadGlobalICTrampoline,
NOT_INSIDE_TYPEOF)
TF_BUILTIN(KeyedStoreIC, CodeStubAssembler) { IC_BUILTIN_PARAM(LoadGlobalICInsideTypeofTrampoline, LoadGlobalICTrampoline,
AccessorAssembler::GenerateKeyedStoreICTF(state(), SLOPPY); INSIDE_TYPEOF)
} IC_BUILTIN_PARAM(LoadICProtoArray, LoadICProtoArray, false)
IC_BUILTIN_PARAM(LoadICProtoArrayThrowIfNonexistent, LoadICProtoArray, true)
TF_BUILTIN(KeyedStoreICTrampoline, CodeStubAssembler) {
AccessorAssembler::GenerateKeyedStoreICTrampolineTF(state(), SLOPPY);
}
TF_BUILTIN(KeyedStoreICStrict, CodeStubAssembler) {
AccessorAssembler::GenerateKeyedStoreICTF(state(), STRICT);
}
TF_BUILTIN(KeyedStoreICStrictTrampoline, CodeStubAssembler) {
AccessorAssembler::GenerateKeyedStoreICTrampolineTF(state(), STRICT);
}
TF_BUILTIN(LoadGlobalIC, CodeStubAssembler) {
AccessorAssembler::GenerateLoadGlobalIC(state(), NOT_INSIDE_TYPEOF);
}
TF_BUILTIN(LoadGlobalICInsideTypeof, CodeStubAssembler) {
AccessorAssembler::GenerateLoadGlobalIC(state(), INSIDE_TYPEOF);
}
TF_BUILTIN(LoadGlobalICTrampoline, CodeStubAssembler) {
AccessorAssembler::GenerateLoadGlobalICTrampoline(state(), NOT_INSIDE_TYPEOF);
}
TF_BUILTIN(LoadGlobalICInsideTypeofTrampoline, CodeStubAssembler) {
AccessorAssembler::GenerateLoadGlobalICTrampoline(state(), INSIDE_TYPEOF);
}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -121,13 +121,13 @@ class BuiltinArguments : public Arguments { ...@@ -121,13 +121,13 @@ class BuiltinArguments : public Arguments {
public: \ public: \
explicit Name##Assembler(compiler::CodeAssemblerState* state) \ explicit Name##Assembler(compiler::CodeAssemblerState* state) \
: AssemblerBase(state) {} \ : AssemblerBase(state) {} \
void Generate##NameImpl(); \ void Generate##Name##Impl(); \
}; \ }; \
void Builtins::Generate_##Name(compiler::CodeAssemblerState* state) { \ void Builtins::Generate_##Name(compiler::CodeAssemblerState* state) { \
Name##Assembler assembler(state); \ Name##Assembler assembler(state); \
assembler.Generate##NameImpl(); \ assembler.Generate##Name##Impl(); \
} \ } \
void Name##Assembler::Generate##NameImpl() void Name##Assembler::Generate##Name##Impl()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
......
...@@ -212,18 +212,21 @@ namespace internal { ...@@ -212,18 +212,21 @@ namespace internal {
TFS(GetSuperConstructor, BUILTIN, kNoExtraICState, TypeConversion) \ TFS(GetSuperConstructor, BUILTIN, kNoExtraICState, TypeConversion) \
\ \
/* Handlers */ \ /* Handlers */ \
TFS(KeyedLoadIC_Megamorphic_TF, KEYED_LOAD_IC, kNoExtraICState, \ TFS(LoadICProtoArray, HANDLER, Code::LOAD_IC, LoadICProtoArray) \
LoadWithVector) \ TFS(LoadICProtoArrayThrowIfNonexistent, HANDLER, Code::LOAD_IC, \
LoadICProtoArray) \
TFS(KeyedLoadIC_Megamorphic, KEYED_LOAD_IC, kNoExtraICState, LoadWithVector) \
TFS(KeyedLoadIC_Miss, BUILTIN, kNoExtraICState, LoadWithVector) \ TFS(KeyedLoadIC_Miss, BUILTIN, kNoExtraICState, LoadWithVector) \
TFS(KeyedLoadIC_Slow, HANDLER, Code::KEYED_LOAD_IC, LoadWithVector) \ TFS(KeyedLoadIC_Slow, HANDLER, Code::KEYED_LOAD_IC, LoadWithVector) \
TFS(KeyedStoreIC_Megamorphic_TF, KEYED_STORE_IC, kNoExtraICState, \ TFS(KeyedStoreIC_Megamorphic, KEYED_STORE_IC, kNoExtraICState, \
StoreWithVector) \ StoreWithVector) \
TFS(KeyedStoreIC_Megamorphic_Strict_TF, KEYED_STORE_IC, \ TFS(KeyedStoreIC_Megamorphic_Strict, KEYED_STORE_IC, \
StoreICState::kStrictModeState, StoreWithVector) \ StoreICState::kStrictModeState, StoreWithVector) \
ASM(KeyedStoreIC_Miss) \ ASM(KeyedStoreIC_Miss) \
ASH(KeyedStoreIC_Slow, HANDLER, Code::KEYED_STORE_IC) \ ASH(KeyedStoreIC_Slow, HANDLER, Code::KEYED_STORE_IC) \
TFS(LoadGlobalIC_Miss, BUILTIN, kNoExtraICState, LoadGlobalWithVector) \ TFS(LoadGlobalIC_Miss, BUILTIN, kNoExtraICState, LoadGlobalWithVector) \
TFS(LoadGlobalIC_Slow, HANDLER, Code::LOAD_GLOBAL_IC, LoadGlobalWithVector) \ TFS(LoadGlobalIC_Slow, HANDLER, Code::LOAD_GLOBAL_IC, LoadGlobalWithVector) \
TFS(LoadField, HANDLER, Code::LOAD_IC, LoadField) \
ASH(LoadIC_Getter_ForDeopt, LOAD_IC, kNoExtraICState) \ ASH(LoadIC_Getter_ForDeopt, LOAD_IC, kNoExtraICState) \
TFS(LoadIC_Miss, BUILTIN, kNoExtraICState, LoadWithVector) \ TFS(LoadIC_Miss, BUILTIN, kNoExtraICState, LoadWithVector) \
TFS(LoadIC_Normal, HANDLER, Code::LOAD_IC, LoadWithVector) \ TFS(LoadIC_Normal, HANDLER, Code::LOAD_IC, LoadWithVector) \
......
...@@ -33,6 +33,16 @@ Callable CodeFactory::LoadIC(Isolate* isolate) { ...@@ -33,6 +33,16 @@ Callable CodeFactory::LoadIC(Isolate* isolate) {
LoadDescriptor(isolate)); LoadDescriptor(isolate));
} }
// static
Callable CodeFactory::LoadICProtoArray(Isolate* isolate,
bool throw_if_nonexistent) {
return Callable(
throw_if_nonexistent
? isolate->builtins()->LoadICProtoArrayThrowIfNonexistent()
: isolate->builtins()->LoadICProtoArray(),
LoadICProtoArrayDescriptor(isolate));
}
// static // static
Callable CodeFactory::ApiGetter(Isolate* isolate) { Callable CodeFactory::ApiGetter(Isolate* isolate) {
CallApiGetterStub stub(isolate); CallApiGetterStub stub(isolate);
...@@ -75,12 +85,6 @@ Callable CodeFactory::KeyedLoadICInOptimizedCode(Isolate* isolate) { ...@@ -75,12 +85,6 @@ Callable CodeFactory::KeyedLoadICInOptimizedCode(Isolate* isolate) {
LoadWithVectorDescriptor(isolate)); LoadWithVectorDescriptor(isolate));
} }
// static
Callable CodeFactory::KeyedLoadIC_Megamorphic(Isolate* isolate) {
return Callable(isolate->builtins()->KeyedLoadIC_Megamorphic_TF(),
LoadWithVectorDescriptor(isolate));
}
// static // static
Callable CodeFactory::CallIC(Isolate* isolate, ConvertReceiverMode mode, Callable CodeFactory::CallIC(Isolate* isolate, ConvertReceiverMode mode,
TailCallMode tail_call_mode) { TailCallMode tail_call_mode) {
...@@ -133,11 +137,10 @@ Callable CodeFactory::KeyedStoreICInOptimizedCode(Isolate* isolate, ...@@ -133,11 +137,10 @@ Callable CodeFactory::KeyedStoreICInOptimizedCode(Isolate* isolate,
// static // static
Callable CodeFactory::KeyedStoreIC_Megamorphic(Isolate* isolate, Callable CodeFactory::KeyedStoreIC_Megamorphic(Isolate* isolate,
LanguageMode language_mode) { LanguageMode language_mode) {
return Callable( return Callable(language_mode == STRICT
language_mode == STRICT ? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict()
? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict_TF() : isolate->builtins()->KeyedStoreIC_Megamorphic(),
: isolate->builtins()->KeyedStoreIC_Megamorphic_TF(), StoreWithVectorDescriptor(isolate));
StoreWithVectorDescriptor(isolate));
} }
// static // static
...@@ -158,36 +161,6 @@ Callable CodeFactory::GetProperty(Isolate* isolate) { ...@@ -158,36 +161,6 @@ Callable CodeFactory::GetProperty(Isolate* isolate) {
return make_callable(stub); return make_callable(stub);
} }
// static
Callable CodeFactory::ToBoolean(Isolate* isolate) {
return Callable(isolate->builtins()->ToBoolean(),
TypeConversionDescriptor(isolate));
}
// static
Callable CodeFactory::ToNumber(Isolate* isolate) {
return Callable(isolate->builtins()->ToNumber(),
TypeConversionDescriptor(isolate));
}
// static
Callable CodeFactory::NonNumberToNumber(Isolate* isolate) {
return Callable(isolate->builtins()->NonNumberToNumber(),
TypeConversionDescriptor(isolate));
}
// static
Callable CodeFactory::StringToNumber(Isolate* isolate) {
return Callable(isolate->builtins()->StringToNumber(),
TypeConversionDescriptor(isolate));
}
// static
Callable CodeFactory::ToName(Isolate* isolate) {
return Callable(isolate->builtins()->ToName(),
TypeConversionDescriptor(isolate));
}
// static // static
Callable CodeFactory::NonPrimitiveToPrimitive(Isolate* isolate, Callable CodeFactory::NonPrimitiveToPrimitive(Isolate* isolate,
ToPrimitiveHint hint) { ToPrimitiveHint hint) {
...@@ -254,19 +227,37 @@ TFS_BUILTIN(StrictEqual) ...@@ -254,19 +227,37 @@ TFS_BUILTIN(StrictEqual)
TFS_BUILTIN(StrictNotEqual) TFS_BUILTIN(StrictNotEqual)
TFS_BUILTIN(CreateIterResultObject) TFS_BUILTIN(CreateIterResultObject)
TFS_BUILTIN(HasProperty) TFS_BUILTIN(HasProperty)
TFS_BUILTIN(NonNumberToNumber)
TFS_BUILTIN(StringToNumber)
TFS_BUILTIN(ToBoolean)
TFS_BUILTIN(ToInteger) TFS_BUILTIN(ToInteger)
TFS_BUILTIN(ToLength) TFS_BUILTIN(ToLength)
TFS_BUILTIN(ToName)
TFS_BUILTIN(ToNumber)
TFS_BUILTIN(ToObject) TFS_BUILTIN(ToObject)
TFS_BUILTIN(Typeof) TFS_BUILTIN(Typeof)
TFS_BUILTIN(InstanceOf) TFS_BUILTIN(InstanceOf)
TFS_BUILTIN(OrdinaryHasInstance) TFS_BUILTIN(OrdinaryHasInstance)
TFS_BUILTIN(ForInFilter) TFS_BUILTIN(CopyFastSmiOrObjectElements)
TFS_BUILTIN(GrowFastDoubleElements)
TFS_BUILTIN(GrowFastSmiOrObjectElements)
TFS_BUILTIN(NewUnmappedArgumentsElements) TFS_BUILTIN(NewUnmappedArgumentsElements)
TFS_BUILTIN(NewRestParameterElements) TFS_BUILTIN(NewRestParameterElements)
TFS_BUILTIN(PromiseHandleReject) TFS_BUILTIN(FastCloneRegExp)
TFS_BUILTIN(FastNewClosure)
TFS_BUILTIN(FastNewObject)
TFS_BUILTIN(ForInFilter)
TFS_BUILTIN(GetSuperConstructor) TFS_BUILTIN(GetSuperConstructor)
TFS_BUILTIN(KeyedLoadIC_Megamorphic)
TFS_BUILTIN(PromiseHandleReject)
TFS_BUILTIN(StringCharAt) TFS_BUILTIN(StringCharAt)
TFS_BUILTIN(StringCharCodeAt) TFS_BUILTIN(StringCharCodeAt)
TFS_BUILTIN(StringEqual)
TFS_BUILTIN(StringNotEqual)
TFS_BUILTIN(StringLessThan)
TFS_BUILTIN(StringLessThanOrEqual)
TFS_BUILTIN(StringGreaterThan)
TFS_BUILTIN(StringGreaterThanOrEqual)
#undef TFS_BUILTIN #undef TFS_BUILTIN
...@@ -301,42 +292,6 @@ Callable CodeFactory::StringCompare(Isolate* isolate, Token::Value token) { ...@@ -301,42 +292,6 @@ Callable CodeFactory::StringCompare(Isolate* isolate, Token::Value token) {
return StringEqual(isolate); return StringEqual(isolate);
} }
// static
Callable CodeFactory::StringEqual(Isolate* isolate) {
return Callable(isolate->builtins()->StringEqual(),
CompareDescriptor(isolate));
}
// static
Callable CodeFactory::StringNotEqual(Isolate* isolate) {
return Callable(isolate->builtins()->StringNotEqual(),
CompareDescriptor(isolate));
}
// static
Callable CodeFactory::StringLessThan(Isolate* isolate) {
return Callable(isolate->builtins()->StringLessThan(),
CompareDescriptor(isolate));
}
// static
Callable CodeFactory::StringLessThanOrEqual(Isolate* isolate) {
return Callable(isolate->builtins()->StringLessThanOrEqual(),
CompareDescriptor(isolate));
}
// static
Callable CodeFactory::StringGreaterThan(Isolate* isolate) {
return Callable(isolate->builtins()->StringGreaterThan(),
CompareDescriptor(isolate));
}
// static
Callable CodeFactory::StringGreaterThanOrEqual(Isolate* isolate) {
return Callable(isolate->builtins()->StringGreaterThanOrEqual(),
CompareDescriptor(isolate));
}
// static // static
Callable CodeFactory::SubString(Isolate* isolate) { Callable CodeFactory::SubString(Isolate* isolate) {
SubStringStub stub(isolate); SubStringStub stub(isolate);
...@@ -349,12 +304,6 @@ Callable CodeFactory::ResumeGenerator(Isolate* isolate) { ...@@ -349,12 +304,6 @@ Callable CodeFactory::ResumeGenerator(Isolate* isolate) {
ResumeGeneratorDescriptor(isolate)); ResumeGeneratorDescriptor(isolate));
} }
// static
Callable CodeFactory::FastCloneRegExp(Isolate* isolate) {
return Callable(isolate->builtins()->FastCloneRegExp(),
FastCloneRegExpDescriptor(isolate));
}
// static // static
Callable CodeFactory::FastCloneShallowArray( Callable CodeFactory::FastCloneShallowArray(
Isolate* isolate, AllocationSiteMode allocation_mode) { Isolate* isolate, AllocationSiteMode allocation_mode) {
...@@ -375,18 +324,6 @@ Callable CodeFactory::FastNewFunctionContext(Isolate* isolate, ...@@ -375,18 +324,6 @@ Callable CodeFactory::FastNewFunctionContext(Isolate* isolate,
FastNewFunctionContextDescriptor(isolate)); FastNewFunctionContextDescriptor(isolate));
} }
// static
Callable CodeFactory::FastNewClosure(Isolate* isolate) {
return Callable(isolate->builtins()->FastNewClosure(),
FastNewClosureDescriptor(isolate));
}
// static
Callable CodeFactory::FastNewObject(Isolate* isolate) {
return Callable(isolate->builtins()->FastNewObject(),
FastNewObjectDescriptor(isolate));
}
// static // static
Callable CodeFactory::FastNewRestParameter(Isolate* isolate, Callable CodeFactory::FastNewRestParameter(Isolate* isolate,
bool skip_stub_frame) { bool skip_stub_frame) {
...@@ -408,24 +345,6 @@ Callable CodeFactory::FastNewStrictArguments(Isolate* isolate, ...@@ -408,24 +345,6 @@ Callable CodeFactory::FastNewStrictArguments(Isolate* isolate,
return make_callable(stub); return make_callable(stub);
} }
// static
Callable CodeFactory::CopyFastSmiOrObjectElements(Isolate* isolate) {
return Callable(isolate->builtins()->CopyFastSmiOrObjectElements(),
CopyFastSmiOrObjectElementsDescriptor(isolate));
}
// static
Callable CodeFactory::GrowFastDoubleElements(Isolate* isolate) {
return Callable(isolate->builtins()->GrowFastDoubleElements(),
GrowArrayElementsDescriptor(isolate));
}
// static
Callable CodeFactory::GrowFastSmiOrObjectElements(Isolate* isolate) {
return Callable(isolate->builtins()->GrowFastSmiOrObjectElements(),
GrowArrayElementsDescriptor(isolate));
}
// static // static
Callable CodeFactory::AllocateHeapNumber(Isolate* isolate) { Callable CodeFactory::AllocateHeapNumber(Isolate* isolate) {
AllocateHeapNumberStub stub(isolate); AllocateHeapNumberStub stub(isolate);
......
...@@ -39,6 +39,7 @@ class V8_EXPORT_PRIVATE CodeFactory final { ...@@ -39,6 +39,7 @@ class V8_EXPORT_PRIVATE CodeFactory final {
// Initial states for ICs. // Initial states for ICs.
static Callable LoadIC(Isolate* isolate); static Callable LoadIC(Isolate* isolate);
static Callable LoadICInOptimizedCode(Isolate* isolate); static Callable LoadICInOptimizedCode(Isolate* isolate);
static Callable LoadICProtoArray(Isolate* isolate, bool throw_if_nonexistent);
static Callable LoadGlobalIC(Isolate* isolate, TypeofMode typeof_mode); static Callable LoadGlobalIC(Isolate* isolate, TypeofMode typeof_mode);
static Callable LoadGlobalICInOptimizedCode(Isolate* isolate, static Callable LoadGlobalICInOptimizedCode(Isolate* isolate,
TypeofMode typeof_mode); TypeofMode typeof_mode);
......
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include "src/code-stub-assembler.h" #include "src/code-stub-assembler.h"
#include "src/factory.h" #include "src/factory.h"
#include "src/gdb-jit.h" #include "src/gdb-jit.h"
#include "src/ic/accessor-assembler.h"
#include "src/ic/handler-compiler.h"
#include "src/ic/ic-stats.h" #include "src/ic/ic-stats.h"
#include "src/ic/ic.h" #include "src/ic/ic.h"
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
...@@ -439,11 +437,6 @@ Handle<Code> TurboFanCodeStub::GenerateCode() { ...@@ -439,11 +437,6 @@ Handle<Code> TurboFanCodeStub::GenerateCode() {
return compiler::CodeAssembler::GenerateCode(&state); return compiler::CodeAssembler::GenerateCode(&state);
} }
void LoadICProtoArrayStub::GenerateAssembly(CodeAssemblerState* state) const {
AccessorAssembler::GenerateLoadICProtoArray(
state, throw_reference_error_if_nonexistent());
}
void ElementsTransitionAndStoreStub::GenerateAssembly( void ElementsTransitionAndStoreStub::GenerateAssembly(
compiler::CodeAssemblerState* state) const { compiler::CodeAssemblerState* state) const {
typedef CodeStubAssembler::Label Label; typedef CodeStubAssembler::Label Label;
...@@ -1618,11 +1611,6 @@ void StoreGlobalStub::GenerateAssembly( ...@@ -1618,11 +1611,6 @@ void StoreGlobalStub::GenerateAssembly(
} }
} }
void LoadFieldStub::GenerateAssembly(
compiler::CodeAssemblerState* state) const {
AccessorAssembler::GenerateLoadField(state);
}
void KeyedLoadSloppyArgumentsStub::GenerateAssembly( void KeyedLoadSloppyArgumentsStub::GenerateAssembly(
compiler::CodeAssemblerState* state) const { compiler::CodeAssemblerState* state) const {
typedef CodeStubAssembler::Label Label; typedef CodeStubAssembler::Label Label;
...@@ -1779,25 +1767,6 @@ void JSEntryStub::FinishCode(Handle<Code> code) { ...@@ -1779,25 +1767,6 @@ void JSEntryStub::FinishCode(Handle<Code> code) {
code->set_handler_table(*handler_table); code->set_handler_table(*handler_table);
} }
void HandlerStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
DCHECK(kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC);
if (kind() == Code::KEYED_LOAD_IC) {
descriptor->Initialize(
FUNCTION_ADDR(Runtime_KeyedLoadIC_MissFromStubFailure));
}
}
CallInterfaceDescriptor HandlerStub::GetCallInterfaceDescriptor() const {
if (kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC) {
return LoadWithVectorDescriptor(isolate());
} else {
DCHECK(kind() == Code::STORE_IC || kind() == Code::KEYED_STORE_IC);
return StoreWithVectorDescriptor(isolate());
}
}
void TransitionElementsKindStub::InitializeDescriptor( void TransitionElementsKindStub::InitializeDescriptor(
CodeStubDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
descriptor->Initialize( descriptor->Initialize(
......
...@@ -102,13 +102,11 @@ class Node; ...@@ -102,13 +102,11 @@ class Node;
V(NumberToString) \ V(NumberToString) \
V(StringAdd) \ V(StringAdd) \
V(GetProperty) \ V(GetProperty) \
V(LoadICProtoArray) \
V(StoreFastElement) \ V(StoreFastElement) \
V(StoreGlobal) \ V(StoreGlobal) \
V(StoreInterceptor) \ V(StoreInterceptor) \
V(LoadApiGetter) \ V(LoadApiGetter) \
V(LoadIndexedInterceptor) \ V(LoadIndexedInterceptor) \
V(LoadField) \
V(GrowArrayElements) V(GrowArrayElements)
// List of code stubs only used on ARM 32 bits platforms. // List of code stubs only used on ARM 32 bits platforms.
...@@ -979,36 +977,6 @@ class LoadIndexedStringStub : public PlatformCodeStub { ...@@ -979,36 +977,6 @@ class LoadIndexedStringStub : public PlatformCodeStub {
DEFINE_PLATFORM_CODE_STUB(LoadIndexedString, PlatformCodeStub); DEFINE_PLATFORM_CODE_STUB(LoadIndexedString, PlatformCodeStub);
}; };
class HandlerStub : public HydrogenCodeStub {
public:
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return kind(); }
void InitializeDescriptor(CodeStubDescriptor* descriptor) override;
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override;
protected:
explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
virtual Code::Kind kind() const = 0;
DEFINE_CODE_STUB_BASE(HandlerStub, HydrogenCodeStub);
};
class LoadFieldStub : public TurboFanCodeStub {
public:
explicit LoadFieldStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return GetCodeKind(); }
private:
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadField);
DEFINE_TURBOFAN_CODE_STUB(LoadField, TurboFanCodeStub);
};
class KeyedLoadSloppyArgumentsStub : public TurboFanCodeStub { class KeyedLoadSloppyArgumentsStub : public TurboFanCodeStub {
public: public:
explicit KeyedLoadSloppyArgumentsStub(Isolate* isolate) explicit KeyedLoadSloppyArgumentsStub(Isolate* isolate)
...@@ -1649,30 +1617,6 @@ class CallICTrampolineStub : public PlatformCodeStub { ...@@ -1649,30 +1617,6 @@ class CallICTrampolineStub : public PlatformCodeStub {
DEFINE_PLATFORM_CODE_STUB(CallICTrampoline, PlatformCodeStub); DEFINE_PLATFORM_CODE_STUB(CallICTrampoline, PlatformCodeStub);
}; };
class LoadICProtoArrayStub : public TurboFanCodeStub {
public:
explicit LoadICProtoArrayStub(Isolate* isolate,
bool throw_reference_error_if_nonexistent)
: TurboFanCodeStub(isolate) {
minor_key_ = ThrowReferenceErrorIfNonexistentBits::encode(
throw_reference_error_if_nonexistent);
}
bool throw_reference_error_if_nonexistent() const {
return ThrowReferenceErrorIfNonexistentBits::decode(minor_key_);
}
ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_);
}
private:
class ThrowReferenceErrorIfNonexistentBits : public BitField<bool, 0, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadICProtoArray);
DEFINE_TURBOFAN_CODE_STUB(LoadICProtoArray, TurboFanCodeStub);
};
class DoubleToIStub : public PlatformCodeStub { class DoubleToIStub : public PlatformCodeStub {
public: public:
DoubleToIStub(Isolate* isolate, Register source, Register destination, DoubleToIStub(Isolate* isolate, Register source, Register destination,
......
// Copyright 2016 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_SRC_IC_ACCESSOR_ASSEMBLER_IMPL_H_
#define V8_SRC_IC_ACCESSOR_ASSEMBLER_IMPL_H_
#include "src/code-stub-assembler.h"
namespace v8 {
namespace internal {
namespace compiler {
class CodeAssemblerState;
}
using compiler::Node;
#define ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE(V) \
V(LoadIC) \
V(LoadField) \
V(LoadICTrampoline) \
V(KeyedLoadICTF) \
V(KeyedLoadICTrampolineTF) \
V(KeyedLoadICMegamorphic) \
V(StoreIC) \
V(StoreICTrampoline)
// The other IC entry points need custom handling because of additional
// parameters like "typeof_mode" or "language_mode".
class AccessorAssemblerImpl : public CodeStubAssembler {
public:
explicit AccessorAssemblerImpl(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {}
#define DECLARE_PUBLIC_METHOD(Name) void Generate##Name();
ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE(DECLARE_PUBLIC_METHOD)
#undef DECLARE_PUBLIC_METHOD
void GenerateLoadICProtoArray(bool throw_reference_error_if_nonexistent);
void GenerateLoadGlobalIC(TypeofMode typeof_mode);
void GenerateLoadGlobalICTrampoline(TypeofMode typeof_mode);
void GenerateKeyedStoreICTF(LanguageMode language_mode);
void GenerateKeyedStoreICTrampolineTF(LanguageMode language_mode);
void TryProbeStubCache(StubCache* stub_cache, Node* receiver, Node* name,
Label* if_handler, Variable* var_handler,
Label* if_miss);
Node* StubCachePrimaryOffsetForTesting(Node* name, Node* map) {
return StubCachePrimaryOffset(name, map);
}
Node* StubCacheSecondaryOffsetForTesting(Node* name, Node* map) {
return StubCacheSecondaryOffset(name, map);
}
protected:
struct LoadICParameters {
LoadICParameters(Node* context, Node* receiver, Node* name, Node* slot,
Node* vector)
: context(context),
receiver(receiver),
name(name),
slot(slot),
vector(vector) {}
Node* context;
Node* receiver;
Node* name;
Node* slot;
Node* vector;
};
struct StoreICParameters : public LoadICParameters {
StoreICParameters(Node* context, Node* receiver, Node* name, Node* value,
Node* slot, Node* vector)
: LoadICParameters(context, receiver, name, slot, vector),
value(value) {}
Node* value;
};
enum ElementSupport { kOnlyProperties, kSupportElements };
void HandleStoreICHandlerCase(
const StoreICParameters* p, Node* handler, Label* miss,
ElementSupport support_elements = kOnlyProperties);
private:
// Stub generation entry points.
void LoadIC(const LoadICParameters* p);
void LoadICProtoArray(const LoadICParameters* p, Node* handler,
bool throw_reference_error_if_nonexistent);
void LoadGlobalIC(const LoadICParameters* p, TypeofMode typeof_mode);
void KeyedLoadIC(const LoadICParameters* p);
void KeyedLoadICGeneric(const LoadICParameters* p);
void StoreIC(const StoreICParameters* p);
void KeyedStoreIC(const StoreICParameters* p, LanguageMode language_mode);
// IC dispatcher behavior.
// Checks monomorphic case. Returns {feedback} entry of the vector.
Node* TryMonomorphicCase(Node* slot, Node* vector, Node* receiver_map,
Label* if_handler, Variable* var_handler,
Label* if_miss);
void HandlePolymorphicCase(Node* receiver_map, Node* feedback,
Label* if_handler, Variable* var_handler,
Label* if_miss, int unroll_count);
void HandleKeyedStorePolymorphicCase(Node* receiver_map, Node* feedback,
Label* if_handler, Variable* var_handler,
Label* if_transition_handler,
Variable* var_transition_map_cell,
Label* if_miss);
// LoadIC implementation.
void HandleLoadICHandlerCase(
const LoadICParameters* p, Node* handler, Label* miss,
ElementSupport support_elements = kOnlyProperties);
void HandleLoadICSmiHandlerCase(const LoadICParameters* p, Node* holder,
Node* smi_handler, Label* miss,
ElementSupport support_elements);
void HandleLoadICProtoHandlerCase(const LoadICParameters* p, Node* handler,
Variable* var_holder,
Variable* var_smi_handler,
Label* if_smi_handler, Label* miss,
bool throw_reference_error_if_nonexistent);
Node* EmitLoadICProtoArrayCheck(const LoadICParameters* p, Node* handler,
Node* handler_length, Node* handler_flags,
Label* miss,
bool throw_reference_error_if_nonexistent);
// LoadGlobalIC implementation.
void HandleLoadGlobalICHandlerCase(const LoadICParameters* p, Node* handler,
Label* miss,
bool throw_reference_error_if_nonexistent);
// StoreIC implementation.
void HandleStoreICElementHandlerCase(const StoreICParameters* p,
Node* handler, Label* miss);
void HandleStoreICProtoHandler(const StoreICParameters* p, Node* handler,
Label* miss);
// If |transition| is nullptr then the normal field store is generated or
// transitioning store otherwise.
void HandleStoreICSmiHandlerCase(Node* handler_word, Node* holder,
Node* value, Node* transition, Label* miss);
// If |transition| is nullptr then the normal field store is generated or
// transitioning store otherwise.
void HandleStoreFieldAndReturn(Node* handler_word, Node* holder,
Representation representation, Node* value,
Node* transition, Label* miss);
// Low-level helpers.
Node* PrepareValueForStore(Node* handler_word, Node* holder,
Representation representation, Node* transition,
Node* value, Label* bailout);
// Extends properties backing store by JSObject::kFieldsAdded elements.
void ExtendPropertiesBackingStore(Node* object);
void StoreNamedField(Node* handler_word, Node* object, bool is_inobject,
Representation representation, Node* value,
bool transition_to_field);
void EmitFastElementsBoundsCheck(Node* object, Node* elements,
Node* intptr_index,
Node* is_jsarray_condition, Label* miss);
void EmitElementLoad(Node* object, Node* elements, Node* elements_kind,
Node* key, Node* is_jsarray_condition, Label* if_hole,
Label* rebox_double, Variable* var_double_value,
Label* unimplemented_elements_kind, Label* out_of_bounds,
Label* miss);
void CheckPrototype(Node* prototype_cell, Node* name, Label* miss);
void NameDictionaryNegativeLookup(Node* object, Node* name, Label* miss);
// Stub cache access helpers.
// This enum is used here as a replacement for StubCache::Table to avoid
// including stub cache header.
enum StubCacheTable : int;
Node* StubCachePrimaryOffset(Node* name, Node* map);
Node* StubCacheSecondaryOffset(Node* name, Node* seed);
void TryProbeStubCacheTable(StubCache* stub_cache, StubCacheTable table_id,
Node* entry_offset, Node* name, Node* map,
Label* if_handler, Variable* var_handler,
Label* if_miss);
};
} // namespace internal
} // namespace v8
#endif // V8_SRC_IC_ACCESSOR_ASSEMBLER_IMPL_H_
This diff is collapsed.
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef V8_SRC_IC_ACCESSOR_ASSEMBLER_H_ #ifndef V8_SRC_IC_ACCESSOR_ASSEMBLER_H_
#define V8_SRC_IC_ACCESSOR_ASSEMBLER_H_ #define V8_SRC_IC_ACCESSOR_ASSEMBLER_H_
#include "src/globals.h" #include "src/code-stub-assembler.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -14,29 +14,179 @@ namespace compiler { ...@@ -14,29 +14,179 @@ namespace compiler {
class CodeAssemblerState; class CodeAssemblerState;
} }
class AccessorAssembler { class AccessorAssembler : public CodeStubAssembler {
public: public:
static void GenerateLoadIC(compiler::CodeAssemblerState* state); typedef compiler::Node Node;
static void GenerateLoadICTrampoline(compiler::CodeAssemblerState* state);
static void GenerateLoadICProtoArray( explicit AccessorAssembler(compiler::CodeAssemblerState* state)
compiler::CodeAssemblerState* state, : CodeStubAssembler(state) {}
bool throw_reference_error_if_nonexistent);
static void GenerateLoadGlobalIC(compiler::CodeAssemblerState* state, void GenerateLoadIC();
TypeofMode typeof_mode); void GenerateLoadField();
static void GenerateLoadGlobalICTrampoline( void GenerateLoadICTrampoline();
compiler::CodeAssemblerState* state, TypeofMode typeof_mode); void GenerateKeyedLoadIC();
static void GenerateKeyedLoadICTF(compiler::CodeAssemblerState* state); void GenerateKeyedLoadICTrampoline();
static void GenerateKeyedLoadICTrampolineTF( void GenerateKeyedLoadIC_Megamorphic();
compiler::CodeAssemblerState* state); void GenerateStoreIC();
static void GenerateKeyedLoadICMegamorphic( void GenerateStoreICTrampoline();
compiler::CodeAssemblerState* state);
static void GenerateLoadField(compiler::CodeAssemblerState* state); void GenerateLoadICProtoArray(bool throw_reference_error_if_nonexistent);
static void GenerateStoreIC(compiler::CodeAssemblerState* state);
static void GenerateStoreICTrampoline(compiler::CodeAssemblerState* state); void GenerateLoadGlobalIC(TypeofMode typeof_mode);
static void GenerateKeyedStoreICTF(compiler::CodeAssemblerState* state, void GenerateLoadGlobalICTrampoline(TypeofMode typeof_mode);
LanguageMode language_mode);
static void GenerateKeyedStoreICTrampolineTF( void GenerateKeyedStoreIC(LanguageMode language_mode);
compiler::CodeAssemblerState* state, LanguageMode language_mode); void GenerateKeyedStoreICTrampoline(LanguageMode language_mode);
void TryProbeStubCache(StubCache* stub_cache, Node* receiver, Node* name,
Label* if_handler, Variable* var_handler,
Label* if_miss);
Node* StubCachePrimaryOffsetForTesting(Node* name, Node* map) {
return StubCachePrimaryOffset(name, map);
}
Node* StubCacheSecondaryOffsetForTesting(Node* name, Node* map) {
return StubCacheSecondaryOffset(name, map);
}
protected:
struct LoadICParameters {
LoadICParameters(Node* context, Node* receiver, Node* name, Node* slot,
Node* vector)
: context(context),
receiver(receiver),
name(name),
slot(slot),
vector(vector) {}
Node* context;
Node* receiver;
Node* name;
Node* slot;
Node* vector;
};
struct StoreICParameters : public LoadICParameters {
StoreICParameters(Node* context, Node* receiver, Node* name, Node* value,
Node* slot, Node* vector)
: LoadICParameters(context, receiver, name, slot, vector),
value(value) {}
Node* value;
};
enum ElementSupport { kOnlyProperties, kSupportElements };
void HandleStoreICHandlerCase(
const StoreICParameters* p, Node* handler, Label* miss,
ElementSupport support_elements = kOnlyProperties);
private:
// Stub generation entry points.
void LoadIC(const LoadICParameters* p);
void LoadICProtoArray(const LoadICParameters* p, Node* handler,
bool throw_reference_error_if_nonexistent);
void LoadGlobalIC(const LoadICParameters* p, TypeofMode typeof_mode);
void KeyedLoadIC(const LoadICParameters* p);
void KeyedLoadICGeneric(const LoadICParameters* p);
void StoreIC(const StoreICParameters* p);
void KeyedStoreIC(const StoreICParameters* p, LanguageMode language_mode);
// IC dispatcher behavior.
// Checks monomorphic case. Returns {feedback} entry of the vector.
Node* TryMonomorphicCase(Node* slot, Node* vector, Node* receiver_map,
Label* if_handler, Variable* var_handler,
Label* if_miss);
void HandlePolymorphicCase(Node* receiver_map, Node* feedback,
Label* if_handler, Variable* var_handler,
Label* if_miss, int unroll_count);
void HandleKeyedStorePolymorphicCase(Node* receiver_map, Node* feedback,
Label* if_handler, Variable* var_handler,
Label* if_transition_handler,
Variable* var_transition_map_cell,
Label* if_miss);
// LoadIC implementation.
void HandleLoadICHandlerCase(
const LoadICParameters* p, Node* handler, Label* miss,
ElementSupport support_elements = kOnlyProperties);
void HandleLoadICSmiHandlerCase(const LoadICParameters* p, Node* holder,
Node* smi_handler, Label* miss,
ElementSupport support_elements);
void HandleLoadICProtoHandlerCase(const LoadICParameters* p, Node* handler,
Variable* var_holder,
Variable* var_smi_handler,
Label* if_smi_handler, Label* miss,
bool throw_reference_error_if_nonexistent);
Node* EmitLoadICProtoArrayCheck(const LoadICParameters* p, Node* handler,
Node* handler_length, Node* handler_flags,
Label* miss,
bool throw_reference_error_if_nonexistent);
// LoadGlobalIC implementation.
void HandleLoadGlobalICHandlerCase(const LoadICParameters* p, Node* handler,
Label* miss,
bool throw_reference_error_if_nonexistent);
// StoreIC implementation.
void HandleStoreICElementHandlerCase(const StoreICParameters* p,
Node* handler, Label* miss);
void HandleStoreICProtoHandler(const StoreICParameters* p, Node* handler,
Label* miss);
// If |transition| is nullptr then the normal field store is generated or
// transitioning store otherwise.
void HandleStoreICSmiHandlerCase(Node* handler_word, Node* holder,
Node* value, Node* transition, Label* miss);
// If |transition| is nullptr then the normal field store is generated or
// transitioning store otherwise.
void HandleStoreFieldAndReturn(Node* handler_word, Node* holder,
Representation representation, Node* value,
Node* transition, Label* miss);
// Low-level helpers.
Node* PrepareValueForStore(Node* handler_word, Node* holder,
Representation representation, Node* transition,
Node* value, Label* bailout);
// Extends properties backing store by JSObject::kFieldsAdded elements.
void ExtendPropertiesBackingStore(Node* object);
void StoreNamedField(Node* handler_word, Node* object, bool is_inobject,
Representation representation, Node* value,
bool transition_to_field);
void EmitFastElementsBoundsCheck(Node* object, Node* elements,
Node* intptr_index,
Node* is_jsarray_condition, Label* miss);
void EmitElementLoad(Node* object, Node* elements, Node* elements_kind,
Node* key, Node* is_jsarray_condition, Label* if_hole,
Label* rebox_double, Variable* var_double_value,
Label* unimplemented_elements_kind, Label* out_of_bounds,
Label* miss);
void CheckPrototype(Node* prototype_cell, Node* name, Label* miss);
void NameDictionaryNegativeLookup(Node* object, Node* name, Label* miss);
// Stub cache access helpers.
// This enum is used here as a replacement for StubCache::Table to avoid
// including stub cache header.
enum StubCacheTable : int;
Node* StubCachePrimaryOffset(Node* name, Node* map);
Node* StubCacheSecondaryOffset(Node* name, Node* seed);
void TryProbeStubCacheTable(StubCache* stub_cache, StubCacheTable table_id,
Node* entry_offset, Node* name, Node* map,
Label* if_handler, Variable* var_handler,
Label* if_miss);
}; };
} // namespace internal } // namespace internal
......
...@@ -283,8 +283,7 @@ void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor( ...@@ -283,8 +283,7 @@ void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor(
Handle<Object> smi_handler = Handle<Object> smi_handler =
LoadIC::SimpleFieldLoad(isolate(), it->GetFieldIndex()); LoadIC::SimpleFieldLoad(isolate(), it->GetFieldIndex());
__ Move(LoadFieldDescriptor::SmiHandlerRegister(), smi_handler); __ Move(LoadFieldDescriptor::SmiHandlerRegister(), smi_handler);
LoadFieldStub stub(isolate()); GenerateTailCall(masm(), isolate()->builtins()->LoadField());
GenerateTailCall(masm(), stub.GetCode());
break; break;
} }
case LookupIterator::ACCESSOR: case LookupIterator::ACCESSOR:
......
...@@ -2660,24 +2660,6 @@ RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) { ...@@ -2660,24 +2660,6 @@ RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) {
RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
} }
RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) {
HandleScope scope(isolate);
typedef LoadWithVectorDescriptor Descriptor;
DCHECK_EQ(Descriptor::kParameterCount, args.length());
Handle<Object> receiver = args.at(Descriptor::kReceiver);
Handle<Object> key = args.at(Descriptor::kName);
Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot);
Handle<TypeFeedbackVector> vector =
args.at<TypeFeedbackVector>(Descriptor::kVector);
FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
KeyedLoadICNexus nexus(vector, vector_slot);
KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
ic.UpdateState(receiver, key);
RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
}
// Used from ic-<arch>.cc. // Used from ic-<arch>.cc.
RUNTIME_FUNCTION(Runtime_StoreIC_Miss) { RUNTIME_FUNCTION(Runtime_StoreIC_Miss) {
HandleScope scope(isolate); HandleScope scope(isolate);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "src/code-factory.h" #include "src/code-factory.h"
#include "src/code-stub-assembler.h" #include "src/code-stub-assembler.h"
#include "src/contexts.h" #include "src/contexts.h"
#include "src/ic/accessor-assembler-impl.h" #include "src/ic/accessor-assembler.h"
#include "src/interface-descriptors.h" #include "src/interface-descriptors.h"
#include "src/isolate.h" #include "src/isolate.h"
...@@ -16,10 +16,10 @@ namespace internal { ...@@ -16,10 +16,10 @@ namespace internal {
using compiler::Node; using compiler::Node;
class KeyedStoreGenericAssembler : public AccessorAssemblerImpl { class KeyedStoreGenericAssembler : public AccessorAssembler {
public: public:
explicit KeyedStoreGenericAssembler(compiler::CodeAssemblerState* state) explicit KeyedStoreGenericAssembler(compiler::CodeAssemblerState* state)
: AccessorAssemblerImpl(state) {} : AccessorAssembler(state) {}
void KeyedStoreGeneric(LanguageMode language_mode); void KeyedStoreGeneric(LanguageMode language_mode);
......
...@@ -965,7 +965,6 @@ namespace internal { ...@@ -965,7 +965,6 @@ namespace internal {
F(CompareIC_Miss, 3, 1) \ F(CompareIC_Miss, 3, 1) \
F(ElementsTransitionAndStoreIC_Miss, 6, 1) \ F(ElementsTransitionAndStoreIC_Miss, 6, 1) \
F(KeyedLoadIC_Miss, 4, 1) \ F(KeyedLoadIC_Miss, 4, 1) \
F(KeyedLoadIC_MissFromStubFailure, 4, 1) \
F(KeyedStoreIC_Miss, 5, 1) \ F(KeyedStoreIC_Miss, 5, 1) \
F(KeyedStoreIC_Slow, 5, 1) \ F(KeyedStoreIC_Slow, 5, 1) \
F(LoadElementWithInterceptor, 2, 1) \ F(LoadElementWithInterceptor, 2, 1) \
......
...@@ -969,7 +969,6 @@ ...@@ -969,7 +969,6 @@
'ic/access-compiler.cc', 'ic/access-compiler.cc',
'ic/access-compiler.h', 'ic/access-compiler.h',
'ic/accessor-assembler.cc', 'ic/accessor-assembler.cc',
'ic/accessor-assembler-impl.h',
'ic/accessor-assembler.h', 'ic/accessor-assembler.h',
'ic/call-optimization.cc', 'ic/call-optimization.cc',
'ic/call-optimization.h', 'ic/call-optimization.h',
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "test/cctest/cctest.h" #include "test/cctest/cctest.h"
#include "src/base/utils/random-number-generator.h" #include "src/base/utils/random-number-generator.h"
#include "src/ic/accessor-assembler-impl.h" #include "src/ic/accessor-assembler.h"
#include "src/ic/stub-cache.h" #include "src/ic/stub-cache.h"
#include "test/cctest/compiler/code-assembler-tester.h" #include "test/cctest/compiler/code-assembler-tester.h"
#include "test/cctest/compiler/function-tester.h" #include "test/cctest/compiler/function-tester.h"
...@@ -23,7 +23,7 @@ void TestStubCacheOffsetCalculation(StubCache::Table table) { ...@@ -23,7 +23,7 @@ void TestStubCacheOffsetCalculation(StubCache::Table table) {
Isolate* isolate(CcTest::InitIsolateOnce()); Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 2; const int kNumParams = 2;
CodeAssemblerTester data(isolate, kNumParams); CodeAssemblerTester data(isolate, kNumParams);
AccessorAssemblerImpl m(data.state()); AccessorAssembler m(data.state());
{ {
Node* name = m.Parameter(0); Node* name = m.Parameter(0);
...@@ -121,7 +121,7 @@ TEST(TryProbeStubCache) { ...@@ -121,7 +121,7 @@ TEST(TryProbeStubCache) {
Isolate* isolate(CcTest::InitIsolateOnce()); Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 3; const int kNumParams = 3;
CodeAssemblerTester data(isolate, kNumParams); CodeAssemblerTester data(isolate, kNumParams);
AccessorAssemblerImpl m(data.state()); AccessorAssembler m(data.state());
Code::Kind ic_kind = Code::LOAD_IC; Code::Kind ic_kind = Code::LOAD_IC;
StubCache stub_cache(isolate, ic_kind); StubCache stub_cache(isolate, ic_kind);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment