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 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 function->initialize_elements(); | 1717 function->initialize_elements(); |
1718 function->set_shared(shared); | 1718 function->set_shared(shared); |
1719 function->set_prototype_or_initial_map(prototype); | 1719 function->set_prototype_or_initial_map(prototype); |
1720 function->set_context(undefined_value()); | 1720 function->set_context(undefined_value()); |
1721 function->set_literals(empty_fixed_array(), SKIP_WRITE_BARRIER); | 1721 function->set_literals(empty_fixed_array(), SKIP_WRITE_BARRIER); |
1722 return function; | 1722 return function; |
1723 } | 1723 } |
1724 | 1724 |
1725 | 1725 |
1726 Object* Heap::AllocateFunctionPrototype(JSFunction* function) { | 1726 Object* Heap::AllocateFunctionPrototype(JSFunction* function) { |
1727 // Allocate the prototype. | 1727 // Allocate the prototype. Make sure to use the object function |
1728 Object* prototype = | 1728 // from the function's context, since the function can be from a |
1729 AllocateJSObject(Top::context()->global_context()->object_function()); | 1729 // different context. |
| 1730 JSFunction* object_function = |
| 1731 function->context()->global_context()->object_function(); |
| 1732 Object* prototype = AllocateJSObject(object_function); |
1730 if (prototype->IsFailure()) return prototype; | 1733 if (prototype->IsFailure()) return prototype; |
1731 // When creating the prototype for the function we must set its | 1734 // When creating the prototype for the function we must set its |
1732 // constructor to the function. | 1735 // constructor to the function. |
1733 Object* result = | 1736 Object* result = |
1734 JSObject::cast(prototype)->SetProperty(constructor_symbol(), | 1737 JSObject::cast(prototype)->SetProperty(constructor_symbol(), |
1735 function, | 1738 function, |
1736 DONT_ENUM); | 1739 DONT_ENUM); |
1737 if (result->IsFailure()) return result; | 1740 if (result->IsFailure()) return result; |
1738 return prototype; | 1741 return prototype; |
1739 } | 1742 } |
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3357 #ifdef DEBUG | 3360 #ifdef DEBUG |
3358 bool Heap::GarbageCollectionGreedyCheck() { | 3361 bool Heap::GarbageCollectionGreedyCheck() { |
3359 ASSERT(FLAG_gc_greedy); | 3362 ASSERT(FLAG_gc_greedy); |
3360 if (Bootstrapper::IsActive()) return true; | 3363 if (Bootstrapper::IsActive()) return true; |
3361 if (disallow_allocation_failure()) return true; | 3364 if (disallow_allocation_failure()) return true; |
3362 return CollectGarbage(0, NEW_SPACE); | 3365 return CollectGarbage(0, NEW_SPACE); |
3363 } | 3366 } |
3364 #endif | 3367 #endif |
3365 | 3368 |
3366 } } // namespace v8::internal | 3369 } } // namespace v8::internal |
OLD | NEW |