Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 0975a0364138bb6708a8326269ed9abeab90f425..aa485df7de2118f2df2ac9e84d3bc5003b174226 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -5552,6 +5552,10 @@ MaybeObject* JSFunction::SetPrototype(Object* value) { |
Object* JSFunction::RemovePrototype() { |
+ if (map() == context()->global_context()->function_without_prototype_map()) { |
+ // Be idempotent. |
+ return this; |
+ } |
ASSERT(map() == context()->global_context()->function_map()); |
set_map(context()->global_context()->function_without_prototype_map()); |
set_prototype_or_initial_map(Heap::the_hole_value()); |