Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/heap.cc

Issue 23480031: Enable preaging of code objects when --optimize-for-size. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: bool -> enum Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4122 matching lines...) Expand 10 before | Expand all | Expand 10 after
4133 external_pointer); 4133 external_pointer);
4134 4134
4135 return result; 4135 return result;
4136 } 4136 }
4137 4137
4138 4138
4139 MaybeObject* Heap::CreateCode(const CodeDesc& desc, 4139 MaybeObject* Heap::CreateCode(const CodeDesc& desc,
4140 Code::Flags flags, 4140 Code::Flags flags,
4141 Handle<Object> self_reference, 4141 Handle<Object> self_reference,
4142 bool immovable, 4142 bool immovable,
4143 bool crankshafted) { 4143 bool crankshafted,
4144 int prologue_offset) {
4144 // Allocate ByteArray before the Code object, so that we do not risk 4145 // Allocate ByteArray before the Code object, so that we do not risk
4145 // leaving uninitialized Code object (and breaking the heap). 4146 // leaving uninitialized Code object (and breaking the heap).
4146 ByteArray* reloc_info; 4147 ByteArray* reloc_info;
4147 MaybeObject* maybe_reloc_info = AllocateByteArray(desc.reloc_size, TENURED); 4148 MaybeObject* maybe_reloc_info = AllocateByteArray(desc.reloc_size, TENURED);
4148 if (!maybe_reloc_info->To(&reloc_info)) return maybe_reloc_info; 4149 if (!maybe_reloc_info->To(&reloc_info)) return maybe_reloc_info;
4149 4150
4150 // Compute size. 4151 // Compute size.
4151 int body_size = RoundUp(desc.instr_size, kObjectAlignment); 4152 int body_size = RoundUp(desc.instr_size, kObjectAlignment);
4152 int obj_size = Code::SizeFor(body_size); 4153 int obj_size = Code::SizeFor(body_size);
4153 ASSERT(IsAligned(static_cast<intptr_t>(obj_size), kCodeAlignment)); 4154 ASSERT(IsAligned(static_cast<intptr_t>(obj_size), kCodeAlignment));
(...skipping 29 matching lines...) Expand all
4183 code->set_flags(flags); 4184 code->set_flags(flags);
4184 if (code->is_call_stub() || code->is_keyed_call_stub()) { 4185 if (code->is_call_stub() || code->is_keyed_call_stub()) {
4185 code->set_check_type(RECEIVER_MAP_CHECK); 4186 code->set_check_type(RECEIVER_MAP_CHECK);
4186 } 4187 }
4187 code->set_is_crankshafted(crankshafted); 4188 code->set_is_crankshafted(crankshafted);
4188 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); 4189 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER);
4189 code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value()); 4190 code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value());
4190 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); 4191 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER);
4191 code->set_gc_metadata(Smi::FromInt(0)); 4192 code->set_gc_metadata(Smi::FromInt(0));
4192 code->set_ic_age(global_ic_age_); 4193 code->set_ic_age(global_ic_age_);
4193 code->set_prologue_offset(kPrologueOffsetNotSet); 4194 code->set_prologue_offset(prologue_offset);
4194 if (code->kind() == Code::OPTIMIZED_FUNCTION) { 4195 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
4195 code->set_marked_for_deoptimization(false); 4196 code->set_marked_for_deoptimization(false);
4196 } 4197 }
4198
4199 #ifdef ENABLE_DEBUGGER_SUPPORT
4200 if (code->kind() == Code::FUNCTION) {
4201 code->set_has_debug_break_slots(
4202 isolate_->debugger()->IsDebuggerActive());
4203 }
4204 #endif
4205
4197 // Allow self references to created code object by patching the handle to 4206 // Allow self references to created code object by patching the handle to
4198 // point to the newly allocated Code object. 4207 // point to the newly allocated Code object.
4199 if (!self_reference.is_null()) { 4208 if (!self_reference.is_null()) {
4200 *(self_reference.location()) = code; 4209 *(self_reference.location()) = code;
4201 } 4210 }
4202 // Migrate generated code. 4211 // Migrate generated code.
4203 // The generated code can contain Object** values (typically from handles) 4212 // The generated code can contain Object** values (typically from handles)
4204 // that are dereferenced during the copy to point directly to the actual heap 4213 // that are dereferenced during the copy to point directly to the actual heap
4205 // objects. These pointers can include references to the code object itself, 4214 // objects. These pointers can include references to the code object itself,
4206 // through the self_reference parameter. 4215 // through the self_reference parameter.
(...skipping 3731 matching lines...) Expand 10 before | Expand all | Expand 10 after
7938 if (FLAG_concurrent_recompilation) { 7947 if (FLAG_concurrent_recompilation) {
7939 heap_->relocation_mutex_->Lock(); 7948 heap_->relocation_mutex_->Lock();
7940 #ifdef DEBUG 7949 #ifdef DEBUG
7941 heap_->relocation_mutex_locked_by_optimizer_thread_ = 7950 heap_->relocation_mutex_locked_by_optimizer_thread_ =
7942 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 7951 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
7943 #endif // DEBUG 7952 #endif // DEBUG
7944 } 7953 }
7945 } 7954 }
7946 7955
7947 } } // namespace v8::internal 7956 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698