| 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 3734 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3745   reinterpret_cast<ExternalArray*>(result)->set_external_pointer( | 3745   reinterpret_cast<ExternalArray*>(result)->set_external_pointer( | 
| 3746       external_pointer); | 3746       external_pointer); | 
| 3747 | 3747 | 
| 3748   return result; | 3748   return result; | 
| 3749 } | 3749 } | 
| 3750 | 3750 | 
| 3751 | 3751 | 
| 3752 MaybeObject* Heap::CreateCode(const CodeDesc& desc, | 3752 MaybeObject* Heap::CreateCode(const CodeDesc& desc, | 
| 3753                               Code::Flags flags, | 3753                               Code::Flags flags, | 
| 3754                               Handle<Object> self_reference, | 3754                               Handle<Object> self_reference, | 
| 3755                               bool immovable) { | 3755                               bool immovable, | 
|  | 3756                               bool crankshafted) { | 
| 3756   // Allocate ByteArray before the Code object, so that we do not risk | 3757   // Allocate ByteArray before the Code object, so that we do not risk | 
| 3757   // leaving uninitialized Code object (and breaking the heap). | 3758   // leaving uninitialized Code object (and breaking the heap). | 
| 3758   ByteArray* reloc_info; | 3759   ByteArray* reloc_info; | 
| 3759   MaybeObject* maybe_reloc_info = AllocateByteArray(desc.reloc_size, TENURED); | 3760   MaybeObject* maybe_reloc_info = AllocateByteArray(desc.reloc_size, TENURED); | 
| 3760   if (!maybe_reloc_info->To(&reloc_info)) return maybe_reloc_info; | 3761   if (!maybe_reloc_info->To(&reloc_info)) return maybe_reloc_info; | 
| 3761 | 3762 | 
| 3762   // Compute size. | 3763   // Compute size. | 
| 3763   int body_size = RoundUp(desc.instr_size, kObjectAlignment); | 3764   int body_size = RoundUp(desc.instr_size, kObjectAlignment); | 
| 3764   int obj_size = Code::SizeFor(body_size); | 3765   int obj_size = Code::SizeFor(body_size); | 
| 3765   ASSERT(IsAligned(static_cast<intptr_t>(obj_size), kCodeAlignment)); | 3766   ASSERT(IsAligned(static_cast<intptr_t>(obj_size), kCodeAlignment)); | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 3789   result->set_map_no_write_barrier(code_map()); | 3790   result->set_map_no_write_barrier(code_map()); | 
| 3790   Code* code = Code::cast(result); | 3791   Code* code = Code::cast(result); | 
| 3791   ASSERT(!isolate_->code_range()->exists() || | 3792   ASSERT(!isolate_->code_range()->exists() || | 
| 3792       isolate_->code_range()->contains(code->address())); | 3793       isolate_->code_range()->contains(code->address())); | 
| 3793   code->set_instruction_size(desc.instr_size); | 3794   code->set_instruction_size(desc.instr_size); | 
| 3794   code->set_relocation_info(reloc_info); | 3795   code->set_relocation_info(reloc_info); | 
| 3795   code->set_flags(flags); | 3796   code->set_flags(flags); | 
| 3796   if (code->is_call_stub() || code->is_keyed_call_stub()) { | 3797   if (code->is_call_stub() || code->is_keyed_call_stub()) { | 
| 3797     code->set_check_type(RECEIVER_MAP_CHECK); | 3798     code->set_check_type(RECEIVER_MAP_CHECK); | 
| 3798   } | 3799   } | 
|  | 3800   code->set_is_crankshafted(crankshafted); | 
| 3799   code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); | 3801   code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); | 
| 3800   code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value()); | 3802   code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value()); | 
| 3801   code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); | 3803   code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); | 
| 3802   code->set_gc_metadata(Smi::FromInt(0)); | 3804   code->set_gc_metadata(Smi::FromInt(0)); | 
| 3803   code->set_ic_age(global_ic_age_); | 3805   code->set_ic_age(global_ic_age_); | 
| 3804   code->set_prologue_offset(kPrologueOffsetNotSet); | 3806   code->set_prologue_offset(kPrologueOffsetNotSet); | 
| 3805   if (code->kind() == Code::OPTIMIZED_FUNCTION) { | 3807   if (code->kind() == Code::OPTIMIZED_FUNCTION) { | 
| 3806     code->set_marked_for_deoptimization(false); | 3808     code->set_marked_for_deoptimization(false); | 
| 3807   } | 3809   } | 
| 3808   // Allow self references to created code object by patching the handle to | 3810   // Allow self references to created code object by patching the handle to | 
| (...skipping 4042 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7851       static_cast<int>(object_sizes_last_time_[index])); | 7853       static_cast<int>(object_sizes_last_time_[index])); | 
| 7852   FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7854   FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 
| 7853 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7855 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 
| 7854 | 7856 | 
| 7855   OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7857   OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 
| 7856   OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7858   OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 
| 7857   ClearObjectStats(); | 7859   ClearObjectStats(); | 
| 7858 } | 7860 } | 
| 7859 | 7861 | 
| 7860 } }  // namespace v8::internal | 7862 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|