| Index: src/accessors.cc
|
| ===================================================================
|
| --- src/accessors.cc (revision 5559)
|
| +++ src/accessors.cc (working copy)
|
| @@ -441,11 +441,15 @@
|
| bool found_it = false;
|
| JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it);
|
| if (!found_it) return Heap::undefined_value();
|
| + Object* prototype;
|
| + { TryAllocation t = Heap::AllocateFunctionPrototype(function);
|
| + if (!t->ToObject(&prototype)) return t;
|
| + }
|
| if (!function->has_prototype()) {
|
| - Object* prototype = Heap::AllocateFunctionPrototype(function);
|
| - if (prototype->IsFailure()) return prototype;
|
| - Object* result = function->SetPrototype(prototype);
|
| - if (result->IsFailure()) return result;
|
| + Object* result;
|
| + { TryAllocation t = function->SetPrototype(prototype);
|
| + if (!t->ToObject(&result)) return t;
|
| + }
|
| }
|
| return function->prototype();
|
| }
|
| @@ -459,13 +463,17 @@
|
| if (!found_it) return Heap::undefined_value();
|
| if (function->has_initial_map()) {
|
| // If the function has allocated the initial map
|
| + Object* new_map;
|
| + { TryAllocation t = function->initial_map()->CopyDropTransitions();
|
| + if (!t->ToObject(&new_map)) return t;
|
| + }
|
| // replace it with a copy containing the new prototype.
|
| - Object* new_map = function->initial_map()->CopyDropTransitions();
|
| - if (new_map->IsFailure()) return new_map;
|
| function->set_initial_map(Map::cast(new_map));
|
| + Object* prototype;
|
| + { TryAllocation t = function->SetPrototype(value);
|
| + if (!t->ToObject(&prototype)) return t;
|
| }
|
| - Object* prototype = function->SetPrototype(value);
|
| - if (prototype->IsFailure()) return prototype;
|
| + }
|
| ASSERT(function->prototype() == value);
|
| return function;
|
| }
|
|
|