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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 7021007: Optimise the deoptimisation check to improve performance on modern ARM cores.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 7 months 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/arm/lithium-codegen-arm.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 bool LCodeGen::GenerateCode() { 79 bool LCodeGen::GenerateCode() {
80 HPhase phase("Code generation", chunk()); 80 HPhase phase("Code generation", chunk());
81 ASSERT(is_unused()); 81 ASSERT(is_unused());
82 status_ = GENERATING; 82 status_ = GENERATING;
83 CpuFeatures::Scope scope1(VFP3); 83 CpuFeatures::Scope scope1(VFP3);
84 CpuFeatures::Scope scope2(ARMv7); 84 CpuFeatures::Scope scope2(ARMv7);
85 return GeneratePrologue() && 85 return GeneratePrologue() &&
86 GenerateBody() && 86 GenerateBody() &&
87 GenerateDeferredCode() && 87 GenerateDeferredCode() &&
88 GenerateDeoptJumpTable() &&
88 GenerateSafepointTable(); 89 GenerateSafepointTable();
89 } 90 }
90 91
91 92
92 void LCodeGen::FinishCode(Handle<Code> code) { 93 void LCodeGen::FinishCode(Handle<Code> code) {
93 ASSERT(is_done()); 94 ASSERT(is_done());
94 code->set_stack_slots(GetStackSlotCount()); 95 code->set_stack_slots(GetStackSlotCount());
95 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); 96 code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
96 PopulateDeoptimizationData(code); 97 PopulateDeoptimizationData(code);
97 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code); 98 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 243
243 bool LCodeGen::GenerateDeferredCode() { 244 bool LCodeGen::GenerateDeferredCode() {
244 ASSERT(is_generating()); 245 ASSERT(is_generating());
245 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { 246 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) {
246 LDeferredCode* code = deferred_[i]; 247 LDeferredCode* code = deferred_[i];
247 __ bind(code->entry()); 248 __ bind(code->entry());
248 code->Generate(); 249 code->Generate();
249 __ jmp(code->exit()); 250 __ jmp(code->exit());
250 } 251 }
251 252
252 // Force constant pool emission at the end of deferred code to make 253 return !is_aborted();
254 }
255
256
257 bool LCodeGen::GenerateDeoptJumpTable() {
258 // Check that the jump table is accessible from everywhere in the function
259 // code, ie that offsets to the table can be encoded in the 24bit signed
260 // immediate of a branch instruction.
261 // To simplify we consider the code size from the first instruction to the
262 // end of the jump table. We also don't consider the pc load delta.
263 // Each entry in the jump table generates only one instruction.
Søren Thygesen Gjesse 2011/05/17 06:16:44 I have not been able to find anywhere where we ens
Alexandre 2011/05/17 08:10:32 Done: Changed the ASSERT to a test aborting the co
264 ASSERT(is_int24((masm()->pc_offset() / Assembler::kInstrSize) +
265 deopt_jump_table_.length()));
266
267 __ RecordComment("[ Deoptimisation jump table");
268 Label table_start;
269 __ bind(&table_start);
270 for (int i = 0; i < deopt_jump_table_.length(); i++) {
271 __ bind(&deopt_jump_table_[i].label);
272 __ mov(pc, Operand(reinterpret_cast<int32_t>(deopt_jump_table_[i].address),
273 RelocInfo::RUNTIME_ENTRY));
274 }
275 ASSERT(masm()->InstructionsGeneratedSince(&table_start) ==
276 deopt_jump_table_.length());
277 __ RecordComment("]");
278
279 // Force constant pool emission at the end of the jump table to make
253 // sure that no constant pools are emitted after the official end of 280 // sure that no constant pools are emitted after the official end of
254 // the instruction sequence. 281 // the instruction sequence.
255 masm()->CheckConstPool(true, false); 282 masm()->CheckConstPool(true, false);
256 283
257 // Deferred code is the last part of the instruction sequence. Mark 284 // The deoptimization jump table is the last part of the instruction
258 // the generated code as done unless we bailed out. 285 // sequence. Mark the generated code as done unless we bailed out.
259 if (!is_aborted()) status_ = DONE; 286 if (!is_aborted()) status_ = DONE;
260 return !is_aborted(); 287 return !is_aborted();
261 } 288 }
262 289
263 290
264 bool LCodeGen::GenerateSafepointTable() { 291 bool LCodeGen::GenerateSafepointTable() {
265 ASSERT(is_done()); 292 ASSERT(is_done());
266 safepoints_.Emit(masm(), GetStackSlotCount()); 293 safepoints_.Emit(masm(), GetStackSlotCount());
267 return !is_aborted(); 294 return !is_aborted();
268 } 295 }
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 } 615 }
589 616
590 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM. 617 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM.
591 618
592 if (FLAG_deopt_every_n_times == 1 && 619 if (FLAG_deopt_every_n_times == 1 &&
593 info_->shared_info()->opt_count() == id) { 620 info_->shared_info()->opt_count() == id) {
594 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); 621 __ Jump(entry, RelocInfo::RUNTIME_ENTRY);
595 return; 622 return;
596 } 623 }
597 624
625 if (FLAG_trap_on_deopt) __ stop("trap_on_deopt");
Søren Thygesen Gjesse 2011/05/17 06:16:44 Shouldn't this stop still be conditional if cc is
Alexandre 2011/05/17 08:10:32 It should. Done. On 2011/05/17 06:16:44, Søren Gj
Rodolph Perfetta 2011/05/17 10:16:29 Yes it should.
626
598 if (cc == al) { 627 if (cc == al) {
599 if (FLAG_trap_on_deopt) __ stop("trap_on_deopt");
600 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); 628 __ Jump(entry, RelocInfo::RUNTIME_ENTRY);
601 } else { 629 } else {
602 if (FLAG_trap_on_deopt) { 630 // We often have several deopts to the same entry, reuse the last
603 Label done; 631 // jump entry if this is the case.
604 __ b(&done, NegateCondition(cc)); 632 if (deopt_jump_table_.is_empty() ||
605 __ stop("trap_on_deopt"); 633 (deopt_jump_table_.last().address != entry)) {
606 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); 634 deopt_jump_table_.Add(JumpTableEntry(entry));
607 __ bind(&done);
608 } else {
609 __ Jump(entry, RelocInfo::RUNTIME_ENTRY, cc);
610 } 635 }
636 __ b(cc, &deopt_jump_table_.last().label);
611 } 637 }
612 } 638 }
613 639
614 640
615 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { 641 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
616 int length = deoptimizations_.length(); 642 int length = deoptimizations_.length();
617 if (length == 0) return; 643 if (length == 0) return;
618 ASSERT(FLAG_deopt); 644 ASSERT(FLAG_deopt);
619 Handle<DeoptimizationInputData> data = 645 Handle<DeoptimizationInputData> data =
620 factory()->NewDeoptimizationInputData(length, TENURED); 646 factory()->NewDeoptimizationInputData(length, TENURED);
(...skipping 3845 matching lines...) Expand 10 before | Expand all | Expand 10 after
4466 ASSERT(osr_pc_offset_ == -1); 4492 ASSERT(osr_pc_offset_ == -1);
4467 osr_pc_offset_ = masm()->pc_offset(); 4493 osr_pc_offset_ = masm()->pc_offset();
4468 } 4494 }
4469 4495
4470 4496
4471 4497
4472 4498
4473 #undef __ 4499 #undef __
4474 4500
4475 } } // namespace v8::internal 4501 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698