| 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 // | 440 // |
| 441 // Accessors::FunctionPrototype | 441 // Accessors::FunctionPrototype |
| 442 // | 442 // |
| 443 | 443 |
| 444 | 444 |
| 445 MaybeObject* Accessors::FunctionGetPrototype(Object* object, void*) { | 445 MaybeObject* Accessors::FunctionGetPrototype(Object* object, void*) { |
| 446 bool found_it = false; | 446 bool found_it = false; |
| 447 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); | 447 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); |
| 448 if (!found_it) return Heap::undefined_value(); | 448 if (!found_it) return Heap::undefined_value(); |
| 449 if (!function->has_prototype()) { | 449 if (!function->has_prototype()) { |
| 450 if (!function->should_have_prototype()) return Heap::undefined_value(); |
| 450 Object* prototype; | 451 Object* prototype; |
| 451 { MaybeObject* maybe_prototype = Heap::AllocateFunctionPrototype(function); | 452 { MaybeObject* maybe_prototype = Heap::AllocateFunctionPrototype(function); |
| 452 if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype; | 453 if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype; |
| 453 } | 454 } |
| 454 Object* result; | 455 Object* result; |
| 455 { MaybeObject* maybe_result = function->SetPrototype(prototype); | 456 { MaybeObject* maybe_result = function->SetPrototype(prototype); |
| 456 if (!maybe_result->ToObject(&result)) return maybe_result; | 457 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 457 } | 458 } |
| 458 } | 459 } |
| 459 return function->prototype(); | 460 return function->prototype(); |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 } | 884 } |
| 884 | 885 |
| 885 | 886 |
| 886 const AccessorDescriptor Accessors::ObjectPrototype = { | 887 const AccessorDescriptor Accessors::ObjectPrototype = { |
| 887 ObjectGetPrototype, | 888 ObjectGetPrototype, |
| 888 ObjectSetPrototype, | 889 ObjectSetPrototype, |
| 889 0 | 890 0 |
| 890 }; | 891 }; |
| 891 | 892 |
| 892 } } // namespace v8::internal | 893 } } // namespace v8::internal |
| OLD | NEW |