Reviewers: Toon Verwaest,
Message:
PTAL.
I've left some occurrences of the string "generic", e.g. in the macro name
TRACE_GENERIC_IC, because I didn't think clarity would be improved by
changing
those to "megamorphic" (as they describe the high-level concept of using a
very
generic handler, rather than The One Generic Stub), but I'm happy to rename
things if you'd like.
Description:
Replace generic KeyedStore stub with megamorphic version
This is a follow-up to https://codereview.chromium.org/859943003.
Please review this at https://codereview.chromium.org/847963004/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+10, -53 lines):
M src/builtins.h
M src/builtins.cc
M src/ic/ic.h
M src/ic/ic.cc
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index
782d4141c933ec411a7db8d36692731aef8047fe..6fea01411723603a35d3eda984168ace1d2cea70
100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -1295,16 +1295,6 @@ static void
Generate_KeyedStoreIC_Megamorphic_Strict(MacroAssembler* masm) {
}
-static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) {
- KeyedStoreIC::GenerateGeneric(masm, SLOPPY);
-}
-
-
-static void Generate_KeyedStoreIC_Generic_Strict(MacroAssembler* masm) {
- KeyedStoreIC::GenerateGeneric(masm, STRICT);
-}
-
-
static void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) {
KeyedStoreIC::GenerateMiss(masm);
}
Index: src/builtins.h
diff --git a/src/builtins.h b/src/builtins.h
index
b776f733aed0ea175eb9135563f25377a081b730..a872c7f4222bec23b3f0e41b33519ce49ef3a8ea
100644
--- a/src/builtins.h
+++ b/src/builtins.h
@@ -95,7 +95,6 @@ enum BuiltinExtraArguments {
V(KeyedStoreIC_PreMonomorphic, KEYED_STORE_IC,
PREMONOMORPHIC, \
kNoExtraICState) \
V(KeyedStoreIC_Megamorphic, KEYED_STORE_IC, MEGAMORPHIC,
kNoExtraICState) \
- V(KeyedStoreIC_Generic, KEYED_STORE_IC, GENERIC,
kNoExtraICState) \
\
V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC,
UNINITIALIZED, \
StoreIC::kStrictModeState) \
@@ -103,8 +102,6 @@ enum BuiltinExtraArguments {
StoreIC::kStrictModeState) \
V(KeyedStoreIC_Megamorphic_Strict, KEYED_STORE_IC,
MEGAMORPHIC, \
StoreIC::kStrictModeState) \
- V(KeyedStoreIC_Generic_Strict, KEYED_STORE_IC,
GENERIC, \
-
StoreIC::kStrictModeState) \
V(KeyedStoreIC_SloppyArguments, KEYED_STORE_IC,
MONOMORPHIC, \
kNoExtraICState) \
\
Index: src/ic/ic.cc
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index
0324d992144247bba016d8eb01e4cb0faeb85a81..88520029132b9daedba28ae1e5650b3994a1f078
100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -1619,21 +1619,6 @@ Handle<Code> StoreIC::megamorphic_stub() {
}
-Handle<Code> StoreIC::generic_stub() const {
- if (kind() == Code::STORE_IC) {
- return PropertyICCompiler::ComputeStore(isolate(), GENERIC,
- extra_ic_state());
- } else {
- DCHECK(kind() == Code::KEYED_STORE_IC);
- if (strict_mode() == STRICT) {
- return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
- } else {
- return isolate()->builtins()->KeyedStoreIC_Generic();
- }
- }
-}
-
-
Handle<Code> StoreIC::slow_stub() const {
if (kind() == Code::STORE_IC) {
return isolate()->builtins()->StoreIC_Slow();
@@ -1801,7 +1786,7 @@ Handle<Code>
KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver,
// and so the stubs can't be harvested for the object needed for a map
check.
if (target()->type() != Code::NORMAL) {
TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "non-NORMAL target type");
- return generic_stub();
+ return megamorphic_stub();
}
Handle<Map> receiver_map(receiver->map(), isolate());
@@ -1865,11 +1850,7 @@ Handle<Code>
KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver,
if (!map_added) {
// If the miss wasn't due to an unseen map, a polymorphic stub
- // won't help. In theory we should use the generic stub, but in
- // practice there are a number of hard-to-avoid reasons why this
- // can happen occasionally, and where the additional logic in the
- // megamorphic stub is beneficial because it can handle most cases
- // without calling into the runtime.
+ // won't help, use the megamorphic stub which can handle everything.
TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "same map added twice");
return megamorphic_stub();
}
@@ -1881,20 +1862,20 @@ Handle<Code>
KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver,
}
// Make sure all polymorphic handlers have the same store mode,
otherwise the
- // generic stub must be used.
+ // megamorphic stub must be used.
store_mode = GetNonTransitioningStoreMode(store_mode);
if (old_store_mode != STANDARD_STORE) {
if (store_mode == STANDARD_STORE) {
store_mode = old_store_mode;
} else if (store_mode != old_store_mode) {
TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "store mode mismatch");
- return generic_stub();
+ return megamorphic_stub();
}
}
// If the store mode isn't the standard mode, make sure that all
polymorphic
// receivers are either external arrays, or all "normal" arrays.
Otherwise,
- // use the generic stub.
+ // use the megamorphic stub.
if (store_mode != STANDARD_STORE) {
int external_arrays = 0;
for (int i = 0; i < target_receiver_maps.length(); ++i) {
@@ -1907,7 +1888,7 @@ Handle<Code>
KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver,
external_arrays != target_receiver_maps.length()) {
TRACE_GENERIC_IC(isolate(), "KeyedStoreIC",
"unsupported combination of external and normal
arrays");
- return generic_stub();
+ return megamorphic_stub();
}
}
@@ -2052,7 +2033,7 @@ MaybeHandle<Object>
KeyedStoreIC::Store(Handle<Object> object,
key = TryConvertKey(key, isolate());
Handle<Object> store_handle;
- Handle<Code> stub = generic_stub();
+ Handle<Code> stub = megamorphic_stub();
if (key->IsInternalizedString()) {
ASSIGN_RETURN_ON_EXCEPTION(
@@ -2126,8 +2107,8 @@ MaybeHandle<Object>
KeyedStoreIC::Store(Handle<Object> object,
}
DCHECK(!is_target_set());
- Code* generic = *generic_stub();
- if (*stub == generic) {
+ Code* megamorphic = *megamorphic_stub();
+ if (*stub == megamorphic) {
TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "set generic");
}
if (*stub == *slow_stub()) {
@@ -2141,13 +2122,6 @@ MaybeHandle<Object>
KeyedStoreIC::Store(Handle<Object> object,
}
-// static
-void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
- StrictMode strict_mode) {
- PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
-}
-
-
bool CallIC::DoCustomHandler(Handle<Object> receiver, Handle<Object>
function,
const CallICState& callic_state) {
DCHECK(FLAG_use_ic && function->IsJSFunction());
Index: src/ic/ic.h
diff --git a/src/ic/ic.h b/src/ic/ic.h
index
d41c37452f70eb9293297712fba161f7e23170f9..80d25060413ee6525a69ee04ae1628c7505ed44c
100644
--- a/src/ic/ic.h
+++ b/src/ic/ic.h
@@ -561,11 +561,8 @@ class StoreIC : public IC {
JSReceiver::StoreFromKeyed store_mode);
protected:
- Handle<Code> megamorphic_stub() OVERRIDE;
-
// Stub accessors.
- Handle<Code> generic_stub() const;
-
+ Handle<Code> megamorphic_stub() OVERRIDE;
Handle<Code> slow_stub() const;
virtual Handle<Code> pre_monomorphic_stub() const {
@@ -640,7 +637,6 @@ class KeyedStoreIC : public StoreIC {
static void GenerateMiss(MacroAssembler* masm);
static void GenerateSlow(MacroAssembler* masm);
static void GenerateMegamorphic(MacroAssembler* masm, StrictMode
strict_mode);
- static void GenerateGeneric(MacroAssembler* masm, StrictMode
strict_mode);
static void GenerateSloppyArguments(MacroAssembler* masm);
protected:
--
--
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.