Replace specific IC Code::Kind with Code::STUB
Bug: Change-Id: I41d3f3086f5e90a1a1579c18eca59b5d098f637f Reviewed-on: https://chromium-review.googlesource.com/690374 Commit-Queue: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#48207}
This commit is contained in:
parent
64b67ddad5
commit
6e68a28bfc
@ -539,19 +539,19 @@ namespace internal {
|
||||
CPP(JsonStringify) \
|
||||
\
|
||||
/* ICs */ \
|
||||
TFH(LoadIC, LOAD_IC, LoadWithVector) \
|
||||
TFH(LoadIC, STUB, LoadWithVector) \
|
||||
TFH(LoadIC_Noninlined, BUILTIN, LoadWithVector) \
|
||||
TFH(LoadICTrampoline, LOAD_IC, Load) \
|
||||
TFH(KeyedLoadIC, KEYED_LOAD_IC, LoadWithVector) \
|
||||
TFH(KeyedLoadICTrampoline, KEYED_LOAD_IC, Load) \
|
||||
TFH(StoreIC, STORE_IC, StoreWithVector) \
|
||||
TFH(StoreICTrampoline, STORE_IC, Store) \
|
||||
TFH(KeyedStoreIC, KEYED_STORE_IC, StoreWithVector) \
|
||||
TFH(KeyedStoreICTrampoline, KEYED_STORE_IC, Store) \
|
||||
TFH(LoadGlobalIC, LOAD_GLOBAL_IC, LoadGlobalWithVector) \
|
||||
TFH(LoadGlobalICInsideTypeof, LOAD_GLOBAL_IC, LoadGlobalWithVector) \
|
||||
TFH(LoadGlobalICTrampoline, LOAD_GLOBAL_IC, LoadGlobal) \
|
||||
TFH(LoadGlobalICInsideTypeofTrampoline, LOAD_GLOBAL_IC, LoadGlobal) \
|
||||
TFH(LoadICTrampoline, STUB, Load) \
|
||||
TFH(KeyedLoadIC, STUB, LoadWithVector) \
|
||||
TFH(KeyedLoadICTrampoline, STUB, Load) \
|
||||
TFH(StoreIC, STUB, StoreWithVector) \
|
||||
TFH(StoreICTrampoline, STUB, Store) \
|
||||
TFH(KeyedStoreIC, STUB, StoreWithVector) \
|
||||
TFH(KeyedStoreICTrampoline, STUB, Store) \
|
||||
TFH(LoadGlobalIC, STUB, LoadGlobalWithVector) \
|
||||
TFH(LoadGlobalICInsideTypeof, STUB, LoadGlobalWithVector) \
|
||||
TFH(LoadGlobalICTrampoline, STUB, LoadGlobal) \
|
||||
TFH(LoadGlobalICInsideTypeofTrampoline, STUB, LoadGlobal) \
|
||||
\
|
||||
/* Map */ \
|
||||
TFS(MapLookupHashIndex, kTable, kKey) \
|
||||
|
@ -27,46 +27,15 @@ class String;
|
||||
V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \
|
||||
V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \
|
||||
V(TICK_EVENT, "tick") \
|
||||
V(REPEAT_META_EVENT, "repeat") \
|
||||
V(BUILTIN_TAG, "Builtin") \
|
||||
V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak") \
|
||||
V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn") \
|
||||
V(CALL_INITIALIZE_TAG, "CallInitialize") \
|
||||
V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic") \
|
||||
V(CALL_MISS_TAG, "CallMiss") \
|
||||
V(CALL_NORMAL_TAG, "CallNormal") \
|
||||
V(LOAD_INITIALIZE_TAG, "LoadInitialize") \
|
||||
V(LOAD_MEGAMORPHIC_TAG, "LoadMegamorphic") \
|
||||
V(STORE_INITIALIZE_TAG, "StoreInitialize") \
|
||||
V(STORE_GENERIC_TAG, "StoreGeneric") \
|
||||
V(STORE_MEGAMORPHIC_TAG, "StoreMegamorphic") \
|
||||
V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak") \
|
||||
V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, "KeyedCallDebugPrepareStepIn") \
|
||||
V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize") \
|
||||
V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic") \
|
||||
V(KEYED_CALL_MISS_TAG, "KeyedCallMiss") \
|
||||
V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal") \
|
||||
V(CALLBACK_TAG, "Callback") \
|
||||
V(EVAL_TAG, "Eval") \
|
||||
V(FUNCTION_TAG, "Function") \
|
||||
V(HANDLER_TAG, "Handler") \
|
||||
V(BYTECODE_HANDLER_TAG, "BytecodeHandler") \
|
||||
V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \
|
||||
V(KEYED_LOAD_POLYMORPHIC_IC_TAG, "KeyedLoadPolymorphicIC") \
|
||||
V(KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG, "KeyedExternalArrayLoadIC") \
|
||||
V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \
|
||||
V(KEYED_STORE_POLYMORPHIC_IC_TAG, "KeyedStorePolymorphicIC") \
|
||||
V(KEYED_EXTERNAL_ARRAY_STORE_IC_TAG, "KeyedExternalArrayStoreIC") \
|
||||
V(LAZY_COMPILE_TAG, "LazyCompile") \
|
||||
V(CALL_IC_TAG, "CallIC") \
|
||||
V(LOAD_IC_TAG, "LoadIC") \
|
||||
V(LOAD_GLOBAL_IC_TAG, "LoadGlobalIC") \
|
||||
V(LOAD_POLYMORPHIC_IC_TAG, "LoadPolymorphicIC") \
|
||||
V(REG_EXP_TAG, "RegExp") \
|
||||
V(SCRIPT_TAG, "Script") \
|
||||
V(STORE_IC_TAG, "StoreIC") \
|
||||
V(STORE_GLOBAL_IC_TAG, "StoreGlobalIC") \
|
||||
V(STORE_POLYMORPHIC_IC_TAG, "StorePolymorphicIC") \
|
||||
V(STUB_TAG, "Stub") \
|
||||
V(NATIVE_FUNCTION_TAG, "Function") \
|
||||
V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \
|
||||
|
@ -157,9 +157,6 @@ StackFrame::Type CompilationInfo::GetOutputStackFrameType() const {
|
||||
case Code::BYTECODE_HANDLER:
|
||||
case Code::HANDLER:
|
||||
case Code::BUILTIN:
|
||||
#define CASE_KIND(kind) case Code::kind:
|
||||
IC_KIND_LIST(CASE_KIND)
|
||||
#undef CASE_KIND
|
||||
return StackFrame::STUB;
|
||||
case Code::WASM_FUNCTION:
|
||||
return StackFrame::WASM_COMPILED;
|
||||
|
@ -967,7 +967,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
|
||||
}
|
||||
}
|
||||
|
||||
// Extract receiver maps from the LOAD_IC using the LoadICNexus.
|
||||
// Extract receiver maps from the load IC using the LoadICNexus.
|
||||
if (!p.feedback().IsValid()) return NoChange();
|
||||
LoadICNexus nexus(p.feedback().vector(), p.feedback().slot());
|
||||
|
||||
@ -982,7 +982,7 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreNamed(Node* node) {
|
||||
NamedAccess const& p = NamedAccessOf(node->op());
|
||||
Node* const value = NodeProperties::GetValueInput(node, 1);
|
||||
|
||||
// Extract receiver maps from the STORE_IC using the StoreICNexus.
|
||||
// Extract receiver maps from the store IC using the StoreICNexus.
|
||||
if (!p.feedback().IsValid()) return NoChange();
|
||||
StoreICNexus nexus(p.feedback().vector(), p.feedback().slot());
|
||||
|
||||
@ -1491,7 +1491,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadProperty(Node* node) {
|
||||
}
|
||||
}
|
||||
|
||||
// Extract receiver maps from the KEYED_LOAD_IC using the KeyedLoadICNexus.
|
||||
// Extract receiver maps from the keyed load IC using the KeyedLoadICNexus.
|
||||
if (!p.feedback().IsValid()) return NoChange();
|
||||
KeyedLoadICNexus nexus(p.feedback().vector(), p.feedback().slot());
|
||||
|
||||
@ -1506,11 +1506,11 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreProperty(Node* node) {
|
||||
Node* const index = NodeProperties::GetValueInput(node, 1);
|
||||
Node* const value = NodeProperties::GetValueInput(node, 2);
|
||||
|
||||
// Extract receiver maps from the KEYED_STORE_IC using the KeyedStoreICNexus.
|
||||
// Extract receiver maps from the keyed store IC using the KeyedStoreICNexus.
|
||||
if (!p.feedback().IsValid()) return NoChange();
|
||||
KeyedStoreICNexus nexus(p.feedback().vector(), p.feedback().slot());
|
||||
|
||||
// Extract the keyed access store mode from the KEYED_STORE_IC.
|
||||
// Extract the keyed access store mode from the keyed store IC.
|
||||
KeyedAccessStoreMode store_mode = nexus.GetKeyedAccessStoreMode();
|
||||
|
||||
// Try to lower the keyed access based on the {nexus}.
|
||||
|
@ -117,9 +117,7 @@ static void PrintRelocInfo(StringBuilder* out, Isolate* isolate,
|
||||
out->AddFormatted(" ;; code:");
|
||||
Code* code = Code::GetCodeFromTargetAddress(relocinfo->target_address());
|
||||
Code::Kind kind = code->kind();
|
||||
if (code->is_inline_cache_stub()) {
|
||||
out->AddFormatted(" %s", Code::Kind2String(kind));
|
||||
} else if (kind == Code::STUB || kind == Code::HANDLER) {
|
||||
if (kind == Code::STUB || kind == Code::HANDLER) {
|
||||
// Get the STUB key and extract major and minor key.
|
||||
uint32_t key = code->stub_key();
|
||||
uint32_t minor_key = CodeStub::MinorKeyFromKey(key);
|
||||
|
@ -16,33 +16,41 @@ void PropertyAccessCompiler::TailCallBuiltin(MacroAssembler* masm,
|
||||
}
|
||||
|
||||
Register* PropertyAccessCompiler::GetCallingConvention(Isolate* isolate,
|
||||
Code::Kind kind) {
|
||||
Type type) {
|
||||
AccessCompilerData* data = isolate->access_compiler_data();
|
||||
if (!data->IsInitialized()) {
|
||||
InitializePlatformSpecific(data);
|
||||
}
|
||||
if (kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC) {
|
||||
return data->load_calling_convention();
|
||||
switch (type) {
|
||||
case LOAD:
|
||||
return data->load_calling_convention();
|
||||
case STORE:
|
||||
return data->store_calling_convention();
|
||||
}
|
||||
DCHECK(kind == Code::STORE_IC || kind == Code::KEYED_STORE_IC);
|
||||
UNREACHABLE();
|
||||
return data->store_calling_convention();
|
||||
}
|
||||
|
||||
|
||||
Register PropertyAccessCompiler::slot() const {
|
||||
if (kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC) {
|
||||
return LoadDescriptor::SlotRegister();
|
||||
switch (type_) {
|
||||
case LOAD:
|
||||
return LoadDescriptor::SlotRegister();
|
||||
case STORE:
|
||||
return StoreWithVectorDescriptor::SlotRegister();
|
||||
}
|
||||
DCHECK(kind() == Code::STORE_IC || kind() == Code::KEYED_STORE_IC);
|
||||
UNREACHABLE();
|
||||
return StoreWithVectorDescriptor::SlotRegister();
|
||||
}
|
||||
|
||||
|
||||
Register PropertyAccessCompiler::vector() const {
|
||||
if (kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC) {
|
||||
return LoadWithVectorDescriptor::VectorRegister();
|
||||
switch (type_) {
|
||||
case LOAD:
|
||||
return LoadWithVectorDescriptor::VectorRegister();
|
||||
case STORE:
|
||||
return StoreWithVectorDescriptor::VectorRegister();
|
||||
}
|
||||
DCHECK(kind() == Code::STORE_IC || kind() == Code::KEYED_STORE_IC);
|
||||
UNREACHABLE();
|
||||
return StoreWithVectorDescriptor::VectorRegister();
|
||||
}
|
||||
} // namespace internal
|
||||
|
@ -15,35 +15,22 @@ namespace internal {
|
||||
|
||||
class PropertyAccessCompiler BASE_EMBEDDED {
|
||||
public:
|
||||
static Builtins::Name MissBuiltin(Code::Kind kind) {
|
||||
switch (kind) {
|
||||
case Code::LOAD_IC:
|
||||
return Builtins::kLoadIC_Miss;
|
||||
case Code::STORE_IC:
|
||||
return Builtins::kStoreIC_Miss;
|
||||
case Code::KEYED_LOAD_IC:
|
||||
return Builtins::kKeyedLoadIC_Miss;
|
||||
case Code::KEYED_STORE_IC:
|
||||
return Builtins::kKeyedStoreIC_Miss;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
return Builtins::kLoadIC_Miss;
|
||||
}
|
||||
enum Type { LOAD, STORE };
|
||||
|
||||
static void TailCallBuiltin(MacroAssembler* masm, Builtins::Name name);
|
||||
|
||||
protected:
|
||||
PropertyAccessCompiler(Isolate* isolate, Code::Kind kind)
|
||||
: registers_(GetCallingConvention(isolate, kind)),
|
||||
kind_(kind),
|
||||
PropertyAccessCompiler(Isolate* isolate, Type type)
|
||||
: registers_(GetCallingConvention(isolate, type)),
|
||||
type_(type),
|
||||
isolate_(isolate),
|
||||
masm_(isolate, NULL, 256, CodeObjectRequired::kYes) {
|
||||
// TODO(yangguo): remove this once we can serialize IC stubs.
|
||||
masm_.enable_serializer();
|
||||
}
|
||||
|
||||
Code::Kind kind() const { return kind_; }
|
||||
Type type() const { return type_; }
|
||||
|
||||
MacroAssembler* masm() { return &masm_; }
|
||||
Isolate* isolate() const { return isolate_; }
|
||||
Factory* factory() const { return isolate()->factory(); }
|
||||
@ -60,10 +47,10 @@ class PropertyAccessCompiler BASE_EMBEDDED {
|
||||
static void GenerateTailCall(MacroAssembler* masm, Handle<Code> code);
|
||||
|
||||
private:
|
||||
static Register* GetCallingConvention(Isolate* isolate, Code::Kind kind);
|
||||
static Register* GetCallingConvention(Isolate* isolate, Type type);
|
||||
static void InitializePlatformSpecific(AccessCompilerData* data);
|
||||
|
||||
Code::Kind kind_;
|
||||
Type type_;
|
||||
Isolate* isolate_;
|
||||
MacroAssembler masm_;
|
||||
// Ensure that MacroAssembler has a reasonable size.
|
||||
|
@ -366,9 +366,8 @@ void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
Label success;
|
||||
__ b(&success);
|
||||
__ bind(miss);
|
||||
DCHECK(kind() == Code::LOAD_IC);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kLoadIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
@ -380,7 +379,7 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
__ b(&success);
|
||||
GenerateRestoreName(miss, name);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kStoreIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
|
@ -363,9 +363,8 @@ void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
__ B(&success);
|
||||
|
||||
__ Bind(miss);
|
||||
DCHECK(kind() == Code::LOAD_IC);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kLoadIC_Miss);
|
||||
|
||||
__ Bind(&success);
|
||||
}
|
||||
@ -379,7 +378,7 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
|
||||
GenerateRestoreName(miss, name);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kStoreIC_Miss);
|
||||
|
||||
__ Bind(&success);
|
||||
}
|
||||
|
@ -84,18 +84,26 @@ Register NamedStoreHandlerCompiler::FrontendHeader(Register object_reg,
|
||||
miss);
|
||||
}
|
||||
|
||||
// The ICs that don't pass slot and vector through the stack have to
|
||||
// save/restore them in the dispatcher.
|
||||
bool PropertyHandlerCompiler::ShouldPushPopSlotAndVector() {
|
||||
switch (type()) {
|
||||
case LOAD:
|
||||
return true;
|
||||
case STORE:
|
||||
return !StoreWithVectorDescriptor::kPassLastArgsOnStack;
|
||||
}
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
|
||||
Register PropertyHandlerCompiler::Frontend(Handle<Name> name) {
|
||||
Label miss;
|
||||
if (IC::ShouldPushPopSlotAndVector(kind())) {
|
||||
PushVectorAndSlot();
|
||||
}
|
||||
if (ShouldPushPopSlotAndVector()) PushVectorAndSlot();
|
||||
Register reg = FrontendHeader(receiver(), name, &miss);
|
||||
FrontendFooter(name, &miss);
|
||||
// The footer consumes the vector and slot from the stack if miss occurs.
|
||||
if (IC::ShouldPushPopSlotAndVector(kind())) {
|
||||
DiscardVectorAndSlot();
|
||||
}
|
||||
if (ShouldPushPopSlotAndVector()) DiscardVectorAndSlot();
|
||||
return reg;
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,16 @@ class CallOptimization;
|
||||
|
||||
class PropertyHandlerCompiler : public PropertyAccessCompiler {
|
||||
protected:
|
||||
PropertyHandlerCompiler(Isolate* isolate, Code::Kind kind, Handle<Map> map,
|
||||
PropertyHandlerCompiler(Isolate* isolate, Type type, Handle<Map> map,
|
||||
Handle<JSObject> holder)
|
||||
: PropertyAccessCompiler(isolate, kind), map_(map), holder_(holder) {}
|
||||
: PropertyAccessCompiler(isolate, type), map_(map), holder_(holder) {}
|
||||
|
||||
virtual ~PropertyHandlerCompiler() {}
|
||||
|
||||
// The ICs that don't pass slot and vector through the stack have to
|
||||
// save/restore them in the dispatcher.
|
||||
bool ShouldPushPopSlotAndVector();
|
||||
|
||||
virtual Register FrontendHeader(Register object_reg, Handle<Name> name,
|
||||
Label* miss) {
|
||||
UNREACHABLE();
|
||||
@ -110,7 +114,7 @@ class NamedLoadHandlerCompiler : public PropertyHandlerCompiler {
|
||||
public:
|
||||
NamedLoadHandlerCompiler(Isolate* isolate, Handle<Map> map,
|
||||
Handle<JSObject> holder)
|
||||
: PropertyHandlerCompiler(isolate, Code::LOAD_IC, map, holder) {}
|
||||
: PropertyHandlerCompiler(isolate, LOAD, map, holder) {}
|
||||
|
||||
virtual ~NamedLoadHandlerCompiler() {}
|
||||
|
||||
@ -138,7 +142,7 @@ class NamedStoreHandlerCompiler : public PropertyHandlerCompiler {
|
||||
|
||||
explicit NamedStoreHandlerCompiler(Isolate* isolate, Handle<Map> map,
|
||||
Handle<JSObject> holder)
|
||||
: PropertyHandlerCompiler(isolate, Code::STORE_IC, map, holder) {
|
||||
: PropertyHandlerCompiler(isolate, STORE, map, holder) {
|
||||
#ifdef DEBUG
|
||||
if (Descriptor::kPassLastArgsOnStack) {
|
||||
ZapStackArgumentsRegisterAliases();
|
||||
|
@ -373,11 +373,11 @@ void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
Label success;
|
||||
__ jmp(&success);
|
||||
__ bind(miss);
|
||||
if (IC::ShouldPushPopSlotAndVector(kind())) {
|
||||
DCHECK(kind() == Code::LOAD_IC);
|
||||
if (ShouldPushPopSlotAndVector()) {
|
||||
DCHECK_EQ(LOAD, type());
|
||||
PopVectorAndSlot();
|
||||
}
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kLoadIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
@ -388,8 +388,8 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
Label success;
|
||||
__ jmp(&success);
|
||||
GenerateRestoreName(miss, name);
|
||||
DCHECK(!IC::ShouldPushPopSlotAndVector(kind()));
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
DCHECK(!ShouldPushPopSlotAndVector());
|
||||
TailCallBuiltin(masm(), Builtins::kStoreIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
|
13
src/ic/ic.cc
13
src/ic/ic.cc
@ -228,19 +228,6 @@ IC::IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus)
|
||||
old_state_ = state_;
|
||||
}
|
||||
|
||||
// The ICs that don't pass slot and vector through the stack have to
|
||||
// save/restore them in the dispatcher.
|
||||
bool IC::ShouldPushPopSlotAndVector(Code::Kind kind) {
|
||||
if (kind == Code::LOAD_IC || kind == Code::LOAD_GLOBAL_IC ||
|
||||
kind == Code::KEYED_LOAD_IC) {
|
||||
return true;
|
||||
}
|
||||
if (kind == Code::STORE_IC || kind == Code::KEYED_STORE_IC) {
|
||||
return !StoreWithVectorDescriptor::kPassLastArgsOnStack;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
JSFunction* IC::GetHostFunction() const {
|
||||
// Compute the JavaScript frame for the frame pointer of this IC
|
||||
// structure. We need this to be able to find the function
|
||||
|
@ -60,10 +60,6 @@ class IC {
|
||||
IsKeyedStoreIC();
|
||||
}
|
||||
|
||||
// The ICs that don't pass slot and vector through the stack have to
|
||||
// save/restore them in the dispatcher.
|
||||
static bool ShouldPushPopSlotAndVector(Code::Kind kind);
|
||||
|
||||
static inline bool IsHandler(Object* object);
|
||||
|
||||
// Nofity the IC system that a feedback has changed.
|
||||
@ -140,11 +136,6 @@ class IC {
|
||||
bool IsStoreOwnIC() const { return IsStoreOwnICKind(kind_); }
|
||||
bool IsKeyedStoreIC() const { return IsKeyedStoreICKind(kind_); }
|
||||
bool is_keyed() const { return IsKeyedLoadIC() || IsKeyedStoreIC(); }
|
||||
Code::Kind handler_kind() const {
|
||||
if (IsAnyLoad()) return Code::LOAD_IC;
|
||||
DCHECK(IsAnyStore());
|
||||
return Code::STORE_IC;
|
||||
}
|
||||
bool ShouldRecomputeHandler(Handle<String> name);
|
||||
|
||||
Handle<Map> receiver_map() { return receiver_map_; }
|
||||
|
@ -352,9 +352,8 @@ void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
Label success;
|
||||
__ Branch(&success);
|
||||
__ bind(miss);
|
||||
DCHECK(kind() == Code::LOAD_IC);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kLoadIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
@ -366,7 +365,7 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
__ Branch(&success);
|
||||
GenerateRestoreName(miss, name);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kStoreIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
|
@ -352,9 +352,8 @@ void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
Label success;
|
||||
__ Branch(&success);
|
||||
__ bind(miss);
|
||||
DCHECK(kind() == Code::LOAD_IC);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kLoadIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
@ -366,7 +365,7 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
__ Branch(&success);
|
||||
GenerateRestoreName(miss, name);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kStoreIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
|
@ -367,9 +367,8 @@ void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
Label success;
|
||||
__ b(&success);
|
||||
__ bind(miss);
|
||||
DCHECK(kind() == Code::LOAD_IC);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kLoadIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
@ -381,7 +380,7 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
__ b(&success);
|
||||
GenerateRestoreName(miss, name);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kStoreIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
|
@ -353,9 +353,8 @@ void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
Label success;
|
||||
__ b(&success);
|
||||
__ bind(miss);
|
||||
DCHECK(kind() == Code::LOAD_IC);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kLoadIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
@ -366,7 +365,7 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
__ b(&success);
|
||||
GenerateRestoreName(miss, name);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kStoreIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,7 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
StubCache::StubCache(Isolate* isolate, Code::Kind ic_kind)
|
||||
: isolate_(isolate), ic_kind_(ic_kind) {
|
||||
StubCache::StubCache(Isolate* isolate) : isolate_(isolate) {
|
||||
// Ensure the nullptr (aka Smi::kZero) which StubCache::Get() returns
|
||||
// when the entry is not found is not considered as a handler.
|
||||
DCHECK(!IC::IsHandler(nullptr));
|
||||
|
@ -73,7 +73,6 @@ class StubCache {
|
||||
}
|
||||
|
||||
Isolate* isolate() { return isolate_; }
|
||||
Code::Kind ic_kind() const { return ic_kind_; }
|
||||
|
||||
// Setting the entry size such that the index is shifted by Name::kHashShift
|
||||
// is convenient; shifting down the length field (to extract the hash code)
|
||||
@ -98,7 +97,7 @@ class StubCache {
|
||||
}
|
||||
|
||||
// The constructor is made public only for the purposes of testing.
|
||||
StubCache(Isolate* isolate, Code::Kind ic_kind);
|
||||
explicit StubCache(Isolate* isolate);
|
||||
|
||||
private:
|
||||
// The stub cache has a primary and secondary level. The two levels have
|
||||
@ -133,7 +132,6 @@ class StubCache {
|
||||
Entry primary_[kPrimaryTableSize];
|
||||
Entry secondary_[kSecondaryTableSize];
|
||||
Isolate* isolate_;
|
||||
Code::Kind ic_kind_;
|
||||
|
||||
friend class Isolate;
|
||||
friend class SCTableReference;
|
||||
|
@ -358,9 +358,8 @@ void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
Label success;
|
||||
__ jmp(&success);
|
||||
__ bind(miss);
|
||||
DCHECK(kind() == Code::LOAD_IC);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kLoadIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
@ -372,7 +371,7 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
__ jmp(&success);
|
||||
GenerateRestoreName(miss, name);
|
||||
PopVectorAndSlot();
|
||||
TailCallBuiltin(masm(), MissBuiltin(kind()));
|
||||
TailCallBuiltin(masm(), Builtins::kStoreIC_Miss);
|
||||
__ bind(&success);
|
||||
}
|
||||
}
|
||||
|
@ -2735,8 +2735,8 @@ bool Isolate::Init(StartupDeserializer* des) {
|
||||
eternal_handles_ = new EternalHandles();
|
||||
bootstrapper_ = new Bootstrapper(this);
|
||||
handle_scope_implementer_ = new HandleScopeImplementer(this);
|
||||
load_stub_cache_ = new StubCache(this, Code::LOAD_IC);
|
||||
store_stub_cache_ = new StubCache(this, Code::STORE_IC);
|
||||
load_stub_cache_ = new StubCache(this);
|
||||
store_stub_cache_ = new StubCache(this);
|
||||
materialized_object_store_ = new MaterializedObjectStore(this);
|
||||
regexp_stack_ = new RegExpStack();
|
||||
regexp_stack_->isolate_ = this;
|
||||
|
24
src/log.cc
24
src/log.cc
@ -1588,30 +1588,6 @@ void Logger::LogCodeObject(Object* object) {
|
||||
description = "An IC handler from the snapshot";
|
||||
tag = CodeEventListener::HANDLER_TAG;
|
||||
break;
|
||||
case AbstractCode::KEYED_LOAD_IC:
|
||||
description = "A keyed load IC from the snapshot";
|
||||
tag = CodeEventListener::KEYED_LOAD_IC_TAG;
|
||||
break;
|
||||
case AbstractCode::LOAD_IC:
|
||||
description = "A load IC from the snapshot";
|
||||
tag = CodeEventListener::LOAD_IC_TAG;
|
||||
break;
|
||||
case AbstractCode::LOAD_GLOBAL_IC:
|
||||
description = "A load global IC from the snapshot";
|
||||
tag = Logger::LOAD_GLOBAL_IC_TAG;
|
||||
break;
|
||||
case AbstractCode::STORE_IC:
|
||||
description = "A store IC from the snapshot";
|
||||
tag = CodeEventListener::STORE_IC_TAG;
|
||||
break;
|
||||
case AbstractCode::STORE_GLOBAL_IC:
|
||||
description = "A store global IC from the snapshot";
|
||||
tag = CodeEventListener::STORE_GLOBAL_IC_TAG;
|
||||
break;
|
||||
case AbstractCode::KEYED_STORE_IC:
|
||||
description = "A keyed store IC from the snapshot";
|
||||
tag = CodeEventListener::KEYED_STORE_IC_TAG;
|
||||
break;
|
||||
case AbstractCode::WASM_FUNCTION:
|
||||
description = "A Wasm function";
|
||||
tag = CodeEventListener::STUB_TAG;
|
||||
|
@ -3698,9 +3698,6 @@ bool Code::IsCodeStubOrIC() const {
|
||||
switch (kind()) {
|
||||
case STUB:
|
||||
case HANDLER:
|
||||
#define CASE_KIND(kind) case kind:
|
||||
IC_KIND_LIST(CASE_KIND)
|
||||
#undef CASE_KIND
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -3905,16 +3902,6 @@ void Code::set_deopt_already_counted(bool flag) {
|
||||
WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
|
||||
}
|
||||
|
||||
bool Code::is_inline_cache_stub() const {
|
||||
Kind kind = this->kind();
|
||||
switch (kind) {
|
||||
#define CASE(name) case name: return true;
|
||||
IC_KIND_LIST(CASE)
|
||||
#undef CASE
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Code::is_handler() const { return kind() == HANDLER; }
|
||||
bool Code::is_stub() const { return kind() == STUB; }
|
||||
bool Code::is_optimized_code() const { return kind() == OPTIMIZED_FUNCTION; }
|
||||
|
@ -3642,7 +3642,7 @@ class Code: public HeapObject {
|
||||
// cache state, and arguments count.
|
||||
typedef uint32_t Flags;
|
||||
|
||||
#define NON_IC_KIND_LIST(V) \
|
||||
#define CODE_KIND_LIST(V) \
|
||||
V(OPTIMIZED_FUNCTION) \
|
||||
V(BYTECODE_HANDLER) \
|
||||
V(STUB) \
|
||||
@ -3655,18 +3655,6 @@ class Code: public HeapObject {
|
||||
V(WASM_INTERPRETER_ENTRY) \
|
||||
V(C_WASM_ENTRY)
|
||||
|
||||
#define IC_KIND_LIST(V) \
|
||||
V(LOAD_IC) \
|
||||
V(LOAD_GLOBAL_IC) \
|
||||
V(KEYED_LOAD_IC) \
|
||||
V(STORE_IC) \
|
||||
V(STORE_GLOBAL_IC) \
|
||||
V(KEYED_STORE_IC)
|
||||
|
||||
#define CODE_KIND_LIST(V) \
|
||||
NON_IC_KIND_LIST(V) \
|
||||
IC_KIND_LIST(V)
|
||||
|
||||
enum Kind {
|
||||
#define DEFINE_CODE_KIND_ENUM(name) name,
|
||||
CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM)
|
||||
@ -3741,7 +3729,6 @@ class Code: public HeapObject {
|
||||
inline Kind kind() const;
|
||||
|
||||
// Testers for IC stub kinds.
|
||||
inline bool is_inline_cache_stub() const;
|
||||
inline bool is_handler() const;
|
||||
inline bool is_stub() const;
|
||||
inline bool is_optimized_code() const;
|
||||
|
@ -87,9 +87,6 @@ void CodeSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
|
||||
SerializeBuiltinReference(code_object, how_to_code, where_to_point, 0);
|
||||
return;
|
||||
case Code::STUB:
|
||||
#define IC_KIND_CASE(KIND) case Code::KIND:
|
||||
IC_KIND_LIST(IC_KIND_CASE)
|
||||
#undef IC_KIND_CASE
|
||||
if (code_object->builtin_index() == -1) {
|
||||
SerializeCodeStub(code_object, how_to_code, where_to_point);
|
||||
} else {
|
||||
|
@ -4202,21 +4202,14 @@ Handle<JSFunction> GetFunctionByName(Isolate* isolate, const char* name) {
|
||||
return Handle<JSFunction>::cast(obj);
|
||||
}
|
||||
|
||||
void CheckIC(Handle<JSFunction> function, Code::Kind kind, int slot_index,
|
||||
void CheckIC(Handle<JSFunction> function, int slot_index,
|
||||
InlineCacheState state) {
|
||||
CHECK(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC);
|
||||
FeedbackVector* vector = function->feedback_vector();
|
||||
FeedbackSlot slot(slot_index);
|
||||
if (kind == Code::LOAD_IC) {
|
||||
LoadICNexus nexus(vector, slot);
|
||||
CHECK_EQ(nexus.StateFromFeedback(), state);
|
||||
} else if (kind == Code::KEYED_LOAD_IC) {
|
||||
KeyedLoadICNexus nexus(vector, slot);
|
||||
CHECK_EQ(nexus.StateFromFeedback(), state);
|
||||
}
|
||||
LoadICNexus nexus(vector, slot);
|
||||
CHECK_EQ(nexus.StateFromFeedback(), state);
|
||||
}
|
||||
|
||||
|
||||
TEST(MonomorphicStaysMonomorphicAfterGC) {
|
||||
if (FLAG_always_opt) return;
|
||||
ManualGCScope manual_gc_scope;
|
||||
@ -4241,12 +4234,12 @@ TEST(MonomorphicStaysMonomorphicAfterGC) {
|
||||
CompileRun("(testIC())");
|
||||
}
|
||||
CcTest::CollectAllGarbage();
|
||||
CheckIC(loadIC, Code::LOAD_IC, 0, MONOMORPHIC);
|
||||
CheckIC(loadIC, 0, MONOMORPHIC);
|
||||
{
|
||||
v8::HandleScope scope(CcTest::isolate());
|
||||
CompileRun("(testIC())");
|
||||
}
|
||||
CheckIC(loadIC, Code::LOAD_IC, 0, MONOMORPHIC);
|
||||
CheckIC(loadIC, 0, MONOMORPHIC);
|
||||
}
|
||||
|
||||
|
||||
@ -4277,12 +4270,12 @@ TEST(PolymorphicStaysPolymorphicAfterGC) {
|
||||
CompileRun("(testIC())");
|
||||
}
|
||||
CcTest::CollectAllGarbage();
|
||||
CheckIC(loadIC, Code::LOAD_IC, 0, POLYMORPHIC);
|
||||
CheckIC(loadIC, 0, POLYMORPHIC);
|
||||
{
|
||||
v8::HandleScope scope(CcTest::isolate());
|
||||
CompileRun("(testIC())");
|
||||
}
|
||||
CheckIC(loadIC, Code::LOAD_IC, 0, POLYMORPHIC);
|
||||
CheckIC(loadIC, 0, POLYMORPHIC);
|
||||
}
|
||||
|
||||
|
||||
|
@ -124,8 +124,7 @@ TEST(TryProbeStubCache) {
|
||||
CodeAssemblerTester data(isolate, kNumParams);
|
||||
AccessorAssembler m(data.state());
|
||||
|
||||
Code::Kind ic_kind = Code::LOAD_IC;
|
||||
StubCache stub_cache(isolate, ic_kind);
|
||||
StubCache stub_cache(isolate);
|
||||
stub_cache.Clear();
|
||||
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user