| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index 6e47946d128fc7957383f571e3b80b446e697665..a4e07d289245fc7f261bc3f65edc0af664f4b8e1 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -5536,12 +5536,21 @@ MaybeObject* JSFunction::SetPrototype(Object* value) {
|
|
|
|
|
| Object* JSFunction::RemovePrototype() {
|
| - if (map() == context()->global_context()->function_without_prototype_map()) {
|
| + Context* global_context = context()->global_context();
|
| + Map* no_prototype_map = shared()->strict_mode()
|
| + ? global_context->strict_mode_function_without_prototype_map()
|
| + : global_context->function_without_prototype_map();
|
| +
|
| + if (map() == no_prototype_map) {
|
| // Be idempotent.
|
| return this;
|
| }
|
| - ASSERT(map() == context()->global_context()->function_map());
|
| - set_map(context()->global_context()->function_without_prototype_map());
|
| +
|
| + ASSERT(!shared()->strict_mode() ||
|
| + map() == global_context->strict_mode_function_map());
|
| + ASSERT(shared()->strict_mode() || map() == global_context->function_map());
|
| +
|
| + set_map(no_prototype_map);
|
| set_prototype_or_initial_map(Heap::the_hole_value());
|
| return this;
|
| }
|
|
|