12 #if V8_TARGET_ARCH_IA32
15 #elif V8_TARGET_ARCH_X64
18 #elif V8_TARGET_ARCH_ARM
21 #elif V8_TARGET_ARCH_MIPS
24 #elif V8_TARGET_ARCH_ARM64
27 #elif V8_TARGET_ARCH_MIPS64
30 #elif V8_TARGET_ARCH_X87
34 #error "Unknown architecture."
61 stream->Add(
"(=invalid_reg#%d)", reg_index);
63 const char* register_name =
65 stream->Add(
"(=%s)", register_name);
73 stream->Add(
"(=invalid_double_reg#%d)", reg_index);
75 const char* double_register_name =
77 stream->Add(
"(=%s)", double_register_name);
99 stream->Add(
"[constant:%d]",
index());
102 stream->Add(
"[stack:%d]",
index());
105 stream->Add(
"[double_stack:%d]",
index());
108 int reg_index =
index();
110 stream->Add(
"(=invalid_reg#%d|R)", reg_index);
117 int reg_index =
index();
120 stream->Add(
"(=invalid_double_reg#%d|R)", reg_index);
122 stream->Add(
"[%s|R]",
131 template<LOperand::Kind kOperandKind,
int kNumCachedOperands>
132 LSubKindOperand<kOperandKind, kNumCachedOperands>*
133 LSubKindOperand<kOperandKind, kNumCachedOperands>::cache =
NULL;
136 template<LOperand::Kind kOperandKind,
int kNumCachedOperands>
137 void LSubKindOperand<kOperandKind, kNumCachedOperands>::SetUpCache() {
139 cache =
new LSubKindOperand[kNumCachedOperands];
140 for (
int i = 0;
i < kNumCachedOperands;
i++) {
141 cache[
i].ConvertTo(kOperandKind,
i);
146 template<LOperand::Kind kOperandKind,
int kNumCachedOperands>
147 void LSubKindOperand<kOperandKind, kNumCachedOperands>::TearDownCache() {
154 #define LITHIUM_OPERAND_SETUP(name, type, number) L##name::SetUpCache();
156 #undef LITHIUM_OPERAND_SETUP
161 #define LITHIUM_OPERAND_TEARDOWN(name, type, number) L##name::TearDownCache();
163 #undef LITHIUM_OPERAND_TEARDOWN
167 bool LParallelMove::IsRedundant()
const {
168 for (
int i = 0;
i < move_operands_.length(); ++
i) {
169 if (!move_operands_[
i].IsRedundant())
return false;
175 void LParallelMove::PrintDataTo(StringStream* stream)
const {
177 for (
int i = 0;
i < move_operands_.length(); ++
i) {
178 if (!move_operands_[
i].IsEliminated()) {
179 LOperand* source = move_operands_[
i].source();
180 LOperand* destination = move_operands_[
i].destination();
181 if (!first) stream->Add(
" ");
183 if (source->Equals(destination)) {
184 destination->PrintTo(stream);
186 destination->PrintTo(stream);
188 source->PrintTo(stream);
196 void LEnvironment::PrintTo(StringStream* stream) {
197 stream->Add(
"[id=%d|", ast_id().ToInt());
198 if (deoptimization_index() != Safepoint::kNoDeoptimizationIndex) {
199 stream->Add(
"deopt_id=%d|", deoptimization_index());
201 stream->Add(
"parameters=%d|", parameter_count());
202 stream->Add(
"arguments_stack_height=%d|", arguments_stack_height());
203 for (
int i = 0;
i < values_.length(); ++
i) {
204 if (
i != 0) stream->Add(
";");
205 if (values_[
i] ==
NULL) {
206 stream->Add(
"[hole]");
208 values_[
i]->PrintTo(stream);
215 void LPointerMap::RecordPointer(LOperand* op, Zone* zone) {
217 if (op->IsStackSlot() && op->index() < 0)
return;
218 DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot());
219 pointer_operands_.Add(op, zone);
223 void LPointerMap::RemovePointer(LOperand* op) {
225 if (op->IsStackSlot() && op->index() < 0)
return;
226 DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot());
227 for (
int i = 0;
i < pointer_operands_.length(); ++
i) {
228 if (pointer_operands_[
i]->
Equals(op)) {
229 pointer_operands_.Remove(
i);
236 void LPointerMap::RecordUntagged(LOperand* op, Zone* zone) {
238 if (op->IsStackSlot() && op->index() < 0)
return;
239 DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot());
240 untagged_operands_.Add(op, zone);
244 void LPointerMap::PrintTo(StringStream* stream) {
246 for (
int i = 0;
i < pointer_operands_.length(); ++
i) {
247 if (
i != 0) stream->Add(
";");
248 pointer_operands_[
i]->PrintTo(stream);
268 : spill_slot_count_(0),
271 instructions_(32, info->zone()),
272 pointer_maps_(8, info->zone()),
273 inlined_closures_(1, info->zone()),
279 HBasicBlock* block =
graph_->blocks()->at(block_id);
280 int first_instruction = block->first_instruction_index();
287 while (cur->replacement() !=
NULL) {
288 cur = cur->replacement();
290 return cur->block_id();
295 DCHECK(!label->HasReplacement());
296 return label->label();
301 LPhase phase(
"L_Mark empty blocks",
this);
302 for (
int i = 0;
i <
graph()->blocks()->length(); ++
i) {
303 HBasicBlock* block =
graph()->blocks()->at(
i);
304 int first = block->first_instruction_index();
305 int last = block->last_instruction_index();
309 LLabel* label = LLabel::cast(first_instr);
310 if (last_instr->IsGoto()) {
311 LGoto* goto_instr = LGoto::cast(last_instr);
312 if (label->IsRedundant() &&
313 !label->is_loop_header()) {
314 bool can_eliminate =
true;
315 for (
int i = first + 1;
i < last && can_eliminate; ++
i) {
320 can_eliminate =
false;
323 can_eliminate =
false;
327 label->set_replacement(
GetLabel(goto_instr->block_id()));
336 LInstructionGap* gap =
new (
zone()) LInstructionGap(block);
356 return LConstantOperand::Create(constant->id(),
zone());
375 return (1 +
info()->scope()->num_parameters() - index) *
391 while (!
IsGapAt(index)) index--;
403 return HConstant::cast(
graph_->LookupValue(operand->index()));
408 LConstantOperand* operand)
const {
409 return graph_->LookupValue(operand->index())->representation();
437 graph->DisallowAddingNewValues();
438 int values =
graph->GetMaximumValueID();
444 LAllocator allocator(values,
graph);
445 LChunkBuilder builder(
info,
graph, &allocator);
446 LChunk* chunk = builder.Build();
449 if (!allocator.Allocate(chunk)) {
455 allocator.assigned_double_registers());
464 CodeStartLinePosInfoRecordEvent(
473 generator.CheckEnvironmentUsage();
480 code->set_is_crankshafted(
true);
481 void* jit_handler_data =
484 CodeEndLinePosInfoRecordEvent(*code, jit_handler_data));
488 info()->GetMustNotHaveEagerFrame() &&
500 BitVector::Iterator iterator(doubles);
501 while (!iterator.Done()) {
502 if (
info()->saves_caller_doubles()) {
515 info()->AbortOptimization(reason);
521 info()->RetryOptimization(reason);
527 HEnvironment* hydrogen_env,
int* argument_index_accumulator,
528 ZoneList<HValue*>* objects_to_materialize) {
529 if (hydrogen_env ==
NULL)
return NULL;
531 LEnvironment* outer =
533 objects_to_materialize);
534 BailoutId ast_id = hydrogen_env->ast_id();
535 DCHECK(!ast_id.IsNone() ||
538 int omitted_count = (hydrogen_env->frame_type() ==
JS_FUNCTION)
540 : hydrogen_env->specials_count();
542 int value_count = hydrogen_env->length() - omitted_count;
543 LEnvironment* result =
544 new(zone()) LEnvironment(hydrogen_env->closure(),
545 hydrogen_env->frame_type(),
547 hydrogen_env->parameter_count(),
551 hydrogen_env->entry(),
553 int argument_index = *argument_index_accumulator;
557 for (
int i = 0;
i < hydrogen_env->length(); ++
i) {
558 if (hydrogen_env->is_special_index(
i) &&
563 HValue* value = hydrogen_env->values()->at(
i);
564 CHECK(!value->IsPushArguments());
565 if (value->IsArgumentsObject() || value->IsCapturedObject()) {
566 op = LEnvironment::materialization_marker();
571 value->representation(),
576 for (
int i = 0;
i < hydrogen_env->length(); ++
i) {
577 if (hydrogen_env->is_special_index(
i))
continue;
579 HValue* value = hydrogen_env->values()->at(
i);
580 if (value->IsArgumentsObject() || value->IsCapturedObject()) {
581 AddObjectToMaterialize(value, objects_to_materialize, result);
586 *argument_index_accumulator = argument_index;
614 void LChunkBuilderBase::AddObjectToMaterialize(HValue* value,
615 ZoneList<HValue*>* objects_to_materialize, LEnvironment* result) {
616 int object_index = objects_to_materialize->length();
618 objects_to_materialize->Add(value, zone());
620 int previously_materialized_object = -1;
621 for (
int prev = 0; prev < object_index; ++prev) {
622 if (objects_to_materialize->at(prev) == value) {
623 previously_materialized_object = prev;
629 int length = value->OperandCount();
630 bool is_arguments = value->IsArgumentsObject();
631 if (previously_materialized_object >= 0) {
632 result->AddDuplicateObject(previously_materialized_object);
635 result->AddNewObject(is_arguments ? length - 1 : length, is_arguments);
638 for (
int i = is_arguments ? 1 : 0;
i < length; ++
i) {
640 HValue* arg_value = value->OperandAt(
i);
641 if (arg_value->IsArgumentsObject() || arg_value->IsCapturedObject()) {
643 op = LEnvironment::materialization_marker();
645 DCHECK(!arg_value->IsPushArguments());
648 op = UseAny(arg_value);
651 arg_value->representation(),
655 for (
int i = is_arguments ? 1 : 0;
i < length; ++
i) {
656 HValue* arg_value = value->OperandAt(
i);
657 if (arg_value->IsArgumentsObject() || arg_value->IsCapturedObject()) {
658 AddObjectToMaterialize(arg_value, objects_to_materialize, result);
665 if (ShouldProduceTraceOutput()) {
666 isolate()->GetHTracer()->TraceLithium(
name(),
chunk_);
virtual void AbortedCodeGeneration()
PositionsRecorder * positions_recorder()
static void PrintCode(Handle< Code > code, CompilationInfo *info)
static void MakeCodePrologue(CompilationInfo *info, const char *kind)
static Handle< Code > MakeCodeEpilogue(MacroAssembler *masm, Code::Flags flags, CompilationInfo *info)
void AbortOptimization(BailoutReason reason)
Code::Flags flags() const
int num_parameters() const
void CommitDependencies(Handle< Code > code)
static Handle< T > null()
LConstantOperand * DefineConstantOperand(HConstant *constant)
LChunk(CompilationInfo *info, HGraph *graph)
int LookupDestination(int block_id) const
MapSet stability_dependencies_
void set_allocated_double_registers(BitVector *allocated_registers)
bool IsGapAt(int index) const
BitVector * allocated_double_registers()
ZoneList< LInstruction * > instructions_
HConstant * LookupConstant(LConstantOperand *operand) const
MapSet deprecation_dependencies_
int GetParameterStackSlot(int index) const
CompilationInfo * info() const
void AddGapMove(int index, LOperand *from, LOperand *to)
ZoneList< LPointerMap * > pointer_maps_
std::less< Handle< Map > > MapLess
int ParameterAt(int index)
LLabel * GetLabel(int block_id) const
Label * GetAssemblyLabel(int block_id) const
static LChunk * NewChunk(HGraph *graph)
void CommitDependencies(Handle< Code > code) const
Representation LookupLiteralRepresentation(LConstantOperand *operand) const
int NearestGapPos(int index) const
BitVector * allocated_double_registers_
const ZoneList< LInstruction * > * instructions() const
void AddInstruction(LInstruction *instruction, HBasicBlock *block)
LGap * GetGapAt(int index) const
Isolate * isolate() const
void FinishCode(Handle< Code > code)
bool NeedsEagerFrame() const
static LGap * cast(LInstruction *instr)
LParallelMove * GetOrCreateParallelMove(InnerPosition pos, Zone *zone)
bool HasPointerMap() const
HValue * hydrogen_value() const
virtual bool IsControl() const
LPointerMap * pointer_map() const
virtual bool IsGap() const
void PrintTo(StringStream *stream)
static void TearDownCaches()
static void SetUpCaches()
static LUnallocated * cast(LOperand *op)
int virtual_register() const
static const int kMaxVirtualRegisters
@ MUST_HAVE_DOUBLE_REGISTER
int fixed_slot_index() const
ExtendedPolicy extended_policy() const
BasicPolicy basic_policy() const
int fixed_register_index() const
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
static void AddDependentCode(Handle< Map > map, DependentCode::DependencyGroup group, Handle< Code > code)
static const int kFixedFrameSizeFromFp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define LITHIUM_OPERAND_SETUP(name, type, number)
#define LITHIUM_OPERAND_TEARDOWN(name, type, number)
#define LITHIUM_OPERAND_LIST(V)
#define LOG_CODE_EVENT(isolate, Call)
#define DCHECK(condition)
bool Equals(Node *a, Node *b)
int StackSlotOffset(int index)
Debugger support for the V8 JavaScript engine.
static i::Handle< i::Context > CreateEnvironment(i::Isolate *isolate, v8::ExtensionConfiguration *extensions, v8::Handle< ObjectTemplate > global_template, v8::Handle< Value > maybe_global_proxy)
static const char * AllocationIndexToString(int index)
static const int kMaxNumAllocatableRegisters
static const char * AllocationIndexToString(int index)
static const int kMaxNumAllocatableRegisters