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

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

Issue 6596032: X64: Add a jumptable to for deoptimization checks on X64.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 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/x64/lithium-codegen-x64.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 #define __ masm()-> 71 #define __ masm()->
72 72
73 bool LCodeGen::GenerateCode() { 73 bool LCodeGen::GenerateCode() {
74 HPhase phase("Code generation", chunk()); 74 HPhase phase("Code generation", chunk());
75 ASSERT(is_unused()); 75 ASSERT(is_unused());
76 status_ = GENERATING; 76 status_ = GENERATING;
77 return GeneratePrologue() && 77 return GeneratePrologue() &&
78 GenerateBody() && 78 GenerateBody() &&
79 GenerateDeferredCode() && 79 GenerateDeferredCode() &&
80 GenerateJumpTable() &&
80 GenerateSafepointTable(); 81 GenerateSafepointTable();
81 } 82 }
82 83
83 84
84 void LCodeGen::FinishCode(Handle<Code> code) { 85 void LCodeGen::FinishCode(Handle<Code> code) {
85 ASSERT(is_done()); 86 ASSERT(is_done());
86 code->set_stack_slots(StackSlotCount()); 87 code->set_stack_slots(StackSlotCount());
87 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); 88 code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
88 PopulateDeoptimizationData(code); 89 PopulateDeoptimizationData(code);
89 } 90 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 234
234 LInstruction* LCodeGen::GetNextInstruction() { 235 LInstruction* LCodeGen::GetNextInstruction() {
235 if (current_instruction_ < instructions_->length() - 1) { 236 if (current_instruction_ < instructions_->length() - 1) {
236 return instructions_->at(current_instruction_ + 1); 237 return instructions_->at(current_instruction_ + 1);
237 } else { 238 } else {
238 return NULL; 239 return NULL;
239 } 240 }
240 } 241 }
241 242
242 243
244 bool LCodeGen::GenerateJumpTable() {
245 for (int i = 0; i < jump_table_.length(); i++) {
246 JumpTableEntry* info = jump_table_[i];
247 __ bind(&(info->label_));
248 __ Jump(info->address_, RelocInfo::RUNTIME_ENTRY);
249 }
250 return !is_aborted();
251 }
252
253
243 bool LCodeGen::GenerateDeferredCode() { 254 bool LCodeGen::GenerateDeferredCode() {
244 ASSERT(is_generating()); 255 ASSERT(is_generating());
245 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { 256 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) {
246 LDeferredCode* code = deferred_[i]; 257 LDeferredCode* code = deferred_[i];
247 __ bind(code->entry()); 258 __ bind(code->entry());
248 code->Generate(); 259 code->Generate();
249 __ jmp(code->exit()); 260 __ jmp(code->exit());
250 } 261 }
251 262
252 // Deferred code is the last part of the instruction sequence. Mark 263 // Deferred code is the last part of the instruction sequence. Mark
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 Address entry = Deoptimizer::GetDeoptimizationEntry(id, Deoptimizer::EAGER); 516 Address entry = Deoptimizer::GetDeoptimizationEntry(id, Deoptimizer::EAGER);
506 ASSERT(entry != NULL); 517 ASSERT(entry != NULL);
507 if (entry == NULL) { 518 if (entry == NULL) {
508 Abort("bailout was not prepared"); 519 Abort("bailout was not prepared");
509 return; 520 return;
510 } 521 }
511 522
512 if (cc == no_condition) { 523 if (cc == no_condition) {
513 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); 524 __ Jump(entry, RelocInfo::RUNTIME_ENTRY);
514 } else { 525 } else {
515 NearLabel done; 526 JumpTableEntry* jump_info = NULL;
516 __ j(NegateCondition(cc), &done); 527 // We often have several deopts to the same entry, reuse the last
517 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); 528 // jump entry if this is the case.
518 __ bind(&done); 529 if (jump_table_.length() > 0 &&
530 jump_table_[jump_table_.length() - 1]->address_ == entry) {
531 jump_info = jump_table_[jump_table_.length() - 1];
532 } else {
533 jump_info = new JumpTableEntry(entry);
534 jump_table_.Add(jump_info);
535 }
536 __ j(cc, &jump_info->label_);
519 } 537 }
520 } 538 }
521 539
522 540
523 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { 541 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
524 int length = deoptimizations_.length(); 542 int length = deoptimizations_.length();
525 if (length == 0) return; 543 if (length == 0) return;
526 ASSERT(FLAG_deopt); 544 ASSERT(FLAG_deopt);
527 Handle<DeoptimizationInputData> data = 545 Handle<DeoptimizationInputData> data =
528 Factory::NewDeoptimizationInputData(length, TENURED); 546 Factory::NewDeoptimizationInputData(length, TENURED);
(...skipping 3023 matching lines...) Expand 10 before | Expand all | Expand 10 after
3552 RegisterEnvironmentForDeoptimization(environment); 3570 RegisterEnvironmentForDeoptimization(environment);
3553 ASSERT(osr_pc_offset_ == -1); 3571 ASSERT(osr_pc_offset_ == -1);
3554 osr_pc_offset_ = masm()->pc_offset(); 3572 osr_pc_offset_ = masm()->pc_offset();
3555 } 3573 }
3556 3574
3557 #undef __ 3575 #undef __
3558 3576
3559 } } // namespace v8::internal 3577 } } // namespace v8::internal
3560 3578
3561 #endif // V8_TARGET_ARCH_X64 3579 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698