Revision: 22551
Author: [email protected]
Date: Wed Jul 23 11:16:29 2014 UTC
Log: Always use the LoadStubCompiler for Load handlers, also for
keyedload handlers.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/414443002
http://code.google.com/p/v8/source/detail?r=22551
Modified:
/branches/bleeding_edge/src/arm/stub-cache-arm.cc
/branches/bleeding_edge/src/arm64/stub-cache-arm64.cc
/branches/bleeding_edge/src/code-stubs.cc
/branches/bleeding_edge/src/code-stubs.h
/branches/bleeding_edge/src/ia32/stub-cache-ia32.cc
/branches/bleeding_edge/src/ic.cc
/branches/bleeding_edge/src/ic.h
/branches/bleeding_edge/src/stub-cache.cc
/branches/bleeding_edge/src/stub-cache.h
/branches/bleeding_edge/src/x64/stub-cache-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/stub-cache-arm.cc Fri Jul 18 13:50:21
2014 UTC
+++ /branches/bleeding_edge/src/arm/stub-cache-arm.cc Wed Jul 23 11:16:29
2014 UTC
@@ -1004,13 +1004,8 @@
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());
}
=======================================
--- /branches/bleeding_edge/src/arm64/stub-cache-arm64.cc Fri Jul 18
13:50:21 2014 UTC
+++ /branches/bleeding_edge/src/arm64/stub-cache-arm64.cc Wed Jul 23
11:16:29 2014 UTC
@@ -960,13 +960,8 @@
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());
}
=======================================
--- /branches/bleeding_edge/src/code-stubs.cc Mon Jul 21 13:10:14 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.cc Wed Jul 23 11:16:29 2014 UTC
@@ -620,14 +620,6 @@
LoadIC::ReceiverRegister() };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
-
-
-void KeyedLoadFieldStub::InitializeInterfaceDescriptor(
- CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { InterfaceDescriptor::ContextRegister(),
- LoadIC::ReceiverRegister() };
- descriptor->Initialize(ARRAY_SIZE(registers), registers);
-}
void StringLengthStub::InitializeInterfaceDescriptor(
@@ -637,15 +629,6 @@
LoadIC::NameRegister() };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
-
-
-void KeyedStringLengthStub::InitializeInterfaceDescriptor(
- CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { InterfaceDescriptor::ContextRegister(),
- LoadIC::ReceiverRegister(),
- LoadIC::NameRegister() };
- descriptor->Initialize(ARRAY_SIZE(registers), registers);
-}
void KeyedStoreFastElementStub::InitializeInterfaceDescriptor(
=======================================
--- /branches/bleeding_edge/src/code-stubs.h Tue Jul 22 14:27:53 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.h Wed Jul 23 11:16:29 2014 UTC
@@ -15,69 +15,67 @@
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 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 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)
=======================================
--- /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc Fri Jul 18 13:50:21
2014 UTC
+++ /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc Wed Jul 23 11:16:29
2014 UTC
@@ -968,13 +968,8 @@
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());
}
=======================================
--- /branches/bleeding_edge/src/ic.cc Wed Jul 23 11:12:11 2014 UTC
+++ /branches/bleeding_edge/src/ic.cc Wed Jul 23 11:16:29 2014 UTC
@@ -153,6 +153,7 @@
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 @@
}
-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 @@
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 @@
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:
@@ -798,6 +788,16 @@
ExtraICState extra_state) {
return isolate->stub_cache()->ComputeLoad(UNINITIALIZED, extra_state);
}
+
+
+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,
@@ -806,24 +806,24 @@
}
-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 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 @@
*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 @@
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<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: {
=======================================
--- /branches/bleeding_edge/src/ic.h Mon Jul 21 13:10:14 2014 UTC
+++ /branches/bleeding_edge/src/ic.h Wed Jul 23 11:16:29 2014 UTC
@@ -192,30 +192,23 @@
}
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 @@
Handle<Code> target_;
bool target_set_;
State state_;
+ Code::Kind kind_;
Handle<HeapType> receiver_type_;
MaybeHandle<Code> maybe_handler_;
@@ -442,8 +436,6 @@
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 @@
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 @@
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 @@
static const int kSlowCaseBitFieldMask =
(1 << Map::kIsAccessCheckNeeded) | (1 <<
Map::kHasIndexedInterceptor);
+ static Handle<Code> generic_stub(Isolate* isolate);
+ static Handle<Code> pre_monomorphic_stub(Isolate* isolate);
+
protected:
- virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; }
-
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 @@
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 @@
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 @@
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,
=======================================
--- /branches/bleeding_edge/src/stub-cache.cc Tue Jul 22 14:27:53 2014 UTC
+++ /branches/bleeding_edge/src/stub-cache.cc Wed Jul 23 11:16:29 2014 UTC
@@ -143,12 +143,9 @@
if (!ic.is_null()) return ic;
}
- if (kind == Code::LOAD_IC) {
- LoadStubCompiler 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::KEYED_LOAD_IC) {
- KeyedLoadStubCompiler ic_compiler(isolate(), extra_ic_state, flag);
- ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
} else if (kind == Code::STORE_IC) {
StoreStubCompiler ic_compiler(isolate(), extra_ic_state);
ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
@@ -197,13 +194,14 @@
}
// 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 @@
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 @@
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 @@
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 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 {
=======================================
--- /branches/bleeding_edge/src/stub-cache.h Fri Jul 18 13:50:21 2014 UTC
+++ /branches/bleeding_edge/src/stub-cache.h Wed Jul 23 11:16:29 2014 UTC
@@ -503,13 +503,13 @@
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 @@
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);
@@ -623,10 +622,16 @@
CodeHandleList* handlers);
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_;
};
=======================================
--- /branches/bleeding_edge/src/x64/stub-cache-x64.cc Fri Jul 18 13:50:21
2014 UTC
+++ /branches/bleeding_edge/src/x64/stub-cache-x64.cc Wed Jul 23 11:16:29
2014 UTC
@@ -909,13 +909,8 @@
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());
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.