Commit 5767cd14 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Always use the LoadStubCompiler for Load handlers, also for keyedload handlers.

BUG=
R=mvstanton@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22551 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b8eb36a9
......@@ -1004,13 +1004,8 @@ void LoadStubCompiler::GenerateLoadField(Register reg,
FieldIndex field,
Representation representation) {
if (!reg.is(receiver())) __ mov(receiver(), reg);
if (kind() == Code::LOAD_IC) {
LoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
} else {
KeyedLoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
}
LoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
}
......
......@@ -960,13 +960,8 @@ void LoadStubCompiler::GenerateLoadField(Register reg,
FieldIndex field,
Representation representation) {
__ Mov(receiver(), reg);
if (kind() == Code::LOAD_IC) {
LoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
} else {
KeyedLoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
}
LoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
}
......
......@@ -622,14 +622,6 @@ void LoadFieldStub::InitializeInterfaceDescriptor(
}
void KeyedLoadFieldStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { InterfaceDescriptor::ContextRegister(),
LoadIC::ReceiverRegister() };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void StringLengthStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { InterfaceDescriptor::ContextRegister(),
......@@ -639,15 +631,6 @@ void StringLengthStub::InitializeInterfaceDescriptor(
}
void KeyedStringLengthStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { InterfaceDescriptor::ContextRegister(),
LoadIC::ReceiverRegister(),
LoadIC::NameRegister() };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void KeyedStoreFastElementStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { InterfaceDescriptor::ContextRegister(),
......
......@@ -15,69 +15,67 @@ namespace v8 {
namespace internal {
// List of code stubs used on all platforms.
#define CODE_STUB_LIST_ALL_PLATFORMS(V) \
V(CallFunction) \
V(CallConstruct) \
V(BinaryOpIC) \
V(BinaryOpICWithAllocationSite) \
V(BinaryOpWithAllocationSite) \
V(StringAdd) \
V(SubString) \
V(StringCompare) \
V(Compare) \
V(CompareIC) \
V(CompareNilIC) \
V(MathPow) \
V(CallIC) \
V(CallIC_Array) \
V(FunctionPrototype) \
V(RecordWrite) \
V(StoreBufferOverflow) \
V(RegExpExec) \
V(Instanceof) \
V(ConvertToDouble) \
V(WriteInt32ToHeapNumber) \
V(StackCheck) \
V(Interrupt) \
V(FastNewClosure) \
V(FastNewContext) \
V(FastCloneShallowArray) \
V(FastCloneShallowObject) \
V(CreateAllocationSite) \
V(ToBoolean) \
V(ToNumber) \
V(ArgumentsAccess) \
V(RegExpConstructResult) \
V(NumberToString) \
V(DoubleToI) \
V(CEntry) \
V(JSEntry) \
V(KeyedLoadElement) \
V(KeyedLoadGeneric) \
V(ArrayNoArgumentConstructor) \
V(ArraySingleArgumentConstructor) \
V(ArrayNArgumentsConstructor) \
V(InternalArrayNoArgumentConstructor) \
V(InternalArraySingleArgumentConstructor) \
V(InternalArrayNArgumentsConstructor) \
V(KeyedStoreElement) \
V(DebuggerStatement) \
V(NameDictionaryLookup) \
V(ElementsTransitionAndStore) \
V(TransitionElementsKind) \
V(StoreArrayLiteralElement) \
V(StubFailureTrampoline) \
V(ArrayConstructor) \
V(InternalArrayConstructor) \
V(ProfileEntryHook) \
V(StoreGlobal) \
V(CallApiFunction) \
V(CallApiGetter) \
/* IC Handler stubs */ \
V(LoadField) \
V(KeyedLoadField) \
V(StringLength) \
V(KeyedStringLength)
#define CODE_STUB_LIST_ALL_PLATFORMS(V) \
V(CallFunction) \
V(CallConstruct) \
V(BinaryOpIC) \
V(BinaryOpICWithAllocationSite) \
V(BinaryOpWithAllocationSite) \
V(StringAdd) \
V(SubString) \
V(StringCompare) \
V(Compare) \
V(CompareIC) \
V(CompareNilIC) \
V(MathPow) \
V(CallIC) \
V(CallIC_Array) \
V(FunctionPrototype) \
V(RecordWrite) \
V(StoreBufferOverflow) \
V(RegExpExec) \
V(Instanceof) \
V(ConvertToDouble) \
V(WriteInt32ToHeapNumber) \
V(StackCheck) \
V(Interrupt) \
V(FastNewClosure) \
V(FastNewContext) \
V(FastCloneShallowArray) \
V(FastCloneShallowObject) \
V(CreateAllocationSite) \
V(ToBoolean) \
V(ToNumber) \
V(ArgumentsAccess) \
V(RegExpConstructResult) \
V(NumberToString) \
V(DoubleToI) \
V(CEntry) \
V(JSEntry) \
V(KeyedLoadElement) \
V(KeyedLoadGeneric) \
V(ArrayNoArgumentConstructor) \
V(ArraySingleArgumentConstructor) \
V(ArrayNArgumentsConstructor) \
V(InternalArrayNoArgumentConstructor) \
V(InternalArraySingleArgumentConstructor) \
V(InternalArrayNArgumentsConstructor) \
V(KeyedStoreElement) \
V(DebuggerStatement) \
V(NameDictionaryLookup) \
V(ElementsTransitionAndStore) \
V(TransitionElementsKind) \
V(StoreArrayLiteralElement) \
V(StubFailureTrampoline) \
V(ArrayConstructor) \
V(InternalArrayConstructor) \
V(ProfileEntryHook) \
V(StoreGlobal) \
V(CallApiFunction) \
V(CallApiGetter) \
/* IC Handler stubs */ \
V(LoadField) \
V(StringLength)
// List of code stubs only used on ARM 32 bits platforms.
#if V8_TARGET_ARCH_ARM
......@@ -1038,19 +1036,6 @@ class StringLengthStub: public HandlerStub {
};
class KeyedStringLengthStub: public StringLengthStub {
public:
explicit KeyedStringLengthStub(Isolate* isolate) : StringLengthStub(isolate) {
Initialize(Code::KEYED_LOAD_IC);
}
virtual void InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
private:
virtual CodeStub::Major MajorKey() const { return KeyedStringLength; }
};
class StoreGlobalStub : public HandlerStub {
public:
StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global)
......@@ -1154,21 +1139,6 @@ class CallApiGetterStub : public PlatformCodeStub {
};
class KeyedLoadFieldStub: public LoadFieldStub {
public:
KeyedLoadFieldStub(Isolate* isolate, FieldIndex index)
: LoadFieldStub(isolate, index) {
Initialize(Code::KEYED_LOAD_IC);
}
virtual void InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
private:
virtual CodeStub::Major MajorKey() const { return KeyedLoadField; }
};
class BinaryOpICStub : public HydrogenCodeStub {
public:
BinaryOpICStub(Isolate* isolate, Token::Value op, OverwriteMode mode)
......
......@@ -968,13 +968,8 @@ void LoadStubCompiler::GenerateLoadField(Register reg,
FieldIndex field,
Representation representation) {
if (!reg.is(receiver())) __ mov(receiver(), reg);
if (kind() == Code::LOAD_IC) {
LoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
} else {
KeyedLoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
}
LoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
}
......
......@@ -153,6 +153,7 @@ IC::IC(FrameDepth depth, Isolate* isolate)
pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address);
target_ = handle(raw_target(), isolate);
state_ = target_->ic_state();
kind_ = target_->kind();
extra_ic_state_ = target_->extra_ic_state();
}
......@@ -525,19 +526,12 @@ void CompareIC::Clear(Isolate* isolate,
}
Handle<Code> KeyedLoadIC::megamorphic_stub() {
if (FLAG_compiled_keyed_generic_loads) {
return KeyedLoadGenericElementStub(isolate()).GetCode();
} else {
return isolate()->builtins()->KeyedLoadIC_Generic();
}
}
Handle<Code> KeyedLoadIC::generic_stub() const {
// static
Handle<Code> KeyedLoadIC::generic_stub(Isolate* isolate) {
if (FLAG_compiled_keyed_generic_loads) {
return KeyedLoadGenericElementStub(isolate()).GetCode();
return KeyedLoadGenericElementStub(isolate).GetCode();
} else {
return isolate()->builtins()->KeyedLoadIC_Generic();
return isolate->builtins()->KeyedLoadIC_Generic();
}
}
......@@ -564,7 +558,7 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<String> name) {
if (kind() == Code::KEYED_LOAD_IC && name->AsArrayIndex(&index)) {
// Rewrite to the generic keyed load stub.
if (FLAG_use_ic) {
set_target(*generic_stub());
set_target(*KeyedLoadIC::generic_stub(isolate()));
TRACE_IC("LoadIC", name);
TRACE_GENERIC_IC(isolate(), "LoadIC", "name as array index");
}
......@@ -776,10 +770,6 @@ void IC::PatchCache(Handle<String> name, Handle<Code> code) {
if (UpdatePolymorphicIC(name, code)) break;
CopyICToMegamorphicCache(name);
}
if (FLAG_compiled_keyed_generic_loads && (kind() == Code::LOAD_IC)) {
set_target(*generic_stub());
break;
}
set_target(*megamorphic_stub());
// Fall through.
case MEGAMORPHIC:
......@@ -800,30 +790,40 @@ Handle<Code> LoadIC::initialize_stub(Isolate* isolate,
}
Handle<Code> LoadIC::megamorphic_stub() {
if (kind() == Code::LOAD_IC) {
return isolate()->stub_cache()->ComputeLoad(MEGAMORPHIC, extra_ic_state());
} else {
ASSERT_EQ(Code::KEYED_LOAD_IC, kind());
return KeyedLoadIC::generic_stub(isolate());
}
}
Handle<Code> LoadIC::pre_monomorphic_stub(Isolate* isolate,
ExtraICState extra_state) {
return isolate->stub_cache()->ComputeLoad(PREMONOMORPHIC, extra_state);
}
Handle<Code> LoadIC::megamorphic_stub() {
return isolate()->stub_cache()->ComputeLoad(MEGAMORPHIC, extra_ic_state());
Handle<Code> KeyedLoadIC::pre_monomorphic_stub(Isolate* isolate) {
return isolate->builtins()->KeyedLoadIC_PreMonomorphic();
}
Handle<Code> LoadIC::generic_stub() const {
return KeyedLoadGenericElementStub(isolate()).GetCode();
Handle<Code> LoadIC::pre_monomorphic_stub() const {
if (kind() == Code::LOAD_IC) {
return LoadIC::pre_monomorphic_stub(isolate(), extra_ic_state());
} else {
ASSERT_EQ(Code::KEYED_LOAD_IC, kind());
return KeyedLoadIC::pre_monomorphic_stub(isolate());
}
}
Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) {
if (kind() == Code::LOAD_IC) {
LoadFieldStub stub(isolate(), index);
return stub.GetCode();
} else {
KeyedLoadFieldStub stub(isolate(), index);
return stub.GetCode();
}
LoadFieldStub stub(isolate(), index);
return stub.GetCode();
}
......@@ -862,8 +862,7 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
void IC::UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {
// Cache code holding map should be consistent with
// GenerateMonomorphicCacheProbe.
if (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC) return;
Map* map = *TypeToMap(type, isolate());
isolate()->stub_cache()->Set(name, map, code);
}
......@@ -879,7 +878,7 @@ Handle<Code> IC::ComputeHandler(LookupResult* lookup,
*receiver_type(), receiver_is_holder, isolate(), &flag);
Handle<Code> code = isolate()->stub_cache()->FindHandler(
name, stub_holder_map, kind(), flag,
name, stub_holder_map, handler_kind(), flag,
lookup->holder()->HasFastProperties() ? Code::FAST : Code::NORMAL);
// Use the cached value if it exists, and if it is different from the
// handler that just missed.
......@@ -925,13 +924,8 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup, Handle<Object> object,
if (object->IsStringWrapper() &&
String::Equals(isolate()->factory()->length_string(), name)) {
if (kind() == Code::LOAD_IC) {
StringLengthStub string_length_stub(isolate());
return string_length_stub.GetCode();
} else {
KeyedStringLengthStub string_length_stub(isolate());
return string_length_stub.GetCode();
}
StringLengthStub string_length_stub(isolate());
return string_length_stub.GetCode();
}
// Use specialized code for getting prototype of functions.
......@@ -947,7 +941,8 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup, Handle<Object> object,
Handle<HeapType> type = receiver_type();
Handle<JSObject> holder(lookup->holder());
bool receiver_is_holder = object.is_identical_to(holder);
LoadStubCompiler compiler(isolate(), kNoExtraICState, cache_holder, kind());
LoadStubCompiler compiler(isolate(), handler_kind(), kNoExtraICState,
cache_holder);
switch (lookup->type()) {
case FIELD: {
......
......@@ -192,30 +192,23 @@ class IC {
}
void UpdateMonomorphicIC(Handle<Code> handler, Handle<String> name);
bool UpdatePolymorphicIC(Handle<String> name, Handle<Code> code);
virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code);
void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code);
void CopyICToMegamorphicCache(Handle<String> name);
bool IsTransitionOfMonomorphicTarget(Map* source_map, Map* target_map);
void PatchCache(Handle<String> name, Handle<Code> code);
virtual Code::Kind kind() const {
UNREACHABLE();
return Code::STUB;
}
virtual Handle<Code> slow_stub() const {
UNREACHABLE();
return Handle<Code>::null();
Code::Kind kind() const { return kind_; }
Code::Kind handler_kind() const {
if (kind_ == Code::KEYED_LOAD_IC) return Code::LOAD_IC;
ASSERT(kind_ == Code::LOAD_IC || kind_ == Code::STORE_IC ||
kind_ == Code::KEYED_STORE_IC);
return kind_;
}
virtual Handle<Code> megamorphic_stub() {
UNREACHABLE();
return Handle<Code>::null();
}
virtual Handle<Code> generic_stub() const {
UNREACHABLE();
return Handle<Code>::null();
}
bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver,
Handle<String> name);
......@@ -288,6 +281,7 @@ class IC {
Handle<Code> target_;
bool target_set_;
State state_;
Code::Kind kind_;
Handle<HeapType> receiver_type_;
MaybeHandle<Code> maybe_handler_;
......@@ -442,8 +436,6 @@ class LoadIC: public IC {
Handle<String> name);
protected:
virtual Code::Kind kind() const { return Code::LOAD_IC; }
void set_target(Code* code) {
// The contextual mode must be preserved across IC patching.
ASSERT(GetContextualMode(code->extra_ic_state()) ==
......@@ -452,12 +444,16 @@ class LoadIC: public IC {
IC::set_target(code);
}
virtual Handle<Code> slow_stub() const {
return isolate()->builtins()->LoadIC_Slow();
Handle<Code> slow_stub() const {
if (kind() == Code::LOAD_IC) {
return isolate()->builtins()->LoadIC_Slow();
} else {
ASSERT_EQ(Code::KEYED_LOAD_IC, kind());
return isolate()->builtins()->KeyedLoadIC_Slow();
}
}
virtual Handle<Code> megamorphic_stub();
virtual Handle<Code> generic_stub() const;
// Update the inline cache and the global stub cache based on the
// lookup result.
......@@ -472,13 +468,9 @@ class LoadIC: public IC {
CacheHolderFlag cache_holder);
private:
// Stub accessors.
virtual Handle<Code> pre_monomorphic_stub() const;
static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
ExtraICState exstra_state);
virtual Handle<Code> pre_monomorphic_stub() {
return pre_monomorphic_stub(isolate(), extra_ic_state());
}
ExtraICState extra_state);
Handle<Code> SimpleFieldLoad(FieldIndex index);
......@@ -520,28 +512,17 @@ class KeyedLoadIC: public LoadIC {
static const int kSlowCaseBitFieldMask =
(1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
protected:
virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; }
static Handle<Code> generic_stub(Isolate* isolate);
static Handle<Code> pre_monomorphic_stub(Isolate* isolate);
protected:
Handle<Code> LoadElementStub(Handle<JSObject> receiver);
virtual Handle<Code> megamorphic_stub();
virtual Handle<Code> generic_stub() const;
virtual Handle<Code> slow_stub() const {
return isolate()->builtins()->KeyedLoadIC_Slow();
virtual Handle<Code> pre_monomorphic_stub() const {
return pre_monomorphic_stub(isolate());
}
virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {}
private:
// Stub accessors.
static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
return isolate->builtins()->KeyedLoadIC_PreMonomorphic();
}
virtual Handle<Code> pre_monomorphic_stub() {
return pre_monomorphic_stub(isolate());
}
Handle<Code> generic_stub() const { return generic_stub(isolate()); }
Handle<Code> indexed_interceptor_stub() {
return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor();
}
......@@ -618,7 +599,6 @@ class StoreIC: public IC {
JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED);
protected:
virtual Code::Kind kind() const { return Code::STORE_IC; }
virtual Handle<Code> megamorphic_stub();
// Stub accessors.
......@@ -628,7 +608,7 @@ class StoreIC: public IC {
return isolate()->builtins()->StoreIC_Slow();
}
virtual Handle<Code> pre_monomorphic_stub() {
virtual Handle<Code> pre_monomorphic_stub() const {
return pre_monomorphic_stub(isolate(), strict_mode());
}
......@@ -724,11 +704,7 @@ class KeyedStoreIC: public StoreIC {
static void GenerateSloppyArguments(MacroAssembler* masm);
protected:
virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {}
virtual Handle<Code> pre_monomorphic_stub() {
virtual Handle<Code> pre_monomorphic_stub() const {
return pre_monomorphic_stub(isolate(), strict_mode());
}
static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
......
......@@ -143,11 +143,8 @@ Handle<Code> StubCache::ComputeMonomorphicIC(
if (!ic.is_null()) return ic;
}
if (kind == Code::LOAD_IC) {
LoadStubCompiler ic_compiler(isolate(), extra_ic_state, flag);
ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
} else if (kind == Code::KEYED_LOAD_IC) {
KeyedLoadStubCompiler ic_compiler(isolate(), extra_ic_state, flag);
if (kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC) {
LoadStubCompiler ic_compiler(isolate(), kind, extra_ic_state, flag);
ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
} else if (kind == Code::STORE_IC) {
StoreStubCompiler ic_compiler(isolate(), extra_ic_state);
......@@ -197,13 +194,14 @@ Handle<Code> StubCache::ComputeLoadNonexistent(Handle<Name> name,
}
// Compile the stub that is either shared for all names or
// name specific if there are global objects involved.
Code::Kind handler_kind = Code::LOAD_IC;
Handle<Code> handler =
FindHandler(cache_name, stub_holder_map, Code::LOAD_IC, flag, Code::FAST);
FindHandler(cache_name, stub_holder_map, handler_kind, flag, Code::FAST);
if (!handler.is_null()) {
return handler;
}
LoadStubCompiler compiler(isolate_, kNoExtraICState, flag);
LoadStubCompiler compiler(isolate_, handler_kind, kNoExtraICState, flag);
handler = compiler.CompileLoadNonexistent(type, last, cache_name);
Map::UpdateCodeCache(stub_holder_map, cache_name, handler);
return handler;
......@@ -367,7 +365,8 @@ Handle<Code> StubCache::ComputeLoadElementPolymorphic(
CodeHandleList handlers(receiver_maps->length());
KeyedLoadStubCompiler compiler(isolate_);
compiler.CompileElementHandlers(receiver_maps, &handlers);
Handle<Code> code = compiler.CompilePolymorphicIC(
LoadStubCompiler ic_compiler(isolate_, Code::KEYED_LOAD_IC);
Handle<Code> code = ic_compiler.CompilePolymorphicIC(
&types, &handlers, factory()->empty_string(), Code::NORMAL, ELEMENT);
isolate()->counters()->keyed_load_polymorphic_stubs()->Increment();
......@@ -388,7 +387,7 @@ Handle<Code> StubCache::ComputePolymorphicIC(
Code::StubType type = number_of_valid_types == 1 ? handler->type()
: Code::NORMAL;
if (kind == Code::LOAD_IC) {
LoadStubCompiler ic_compiler(isolate_, extra_ic_state);
LoadStubCompiler ic_compiler(isolate_, kind, extra_ic_state);
return ic_compiler.CompilePolymorphicIC(
types, handlers, name, type, PROPERTY);
} else {
......@@ -1144,7 +1143,13 @@ Handle<Code> KeyedLoadStubCompiler::CompileLoadElement(
TailCallBuiltin(masm(), Builtins::kKeyedLoadIC_Miss);
// Return the generated code.
return GetICCode(kind(), Code::NORMAL, factory()->empty_string());
Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, MONOMORPHIC,
extra_state(), Code::NORMAL);
Handle<Code> code = GetCodeWithFlags(flags, factory()->empty_string());
IC::RegisterWeakMapDependency(code);
PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code,
heap()->empty_string()));
return code;
}
......@@ -1189,8 +1194,6 @@ void StubCompiler::TailCallBuiltin(MacroAssembler* masm, Builtins::Name name) {
void BaseLoadStoreStubCompiler::InitializeRegisters() {
if (kind_ == Code::LOAD_IC) {
registers_ = LoadStubCompiler::registers();
} else if (kind_ == Code::KEYED_LOAD_IC) {
registers_ = KeyedLoadStubCompiler::registers();
} else if (kind_ == Code::STORE_IC) {
registers_ = StoreStubCompiler::registers();
} else {
......
......@@ -503,13 +503,13 @@ class BaseLoadStoreStubCompiler: public StubCompiler {
class LoadStubCompiler: public BaseLoadStoreStubCompiler {
public:
LoadStubCompiler(Isolate* isolate,
LoadStubCompiler(Isolate* isolate, Code::Kind kind = Code::LOAD_IC,
ExtraICState extra_ic_state = kNoExtraICState,
CacheHolderFlag cache_holder = kCacheOnReceiver,
Code::Kind kind = Code::LOAD_IC)
CacheHolderFlag cache_holder = kCacheOnReceiver)
: BaseLoadStoreStubCompiler(isolate, kind, extra_ic_state, cache_holder) {
}
virtual ~LoadStubCompiler() { }
static Register* registers();
Handle<Code> CompileLoadField(Handle<HeapType> type,
Handle<JSObject> holder,
......@@ -603,19 +603,18 @@ class LoadStubCompiler: public BaseLoadStoreStubCompiler {
LookupResult* lookup);
private:
static Register* registers();
Register scratch4() { return registers_[5]; }
friend class BaseLoadStoreStubCompiler;
};
class KeyedLoadStubCompiler: public LoadStubCompiler {
class KeyedLoadStubCompiler : public StubCompiler {
public:
KeyedLoadStubCompiler(Isolate* isolate,
ExtraICState extra_ic_state = kNoExtraICState,
CacheHolderFlag cache_holder = kCacheOnReceiver)
: LoadStubCompiler(isolate, extra_ic_state, cache_holder,
Code::KEYED_LOAD_IC) {}
ExtraICState extra_ic_state = kNoExtraICState)
: StubCompiler(isolate, extra_ic_state) {
registers_ = LoadStubCompiler::registers();
}
Handle<Code> CompileLoadElement(Handle<Map> receiver_map);
......@@ -624,9 +623,15 @@ class KeyedLoadStubCompiler: public LoadStubCompiler {
static void GenerateLoadDictionaryElement(MacroAssembler* masm);
Register receiver() { return registers_[0]; }
Register name() { return registers_[1]; }
Register scratch1() { return registers_[2]; }
Register scratch2() { return registers_[3]; }
Register scratch3() { return registers_[4]; }
private:
static Register* registers();
friend class BaseLoadStoreStubCompiler;
Register* registers_;
};
......
......@@ -909,13 +909,8 @@ void LoadStubCompiler::GenerateLoadField(Register reg,
FieldIndex field,
Representation representation) {
if (!reg.is(receiver())) __ movp(receiver(), reg);
if (kind() == Code::LOAD_IC) {
LoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
} else {
KeyedLoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
}
LoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
}
......
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