Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index c75046ddb0fecf2b3cf66bc47f43b6a7d9deca18..cc98851dcf72c0ac4da803c1ce7aaac9ee1e49aa 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -8625,10 +8625,13 @@ void HOptimizedGraphBuilder::BuildFunctionApply(Call* expr) { |
HValue* function = Pop(); // f |
Drop(1); // apply |
+ Handle<Map> function_map = expr->GetReceiverTypes()->first(); |
+ HValue* checked_function = AddCheckMap(function, function_map); |
+ |
if (function_state()->outer() == NULL) { |
HInstruction* elements = Add<HArgumentsElements>(false); |
HInstruction* length = Add<HArgumentsLength>(elements); |
- HValue* wrapped_receiver = BuildWrapReceiver(receiver, function); |
+ HValue* wrapped_receiver = BuildWrapReceiver(receiver, checked_function); |
HInstruction* result = New<HApplyArguments>(function, |
wrapped_receiver, |
length, |
@@ -8643,7 +8646,7 @@ void HOptimizedGraphBuilder::BuildFunctionApply(Call* expr) { |
const ZoneList<HValue*>* arguments_values = args->arguments_values(); |
int arguments_count = arguments_values->length(); |
Push(function); |
- Push(BuildWrapReceiver(receiver, function)); |
+ Push(BuildWrapReceiver(receiver, checked_function)); |
for (int i = 1; i < arguments_count; i++) { |
Push(arguments_values->at(i)); |
} |
@@ -8667,7 +8670,11 @@ void HOptimizedGraphBuilder::BuildFunctionCall(Call* expr) { |
CHECK_ALIVE(VisitForValue(args->at(0))); |
receiver = Pop(); |
} |
- receiver = BuildWrapReceiver(receiver, function); |
+ |
+ Handle<Map> function_map = expr->GetReceiverTypes()->first(); |
+ HValue* checked_function = AddCheckMap(function, function_map); |
+ |
+ receiver = BuildWrapReceiver(receiver, checked_function); |
Push(function); |
Push(receiver); |