Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index f61485040a9a5e5f27dd07da33958cf9f1112f24..697956b56b35925539debeb6430809364340e7be 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -6352,7 +6352,12 @@ 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->id(), expr->ReturnId())) return; |
+ AddInstruction(new(zone()) HPushArgument(Pop())); |
+ instr = new(zone()) HCallConstantFunction(getter, 1); |
} else { |
instr = BuildLoadNamedMonomorphic(Pop(), name, expr, map); |
} |
@@ -6920,6 +6925,19 @@ bool HGraphBuilder::TryInlineConstruct(CallNew* expr, HValue* receiver) { |
} |
+bool HGraphBuilder::TryInlineGetter(Handle<JSFunction> getter, |
Michael Starzinger
2012/07/30 09:38:43
It might be better to pass the "Property* expr" as
Sven Panne
2012/07/30 10:41:55
Done.
|
+ int ast_id, |
+ int return_id) { |
+ return TryInline(CALL_AS_METHOD, |
+ getter, |
+ 0, |
+ NULL, |
+ ast_id, |
+ return_id, |
+ 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(); |