Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 3c7bf5064b1683c2c8609a52ff6057d5eadda29d..78a703b5652d8282edc0fc7a77e6e791cc9f2541 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -1287,6 +1287,13 @@ HValue* HGraphBuilder::BuildCheckString(HValue* string) { |
HValue* HGraphBuilder::BuildWrapReceiver(HValue* object, HValue* function) { |
if (object->type().IsJSObject()) return object; |
+ if (function->IsConstant() && |
+ HConstant::cast(function)->handle(isolate())->IsJSFunction()) { |
+ Handle<JSFunction> f = Handle<JSFunction>::cast( |
+ HConstant::cast(function)->handle(isolate())); |
+ SharedFunctionInfo* shared = f->shared(); |
+ if (!shared->is_classic_mode() || shared->native()) return object; |
+ } |
return Add<HWrapReceiver>(object, function); |
} |