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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 Generator g = FUNCTION_CAST<Generator>(functions[i].generator); | 667 Generator g = FUNCTION_CAST<Generator>(functions[i].generator); |
668 // We pass all arguments to the generator, but it may not use all of | 668 // We pass all arguments to the generator, but it may not use all of |
669 // them. This works because the first arguments are on top of the | 669 // them. This works because the first arguments are on top of the |
670 // stack. | 670 // stack. |
671 g(&masm, functions[i].name); | 671 g(&masm, functions[i].name); |
672 // Move the code into the object heap. | 672 // Move the code into the object heap. |
673 CodeDesc desc; | 673 CodeDesc desc; |
674 masm.GetCode(&desc); | 674 masm.GetCode(&desc); |
675 Code::Flags flags = functions[i].flags; | 675 Code::Flags flags = functions[i].flags; |
676 Object* code = Heap::CreateCode(desc, NULL, flags); | 676 Object* code = Heap::CreateCode(desc, NULL, flags); |
677 if (code->IsRetryAfterGC()) { | 677 if (code->IsFailure()) { |
678 CHECK(Heap::CollectGarbage(Failure::cast(code)->requested(), | 678 if (code->IsRetryAfterGC()) { |
679 Failure::cast(code)->allocation_space())); | 679 CHECK(Heap::CollectGarbage(Failure::cast(code)->requested(), |
680 code = Heap::CreateCode(desc, NULL, flags); | 680 Failure::cast(code)->allocation_space())); |
| 681 code = Heap::CreateCode(desc, NULL, flags); |
| 682 } |
| 683 if (code->IsFailure()) { |
| 684 v8::internal::V8::FatalProcessOutOfMemory("CreateCode"); |
| 685 } |
681 } | 686 } |
682 // Add any unresolved jumps or calls to the fixup list in the | 687 // Add any unresolved jumps or calls to the fixup list in the |
683 // bootstrapper. | 688 // bootstrapper. |
684 Bootstrapper::AddFixup(Code::cast(code), &masm); | 689 Bootstrapper::AddFixup(Code::cast(code), &masm); |
685 // Log the event and add the code to the builtins array. | 690 // Log the event and add the code to the builtins array. |
686 LOG(CodeCreateEvent("Builtin", Code::cast(code), functions[i].s_name)); | 691 LOG(CodeCreateEvent("Builtin", Code::cast(code), functions[i].s_name)); |
687 builtins_[i] = code; | 692 builtins_[i] = code; |
688 #ifdef DEBUG | 693 #ifdef DEBUG |
689 if (FLAG_print_builtin_code) { | 694 if (FLAG_print_builtin_code) { |
690 PrintF("Builtin: %s\n", functions[i].s_name); | 695 PrintF("Builtin: %s\n", functions[i].s_name); |
(...skipping 30 matching lines...) Expand all Loading... |
721 if (entry->contains(pc)) { | 726 if (entry->contains(pc)) { |
722 return names_[i]; | 727 return names_[i]; |
723 } | 728 } |
724 } | 729 } |
725 } | 730 } |
726 return NULL; | 731 return NULL; |
727 } | 732 } |
728 | 733 |
729 | 734 |
730 } } // namespace v8::internal | 735 } } // namespace v8::internal |
OLD | NEW |