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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1742253002: [crankshaft] Inline hasOwnProperty when used in fast-case for-in (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months 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
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index 8ff3f3ba3f05afbcade28d2f073afa6c5503fc77..1c28deaeac31b4349dba4fe109994165f1c3d290 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -8752,6 +8752,22 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
}
// Try to inline calls like Math.* as operations in the calling function.
switch (id) {
+ case kObjectHasOwnProperty: {
+ if (argument_count != 2) return false;
+ HValue* key = Top();
+ if (!key->IsLoadKeyed()) return false;
+ HValue* elements = HLoadKeyed::cast(key)->elements();
+ if (!elements->IsPhi() || elements->OperandCount() != 1) return false;
+ if (!elements->OperandAt(0)->IsForInCacheArray()) return false;
+ HForInCacheArray* cache = HForInCacheArray::cast(elements->OperandAt(0));
+ HValue* receiver = environment()->ExpressionStackAt(1);
+ if (!receiver->IsPhi() || receiver->OperandCount() != 1) return false;
+ if (cache->enumerable() != receiver->OperandAt(0)) return false;
Benedikt Meurer 2016/03/01 05:00:10 This subgraph pattern matching in Crankshaft is su
+ Drop(3); // key, receiver, function
+ Add<HCheckMapValue>(receiver, cache->map());
+ ast_context()->ReturnValue(graph()->GetConstantTrue());
+ return true;
+ }
case kStringCharCodeAt:
case kStringCharAt:
if (argument_count == 2) {
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698