Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Unified Diff: src/ic/ic-compiler.cc

Issue 755513003: Hydrogen: fix keyed loads with string keys (Closed) Base URL: gh:v8/v8@master
Patch Set: better fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ic/ic-compiler.cc
diff --git a/src/ic/ic-compiler.cc b/src/ic/ic-compiler.cc
index 1f6eb4e0794777b90dfc239c930c3519335d3f2b..e95d4eda9e29e5928ab5667c705a69af175592e7 100644
--- a/src/ic/ic-compiler.cc
+++ b/src/ic/ic-compiler.cc
@@ -63,6 +63,11 @@ Handle<Code> PropertyICCompiler::ComputeMonomorphic(
KeyedStoreIC::IcCheckTypeField::update(extra_ic_state, PROPERTY);
DCHECK(STANDARD_STORE ==
KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state));
+ } else if (kind == Code::KEYED_LOAD_IC) {
+ // Update key type
Jakob Kummerow 2014/12/10 15:21:18 nit: punctuation (but see comment on next line).
+ IcCheckType key_type = name->IsString() ? PROPERTY : ELEMENT;
Jakob Kummerow 2014/12/10 15:21:18 This distinction doesn't make sense, we only ever
+
+ extra_ic_state = KeyedLoadIC::ComputeExtraICState(key_type);
}
Handle<Code> ic;
@@ -84,16 +89,19 @@ Handle<Code> PropertyICCompiler::ComputeMonomorphic(
Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphic(
- Handle<Map> receiver_map) {
+ Handle<Map> receiver_map, IcCheckType key_type) {
Isolate* isolate = receiver_map->GetIsolate();
- Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC);
+ ExtraICState extra_state =
+ KeyedLoadIC::ComputeExtraICState(key_type);
+ Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC,
+ extra_state);
Handle<Name> name = isolate->factory()->KeyedLoadMonomorphic_string();
Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate);
if (probe->IsCode()) return Handle<Code>::cast(probe);
Handle<Code> stub = ComputeKeyedLoadMonomorphicHandler(receiver_map);
- PropertyICCompiler compiler(isolate, Code::KEYED_LOAD_IC);
+ PropertyICCompiler compiler(isolate, Code::KEYED_LOAD_IC, extra_state);
Handle<Code> code =
compiler.CompileMonomorphic(HeapType::Class(receiver_map, isolate), stub,
isolate->factory()->empty_string(), ELEMENT);
@@ -253,9 +261,13 @@ Handle<Code> PropertyICCompiler::ComputeCompareNil(Handle<Map> receiver_map,
// TODO(verwaest): Change this method so it takes in a TypeHandleList.
Handle<Code> PropertyICCompiler::ComputeKeyedLoadPolymorphic(
- MapHandleList* receiver_maps) {
+ MapHandleList* receiver_maps, IcCheckType key_type) {
Isolate* isolate = receiver_maps->at(0)->GetIsolate();
- Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, POLYMORPHIC);
+ ExtraICState extra_state =
+ KeyedLoadIC::ComputeExtraICState(key_type);
+ Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC,
+ POLYMORPHIC,
+ extra_state);
Handle<PolymorphicCodeCache> cache =
isolate->factory()->polymorphic_code_cache();
Handle<Object> probe = cache->Lookup(receiver_maps, flags);
@@ -268,10 +280,10 @@ Handle<Code> PropertyICCompiler::ComputeKeyedLoadPolymorphic(
CodeHandleList handlers(receiver_maps->length());
ElementHandlerCompiler compiler(isolate);
compiler.CompileElementHandlers(receiver_maps, &handlers);
- PropertyICCompiler ic_compiler(isolate, Code::KEYED_LOAD_IC);
+ PropertyICCompiler ic_compiler(isolate, Code::KEYED_LOAD_IC, extra_state);
Handle<Code> code = ic_compiler.CompilePolymorphic(
&types, &handlers, isolate->factory()->empty_string(), Code::NORMAL,
- ELEMENT);
+ key_type);
isolate->counters()->keyed_load_polymorphic_stubs()->Increment();

Powered by Google App Engine
This is Rietveld 408576698