Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index f61485040a9a5e5f27dd07da33958cf9f1112f24..73c9173c70257941c094dfa6de1872033f454452 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -6352,7 +6352,11 @@ void HGraphBuilder::VisitProperty(Property* expr) { |
Handle<AccessorPair> accessors; |
Handle<JSObject> holder; |
if (LookupAccessorPair(map, name, &accessors, &holder)) { |
- instr = BuildCallGetter(Pop(), map, accessors, holder); |
+ AddCheckConstantFunction(holder, Top(), map, true); |
+ Handle<JSFunction> getter(JSFunction::cast(accessors->getter())); |
+ if (FLAG_inline_accessors && TryInlineGetter(getter, expr)) return; |
+ AddInstruction(new(zone()) HPushArgument(Pop())); |
+ instr = new(zone()) HCallConstantFunction(getter, 1); |
} else { |
instr = BuildLoadNamedMonomorphic(Pop(), name, expr, map); |
} |
@@ -6920,6 +6924,18 @@ bool HGraphBuilder::TryInlineConstruct(CallNew* expr, HValue* receiver) { |
} |
+bool HGraphBuilder::TryInlineGetter(Handle<JSFunction> getter, |
+ Property* prop) { |
+ return TryInline(CALL_AS_METHOD, |
+ getter, |
+ 0, |
+ NULL, |
+ prop->id(), |
+ prop->ReturnId(), |
+ NORMAL_RETURN); |
+} |
+ |
+ |
bool HGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra) { |
if (!expr->target()->shared()->HasBuiltinFunctionId()) return false; |
BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); |