Commit b2119937 authored by mvstanton's avatar mvstanton Committed by Commit bot

[builtins] Move LoadGlobalICStub to builtins

Following in the footsteps of the other load/store ICs.

R=epertoso@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2608893002
Cr-Commit-Position: refs/heads/master@{#42002}
parent 92d8d955
......@@ -58,5 +58,21 @@ 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 v8
......@@ -454,6 +454,14 @@ namespace internal {
StoreWithVector) \
TFS(KeyedStoreICStrictTrampoline, KEYED_STORE_IC, \
StoreICState::kStrictModeState, Store) \
TFS(LoadGlobalIC, LOAD_GLOBAL_IC, LoadGlobalICState::kNotInsideTypeOfState, \
LoadGlobalWithVector) \
TFS(LoadGlobalICInsideTypeof, LOAD_GLOBAL_IC, \
LoadGlobalICState::kInsideTypeOfState, LoadGlobalWithVector) \
TFS(LoadGlobalICTrampoline, LOAD_GLOBAL_IC, \
LoadGlobalICState::kNotInsideTypeOfState, LoadGlobal) \
TFS(LoadGlobalICInsideTypeofTrampoline, LOAD_GLOBAL_IC, \
LoadGlobalICState::kInsideTypeOfState, LoadGlobal) \
\
/* Math */ \
/* ES6 section 20.2.2.1 Math.abs ( x ) */ \
......
......@@ -47,15 +47,20 @@ Callable CodeFactory::LoadICInOptimizedCode(Isolate* isolate) {
// static
Callable CodeFactory::LoadGlobalIC(Isolate* isolate, TypeofMode typeof_mode) {
LoadGlobalICTrampolineStub stub(isolate, LoadGlobalICState(typeof_mode));
return make_callable(stub);
return Callable(
typeof_mode == NOT_INSIDE_TYPEOF
? isolate->builtins()->LoadGlobalICTrampoline()
: isolate->builtins()->LoadGlobalICInsideTypeofTrampoline(),
LoadGlobalDescriptor(isolate));
}
// static
Callable CodeFactory::LoadGlobalICInOptimizedCode(Isolate* isolate,
TypeofMode typeof_mode) {
LoadGlobalICStub stub(isolate, LoadGlobalICState(typeof_mode));
return make_callable(stub);
return Callable(typeof_mode == NOT_INSIDE_TYPEOF
? isolate->builtins()->LoadGlobalIC()
: isolate->builtins()->LoadGlobalICInsideTypeof(),
LoadGlobalWithVectorDescriptor(isolate));
}
// static
......
......@@ -445,15 +445,6 @@ void LoadICProtoArrayStub::GenerateAssembly(CodeAssemblerState* state) const {
state, throw_reference_error_if_nonexistent());
}
void LoadGlobalICStub::GenerateAssembly(CodeAssemblerState* state) const {
AccessorAssembler::GenerateLoadGlobalIC(state, typeof_mode());
}
void LoadGlobalICTrampolineStub::GenerateAssembly(
CodeAssemblerState* state) const {
AccessorAssembler::GenerateLoadGlobalICTrampoline(state, typeof_mode());
}
void ElementsTransitionAndStoreStub::GenerateAssembly(
compiler::CodeAssemblerState* state) const {
typedef CodeStubAssembler::Label Label;
......
......@@ -49,7 +49,6 @@ class Node;
V(StoreBufferOverflow) \
V(StoreElement) \
V(SubString) \
V(LoadGlobalIC) \
V(FastNewRestParameter) \
V(FastNewSloppyArguments) \
V(FastNewStrictArguments) \
......@@ -110,11 +109,7 @@ class Node;
V(LoadApiGetter) \
V(LoadIndexedInterceptor) \
V(LoadField) \
V(GrowArrayElements) \
/* These are only called from FGC and */ \
/* can be removed when we use ignition */ \
/* only */ \
V(LoadGlobalICTrampoline)
V(GrowArrayElements)
// List of code stubs only used on ARM 32 bits platforms.
#if V8_TARGET_ARCH_ARM
......@@ -1632,29 +1627,6 @@ class StringCharAtGenerator {
DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator);
};
class LoadGlobalICTrampolineStub : public TurboFanCodeStub {
public:
explicit LoadGlobalICTrampolineStub(Isolate* isolate,
const LoadGlobalICState& state)
: TurboFanCodeStub(isolate) {
minor_key_ = state.GetExtraICState();
}
Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; }
TypeofMode typeof_mode() const {
LoadGlobalICState state(GetExtraICState());
return state.typeof_mode();
}
ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_);
}
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobal);
DEFINE_TURBOFAN_CODE_STUB(LoadGlobalICTrampoline, TurboFanCodeStub);
};
class CallICTrampolineStub : public PlatformCodeStub {
public:
CallICTrampolineStub(Isolate* isolate, const CallICState& state)
......@@ -1701,28 +1673,6 @@ class LoadICProtoArrayStub : public TurboFanCodeStub {
DEFINE_TURBOFAN_CODE_STUB(LoadICProtoArray, TurboFanCodeStub);
};
class LoadGlobalICStub : public TurboFanCodeStub {
public:
explicit LoadGlobalICStub(Isolate* isolate, const LoadGlobalICState& state)
: TurboFanCodeStub(isolate) {
minor_key_ = state.GetExtraICState();
}
Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; }
TypeofMode typeof_mode() const {
LoadGlobalICState state(GetExtraICState());
return state.typeof_mode();
}
ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_);
}
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalWithVector);
DEFINE_TURBOFAN_CODE_STUB(LoadGlobalIC, TurboFanCodeStub);
};
class DoubleToIStub : public PlatformCodeStub {
public:
DoubleToIStub(Isolate* isolate, Register source, Register destination,
......
......@@ -1669,7 +1669,7 @@ void AccessorAssemblerImpl::GenerateLoadField() {
}
void AccessorAssemblerImpl::GenerateLoadGlobalIC(TypeofMode typeof_mode) {
typedef LoadGlobalICStub::Descriptor Descriptor;
typedef LoadGlobalWithVectorDescriptor Descriptor;
Node* name = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot);
......@@ -1682,7 +1682,7 @@ void AccessorAssemblerImpl::GenerateLoadGlobalIC(TypeofMode typeof_mode) {
void AccessorAssemblerImpl::GenerateLoadGlobalICTrampoline(
TypeofMode typeof_mode) {
typedef LoadGlobalICTrampolineStub::Descriptor Descriptor;
typedef LoadGlobalDescriptor Descriptor;
Node* name = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot);
......
......@@ -235,6 +235,13 @@ class LoadGlobalICState final BASE_EMBEDDED {
static TypeofMode GetTypeofMode(ExtraICState state) {
return LoadGlobalICState(state).typeof_mode();
}
// For convenience, a statically declared encoding of typeof mode
// IC state.
static const ExtraICState kInsideTypeOfState = INSIDE_TYPEOF
<< TypeofModeBits::kShift;
static const ExtraICState kNotInsideTypeOfState = NOT_INSIDE_TYPEOF
<< TypeofModeBits::kShift;
};
......
......@@ -22161,13 +22161,9 @@ void Recompile(Args... args) {
}
void RecompileICStubs(i::Isolate* isolate) {
using namespace i;
Recompile<LoadGlobalICStub>(isolate, LoadGlobalICState(NOT_INSIDE_TYPEOF));
Recompile<LoadGlobalICStub>(isolate, LoadGlobalICState(INSIDE_TYPEOF));
Recompile<LoadGlobalICTrampolineStub>(isolate,
LoadGlobalICState(NOT_INSIDE_TYPEOF));
Recompile<LoadGlobalICTrampolineStub>(isolate,
LoadGlobalICState(INSIDE_TYPEOF));
// BUG(5784): We had a list of IC stubs here to recompile. These are now
// builtins and we can't compile them again (easily). Bug 5784 tracks
// our progress in finding another way to do this.
}
} // namespace
......
......@@ -1760,32 +1760,6 @@ void Recompile(Args... args) {
} // namespace
TEST(CodeStubAssemblerGraphsCorrectness) {
// The test does not work with interpreter because bytecode handlers taken
// from the snapshot already refer to precompiled stubs from the snapshot
// and there is no way to trigger bytecode handlers recompilation.
if (FLAG_ignition || FLAG_turbo) return;
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* v8_isolate = v8::Isolate::New(create_params);
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
{
v8::Isolate::Scope isolate_scope(v8_isolate);
LocalContext env(v8_isolate);
v8::HandleScope scope(v8_isolate);
FLAG_csa_verify = true;
// Recompile some stubs here.
Recompile<LoadGlobalICStub>(isolate, LoadGlobalICState(NOT_INSIDE_TYPEOF));
Recompile<LoadGlobalICTrampolineStub>(isolate,
LoadGlobalICState(NOT_INSIDE_TYPEOF));
}
v8_isolate->Dispose();
}
void CustomPromiseHook(v8::PromiseHookType type, v8::Local<v8::Promise> promise,
v8::Local<v8::Value> parentPromise) {}
......
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