OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3778 maybe_result = lo_space_->AllocateRaw(obj_size, EXECUTABLE); | 3778 maybe_result = lo_space_->AllocateRaw(obj_size, EXECUTABLE); |
3779 if (!maybe_result->To<HeapObject>(&result)) return maybe_result; | 3779 if (!maybe_result->To<HeapObject>(&result)) return maybe_result; |
3780 } | 3780 } |
3781 | 3781 |
3782 // Initialize the object | 3782 // Initialize the object |
3783 result->set_map_no_write_barrier(code_map()); | 3783 result->set_map_no_write_barrier(code_map()); |
3784 Code* code = Code::cast(result); | 3784 Code* code = Code::cast(result); |
3785 ASSERT(!isolate_->code_range()->exists() || | 3785 ASSERT(!isolate_->code_range()->exists() || |
3786 isolate_->code_range()->contains(code->address())); | 3786 isolate_->code_range()->contains(code->address())); |
3787 code->set_instruction_size(desc.instr_size); | 3787 code->set_instruction_size(desc.instr_size); |
3788 // TODO(mstarzinger): Remove once we found the bug. | |
3789 CHECK(reloc_info->IsByteArray()); | |
3790 code->set_relocation_info(reloc_info); | 3788 code->set_relocation_info(reloc_info); |
3791 // TODO(mstarzinger): Remove once we found the bug. | |
3792 CHECK(code->relocation_info()->IsByteArray()); | |
3793 code->set_flags(flags); | 3789 code->set_flags(flags); |
3794 if (code->is_call_stub() || code->is_keyed_call_stub()) { | 3790 if (code->is_call_stub() || code->is_keyed_call_stub()) { |
3795 code->set_check_type(RECEIVER_MAP_CHECK); | 3791 code->set_check_type(RECEIVER_MAP_CHECK); |
3796 } | 3792 } |
3797 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); | 3793 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); |
3798 code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value()); | 3794 code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value()); |
3799 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); | 3795 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); |
3800 code->set_gc_metadata(Smi::FromInt(0)); | 3796 code->set_gc_metadata(Smi::FromInt(0)); |
3801 code->set_ic_age(global_ic_age_); | 3797 code->set_ic_age(global_ic_age_); |
3802 code->set_prologue_offset(kPrologueOffsetNotSet); | 3798 code->set_prologue_offset(kPrologueOffsetNotSet); |
3803 if (code->kind() == Code::OPTIMIZED_FUNCTION) { | 3799 if (code->kind() == Code::OPTIMIZED_FUNCTION) { |
3804 code->set_marked_for_deoptimization(false); | 3800 code->set_marked_for_deoptimization(false); |
3805 } | 3801 } |
3806 // Allow self references to created code object by patching the handle to | 3802 // Allow self references to created code object by patching the handle to |
3807 // point to the newly allocated Code object. | 3803 // point to the newly allocated Code object. |
3808 CHECK(code->IsCode()); | |
3809 CHECK(code->relocation_info()->IsByteArray()); | |
3810 if (!self_reference.is_null()) { | 3804 if (!self_reference.is_null()) { |
3811 *(self_reference.location()) = code; | 3805 *(self_reference.location()) = code; |
3812 } | 3806 } |
3813 // Migrate generated code. | 3807 // Migrate generated code. |
3814 // The generated code can contain Object** values (typically from handles) | 3808 // The generated code can contain Object** values (typically from handles) |
3815 // that are dereferenced during the copy to point directly to the actual heap | 3809 // that are dereferenced during the copy to point directly to the actual heap |
3816 // objects. These pointers can include references to the code object itself, | 3810 // objects. These pointers can include references to the code object itself, |
3817 // through the self_reference parameter. | 3811 // through the self_reference parameter. |
3818 CHECK(code->IsCode()); | |
3819 CHECK(code->relocation_info()->IsByteArray()); | |
3820 code->CopyFrom(desc); | 3812 code->CopyFrom(desc); |
3821 | 3813 |
3822 #ifdef VERIFY_HEAP | 3814 #ifdef VERIFY_HEAP |
3823 if (FLAG_verify_heap) { | 3815 if (FLAG_verify_heap) { |
3824 code->Verify(); | 3816 code->Verify(); |
3825 } | 3817 } |
3826 #endif | 3818 #endif |
3827 return code; | 3819 return code; |
3828 } | 3820 } |
3829 | 3821 |
(...skipping 3990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7820 static_cast<int>(object_sizes_last_time_[index])); | 7812 static_cast<int>(object_sizes_last_time_[index])); |
7821 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7813 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7822 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7814 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7823 | 7815 |
7824 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7816 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7825 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7817 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7826 ClearObjectStats(); | 7818 ClearObjectStats(); |
7827 } | 7819 } |
7828 | 7820 |
7829 } } // namespace v8::internal | 7821 } } // namespace v8::internal |
OLD | NEW |