| 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 4081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4092 reinterpret_cast<ExternalArray*>(result)->set_external_pointer( | 4092 reinterpret_cast<ExternalArray*>(result)->set_external_pointer( |
| 4093 external_pointer); | 4093 external_pointer); |
| 4094 | 4094 |
| 4095 return result; | 4095 return result; |
| 4096 } | 4096 } |
| 4097 | 4097 |
| 4098 | 4098 |
| 4099 MaybeObject* Heap::CreateCode(const CodeDesc& desc, | 4099 MaybeObject* Heap::CreateCode(const CodeDesc& desc, |
| 4100 Code::Flags flags, | 4100 Code::Flags flags, |
| 4101 Handle<Object> self_reference, | 4101 Handle<Object> self_reference, |
| 4102 int prologue_offset, |
| 4102 bool immovable, | 4103 bool immovable, |
| 4103 bool crankshafted) { | 4104 bool crankshafted) { |
| 4104 // Allocate ByteArray before the Code object, so that we do not risk | 4105 // Allocate ByteArray before the Code object, so that we do not risk |
| 4105 // leaving uninitialized Code object (and breaking the heap). | 4106 // leaving uninitialized Code object (and breaking the heap). |
| 4106 ByteArray* reloc_info; | 4107 ByteArray* reloc_info; |
| 4107 MaybeObject* maybe_reloc_info = AllocateByteArray(desc.reloc_size, TENURED); | 4108 MaybeObject* maybe_reloc_info = AllocateByteArray(desc.reloc_size, TENURED); |
| 4108 if (!maybe_reloc_info->To(&reloc_info)) return maybe_reloc_info; | 4109 if (!maybe_reloc_info->To(&reloc_info)) return maybe_reloc_info; |
| 4109 | 4110 |
| 4110 // Compute size. | 4111 // Compute size. |
| 4111 int body_size = RoundUp(desc.instr_size, kObjectAlignment); | 4112 int body_size = RoundUp(desc.instr_size, kObjectAlignment); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4143 code->set_flags(flags); | 4144 code->set_flags(flags); |
| 4144 if (code->is_call_stub() || code->is_keyed_call_stub()) { | 4145 if (code->is_call_stub() || code->is_keyed_call_stub()) { |
| 4145 code->set_check_type(RECEIVER_MAP_CHECK); | 4146 code->set_check_type(RECEIVER_MAP_CHECK); |
| 4146 } | 4147 } |
| 4147 code->set_is_crankshafted(crankshafted); | 4148 code->set_is_crankshafted(crankshafted); |
| 4148 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); | 4149 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); |
| 4149 code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value()); | 4150 code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value()); |
| 4150 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); | 4151 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); |
| 4151 code->set_gc_metadata(Smi::FromInt(0)); | 4152 code->set_gc_metadata(Smi::FromInt(0)); |
| 4152 code->set_ic_age(global_ic_age_); | 4153 code->set_ic_age(global_ic_age_); |
| 4153 code->set_prologue_offset(kPrologueOffsetNotSet); | 4154 code->set_prologue_offset(prologue_offset); |
| 4154 if (code->kind() == Code::OPTIMIZED_FUNCTION) { | 4155 if (code->kind() == Code::OPTIMIZED_FUNCTION) { |
| 4155 code->set_marked_for_deoptimization(false); | 4156 code->set_marked_for_deoptimization(false); |
| 4156 } | 4157 } |
| 4158 |
| 4159 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 4160 if (code->kind() == Code::FUNCTION) { |
| 4161 code->set_has_debug_break_slots( |
| 4162 isolate_->debugger()->IsDebuggerActive()); |
| 4163 } |
| 4164 #endif |
| 4165 |
| 4157 // Allow self references to created code object by patching the handle to | 4166 // Allow self references to created code object by patching the handle to |
| 4158 // point to the newly allocated Code object. | 4167 // point to the newly allocated Code object. |
| 4159 if (!self_reference.is_null()) { | 4168 if (!self_reference.is_null()) { |
| 4160 *(self_reference.location()) = code; | 4169 *(self_reference.location()) = code; |
| 4161 } | 4170 } |
| 4162 // Migrate generated code. | 4171 // Migrate generated code. |
| 4163 // The generated code can contain Object** values (typically from handles) | 4172 // The generated code can contain Object** values (typically from handles) |
| 4164 // that are dereferenced during the copy to point directly to the actual heap | 4173 // that are dereferenced during the copy to point directly to the actual heap |
| 4165 // objects. These pointers can include references to the code object itself, | 4174 // objects. These pointers can include references to the code object itself, |
| 4166 // through the self_reference parameter. | 4175 // through the self_reference parameter. |
| (...skipping 3743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7910 if (FLAG_concurrent_recompilation) { | 7919 if (FLAG_concurrent_recompilation) { |
| 7911 heap_->relocation_mutex_->Lock(); | 7920 heap_->relocation_mutex_->Lock(); |
| 7912 #ifdef DEBUG | 7921 #ifdef DEBUG |
| 7913 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 7922 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
| 7914 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 7923 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
| 7915 #endif // DEBUG | 7924 #endif // DEBUG |
| 7916 } | 7925 } |
| 7917 } | 7926 } |
| 7918 | 7927 |
| 7919 } } // namespace v8::internal | 7928 } } // namespace v8::internal |
| OLD | NEW |