Reviewers: danno,
Message:
PTAL.
Description:
Hydrogenized KeyedLoadGeneric stub: when probing the KeyedLookupCache fails,
call the runtime, don't stub-fail.
Please review this at https://codereview.chromium.org/367343002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+30, -10 lines):
M src/code-stubs-hydrogen.cc
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index
6f86778f997e33a09a223d8b955908b765674937..82714af40534b207c78a7ae7ce4da879d7e7d7c2
100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -1654,9 +1654,13 @@ HValue*
CodeStubGraphBuilder<KeyedLoadGenericElementStub>::BuildCodeStub() {
HValue* base_index = AddUncasted<HMul>(hash, Add<HConstant>(2));
base_index->ClearFlag(HValue::kCanOverflow);
- IfBuilder lookup_if(this);
+ HIfContinuation inline_or_runtime_continuation(
+ graph()->CreateBasicBlock(), graph()->CreateBasicBlock());
+ IfBuilder* lookup_ifs[KeyedLookupCache::kEntriesPerBucket];
for (int probe = 0; probe < KeyedLookupCache::kEntriesPerBucket;
++probe) {
+ IfBuilder* lookup_if = new IfBuilder(this);
+ lookup_ifs[probe] = lookup_if;
int probe_base = probe * KeyedLookupCache::kEntryLength;
HValue* map_index = AddUncasted<HAdd>(base_index,
Add<HConstant>(probe_base + KeyedLookupCache::kMapIndex));
@@ -1669,15 +1673,15 @@ HValue*
CodeStubGraphBuilder<KeyedLoadGenericElementStub>::BuildCodeStub() {
static_cast<HValue*>(NULL),
FAST_ELEMENTS,
NEVER_RETURN_HOLE, 0);
- lookup_if.If<HCompareObjectEqAndBranch>(map_to_check, map);
- lookup_if.And();
+ lookup_if->If<HCompareObjectEqAndBranch>(map_to_check, map);
+ lookup_if->And();
HValue* key_to_check = Add<HLoadKeyed>(cache_keys,
key_index,
static_cast<HValue*>(NULL),
FAST_ELEMENTS,
NEVER_RETURN_HOLE, 0);
- lookup_if.If<HCompareObjectEqAndBranch>(key_to_check, key);
- lookup_if.Then();
+ lookup_if->If<HCompareObjectEqAndBranch>(key_to_check, key);
+ lookup_if->Then();
{
ExternalReference cache_field_offsets_ref =
ExternalReference::keyed_lookup_cache_field_offsets(isolate());
@@ -1692,12 +1696,28 @@ HValue*
CodeStubGraphBuilder<KeyedLoadGenericElementStub>::BuildCodeStub() {
NEVER_RETURN_HOLE, 0);
Push(property_index);
}
- lookup_if.Else();
+ lookup_if->Else();
}
- Add<HDeoptimize>("KeyedLoad fall-back", Deoptimizer::EAGER);
- Push(graph()->GetConstant0());
- lookup_if.End();
- Push(Add<HLoadFieldByIndex>(receiver, Pop()));
+ for (int i = 0; i < KeyedLookupCache::kEntriesPerBucket; ++i) {
+ lookup_ifs[i]->JoinContinuation(&inline_or_runtime_continuation);
+ delete lookup_ifs[i];
+ }
+
+ IfBuilder inline_or_runtime(this, &inline_or_runtime_continuation);
+ inline_or_runtime.Then();
+ {
+ // Found a cached index, load property inline.
+ Push(Add<HLoadFieldByIndex>(receiver, Pop()));
+ }
+ inline_or_runtime.Else();
+ {
+ // KeyedLookupCache miss; call runtime.
+ Add<HPushArguments>(receiver, key);
+ Push(Add<HCallRuntime>(
+ isolate()->factory()->empty_string(),
+ Runtime::FunctionForId(Runtime::kKeyedGetProperty), 2));
+ }
+ inline_or_runtime.End();
}
if_dict_properties.End();
}
--
--
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.