Commit 75ed4a60 authored by verwaest's avatar verwaest Committed by Commit bot

Turn StoreWithInterceptor into a turbofan stub

BUG=

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

Cr-Commit-Position: refs/heads/master@{#34927}
parent 369a6ac0
......@@ -328,6 +328,12 @@ Callable CodeFactory::SubString(Isolate* isolate) {
}
// static
Callable CodeFactory::StoreInterceptor(Isolate* isolate) {
StoreInterceptorStub stub(isolate);
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
}
// static
Callable CodeFactory::Typeof(Isolate* isolate) {
TypeofStub stub(isolate);
......
......@@ -54,6 +54,8 @@ class CodeFactory final {
Isolate* isolate, LanguageMode mode,
InlineCacheState initialization_state);
static Callable StoreInterceptor(Isolate* isolate);
static Callable CompareIC(Isolate* isolate, Token::Value op);
static Callable CompareNilIC(Isolate* isolate, NilValue nil_value);
......
......@@ -2332,6 +2332,17 @@ void ToBooleanStub::GenerateAssembly(
}
}
void StoreInterceptorStub::GenerateAssembly(
compiler::CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* receiver = assembler->Parameter(0);
Node* name = assembler->Parameter(1);
Node* value = assembler->Parameter(2);
Node* context = assembler->Parameter(3);
assembler->TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context,
receiver, name, value);
}
template<class StateType>
void HydrogenCodeStub::TraceTransition(StateType from, StateType to) {
// Note: Although a no-op transition is semantically OK, it is hinting at a
......
......@@ -124,6 +124,7 @@ namespace internal {
V(KeyedLoadSloppyArguments) \
V(KeyedStoreSloppyArguments) \
V(StoreField) \
V(StoreInterceptor) \
V(StoreGlobal) \
V(StoreTransition)
......@@ -779,6 +780,18 @@ class ToBooleanStub final : public TurboFanCodeStub {
DEFINE_TURBOFAN_CODE_STUB(ToBoolean, TurboFanCodeStub);
};
class StoreInterceptorStub : public TurboFanCodeStub {
public:
explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
void GenerateAssembly(compiler::CodeStubAssembler* assember) const override;
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(Store);
DEFINE_CODE_STUB(StoreInterceptor, TurboFanCodeStub);
};
enum StringAddFlags {
// Omit both parameter checks.
STRING_ADD_CHECK_NONE = 0,
......@@ -2549,7 +2562,6 @@ class AllocateMutableHeapNumberStub : public TurboFanCodeStub {
DEFINE_CODE_STUB(AllocateMutableHeapNumber, TurboFanCodeStub);
};
class AllocateInNewSpaceStub final : public HydrogenCodeStub {
public:
explicit AllocateInNewSpaceStub(Isolate* isolate)
......
......@@ -748,18 +748,6 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
}
Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
Handle<Name> name) {
__ Push(receiver(), this->name(), value());
// Do tail-call to the runtime system.
__ TailCallRuntime(Runtime::kStorePropertyWithInterceptor);
// Return the generated code.
return GetCode(kind(), Code::FAST, name);
}
Register NamedStoreHandlerCompiler::value() {
return StoreDescriptor::ValueRegister();
}
......
......@@ -386,22 +386,6 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
}
Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
Handle<Name> name) {
Label miss;
ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreInterceptor");
__ Push(receiver(), this->name(), value());
// Do tail-call to the runtime system.
__ TailCallRuntime(Runtime::kStorePropertyWithInterceptor);
// Return the generated code.
return GetCode(kind(), Code::FAST, name);
}
Register NamedStoreHandlerCompiler::value() {
return StoreDescriptor::ValueRegister();
}
......
......@@ -231,7 +231,6 @@ class NamedStoreHandlerCompiler : public PropertyHandlerCompiler {
Handle<Code> CompileStoreViaSetter(Handle<JSObject> object, Handle<Name> name,
int accessor_index,
int expected_arguments);
Handle<Code> CompileStoreInterceptor(Handle<Name> name);
static void GenerateStoreViaSetter(MacroAssembler* masm, Handle<Map> map,
Register receiver, Register holder,
......
......@@ -763,22 +763,6 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
}
Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
Handle<Name> name) {
__ pop(scratch1()); // remove the return address
__ push(receiver());
__ push(this->name());
__ push(value());
__ push(scratch1()); // restore return address
// Do tail-call to the runtime system.
__ TailCallRuntime(Runtime::kStorePropertyWithInterceptor);
// Return the generated code.
return GetCode(kind(), Code::FAST, name);
}
Register NamedStoreHandlerCompiler::value() {
return StoreDescriptor::ValueRegister();
}
......
......@@ -9,6 +9,7 @@
#include "src/api-arguments.h"
#include "src/arguments.h"
#include "src/base/bits.h"
#include "src/code-factory.h"
#include "src/codegen.h"
#include "src/conversions.h"
#include "src/execution.h"
......@@ -1721,8 +1722,7 @@ Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup,
case LookupIterator::INTERCEPTOR: {
DCHECK(!holder->GetNamedInterceptor()->setter()->IsUndefined());
NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder);
return compiler.CompileStoreInterceptor(lookup->name());
return CodeFactory::StoreInterceptor(isolate()).code();
}
case LookupIterator::ACCESSOR: {
......
......@@ -741,18 +741,6 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
}
Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
Handle<Name> name) {
__ Push(receiver(), this->name(), value());
// Do tail-call to the runtime system.
__ TailCallRuntime(Runtime::kStorePropertyWithInterceptor);
// Return the generated code.
return GetCode(kind(), Code::FAST, name);
}
Register NamedStoreHandlerCompiler::value() {
return StoreDescriptor::ValueRegister();
}
......
......@@ -741,18 +741,6 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
}
Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
Handle<Name> name) {
__ Push(receiver(), this->name(), value());
// Do tail-call to the runtime system.
__ TailCallRuntime(Runtime::kStorePropertyWithInterceptor);
// Return the generated code.
return GetCode(kind(), Code::FAST, name);
}
Register NamedStoreHandlerCompiler::value() {
return StoreDescriptor::ValueRegister();
}
......
......@@ -741,18 +741,6 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
}
Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
Handle<Name> name) {
__ Push(receiver(), this->name(), value());
// Do tail-call to the runtime system.
__ TailCallRuntime(Runtime::kStorePropertyWithInterceptor);
// Return the generated code.
return GetCode(kind(), Code::FAST, name);
}
Register NamedStoreHandlerCompiler::value() {
return StoreDescriptor::ValueRegister();
}
......
......@@ -760,22 +760,6 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
}
Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
Handle<Name> name) {
__ PopReturnAddressTo(scratch1());
__ Push(receiver());
__ Push(this->name());
__ Push(value());
__ PushReturnAddressFrom(scratch1());
// Do tail-call to the runtime system.
__ TailCallRuntime(Runtime::kStorePropertyWithInterceptor);
// Return the generated code.
return GetCode(kind(), Code::FAST, name);
}
Register NamedStoreHandlerCompiler::value() {
return StoreDescriptor::ValueRegister();
}
......
......@@ -763,22 +763,6 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
}
Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
Handle<Name> name) {
__ pop(scratch1()); // remove the return address
__ push(receiver());
__ push(this->name());
__ push(value());
__ push(scratch1()); // restore return address
// Do tail-call to the runtime system.
__ TailCallRuntime(Runtime::kStorePropertyWithInterceptor);
// Return the generated code.
return GetCode(kind(), Code::FAST, name);
}
Register NamedStoreHandlerCompiler::value() {
return StoreDescriptor::ValueRegister();
}
......
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