Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 return function->prototype(); | 460 return function->prototype(); |
| 461 } | 461 } |
| 462 | 462 |
| 463 | 463 |
| 464 MaybeObject* Accessors::FunctionSetPrototype(JSObject* object, | 464 MaybeObject* Accessors::FunctionSetPrototype(JSObject* object, |
| 465 Object* value, | 465 Object* value, |
| 466 void*) { | 466 void*) { |
| 467 bool found_it = false; | 467 bool found_it = false; |
| 468 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); | 468 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); |
| 469 if (!found_it) return Heap::undefined_value(); | 469 if (!found_it) return Heap::undefined_value(); |
| 470 if (!function->should_have_prototype()) return Heap::undefined_value(); | |
|
Mads Ager (chromium)
2011/02/21 14:10:51
Does the return value here have any significance?
| |
| 470 if (function->has_initial_map()) { | 471 if (function->has_initial_map()) { |
| 471 // If the function has allocated the initial map | 472 // If the function has allocated the initial map |
| 472 // replace it with a copy containing the new prototype. | 473 // replace it with a copy containing the new prototype. |
| 473 Object* new_map; | 474 Object* new_map; |
| 474 { MaybeObject* maybe_new_map = | 475 { MaybeObject* maybe_new_map = |
| 475 function->initial_map()->CopyDropTransitions(); | 476 function->initial_map()->CopyDropTransitions(); |
| 476 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; | 477 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; |
| 477 } | 478 } |
| 478 function->set_initial_map(Map::cast(new_map)); | 479 function->set_initial_map(Map::cast(new_map)); |
| 479 } | 480 } |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 884 } | 885 } |
| 885 | 886 |
| 886 | 887 |
| 887 const AccessorDescriptor Accessors::ObjectPrototype = { | 888 const AccessorDescriptor Accessors::ObjectPrototype = { |
| 888 ObjectGetPrototype, | 889 ObjectGetPrototype, |
| 889 ObjectSetPrototype, | 890 ObjectSetPrototype, |
| 890 0 | 891 0 |
| 891 }; | 892 }; |
| 892 | 893 |
| 893 } } // namespace v8::internal | 894 } } // namespace v8::internal |
| OLD | NEW |