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

Side by Side Diff: src/x64/deoptimizer-x64.cc

Issue 12052053: Add StubFailureTrampolineFrames (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove extraneous change Created 7 years, 11 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/code-stubs-x64.cc ('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 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 intptr_t pc_value = reinterpret_cast<intptr_t>( 444 intptr_t pc_value = reinterpret_cast<intptr_t>(
445 adaptor_trampoline->instruction_start() + 445 adaptor_trampoline->instruction_start() +
446 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); 446 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value());
447 output_frame->SetPc(pc_value); 447 output_frame->SetPc(pc_value);
448 } 448 }
449 449
450 450
451 void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator, 451 void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
452 int frame_index) { 452 int frame_index) {
453 // 453 //
454 // FROM TO <-rbp 454 // FROM TO
455 // | .... | | .... | 455 // | .... | | .... |
456 // +-------------------------+ +-------------------------+ 456 // +-------------------------+ +-------------------------+
457 // | JSFunction continuation | | parameter 1 | 457 // | JSFunction continuation | | JSFunction continuation |
458 // +-------------------------+ +-------------------------+ 458 // +-------------------------+ +-------------------------+
459 // | | saved frame (rbp) | | .... | 459 // | | saved frame (rbp) | | saved frame (rbp) |
460 // | +=========================+<-rbp +-------------------------+ 460 // | +=========================+<-rbp +=========================+<-rbp
461 // | | JSFunction context | | parameter n | 461 // | | JSFunction context | | JSFunction context |
462 // v +-------------------------+ +-------------------------| 462 // v +-------------------------+ +-------------------------|
463 // | COMPILED_STUB marker | | JSFunction continuation | 463 // | COMPILED_STUB marker | | STUB_FAILURE marker |
464 // +-------------------------+ +-------------------------+<-rsp 464 // +-------------------------+ +-------------------------+
465 // | | rax = number of parameters 465 // | | | stub parameter 1 |
466 // | ... | rbx = failure handler address 466 // | ... | +-------------------------+
467 // | | rbp = saved frame 467 // | | | ... |
468 // +-------------------------+<-rsp rsi = JSFunction context 468 // |-------------------------|<-rsp +-------------------------+
469 // 469 // | stub parameter n |
470 // parameters in registers +-------------------------+<-rsp
471 // and spilled to stack rax = number of parameters
472 // rbx = failure handler address
473 // rbp = saved frame
474 // rsi = JSFunction context
470 // 475 //
471 476
472 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB); 477 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB);
473 int major_key = compiled_code_->major_key(); 478 int major_key = compiled_code_->major_key();
474 CodeStubInterfaceDescriptor* descriptor = 479 CodeStubInterfaceDescriptor* descriptor =
475 isolate_->code_stub_interface_descriptor(major_key); 480 isolate_->code_stub_interface_descriptor(major_key);
476 481
477 int output_frame_size = 482 int output_frame_size = StandardFrameConstants::kFixedFrameSize +
478 (1 + descriptor->register_param_count_) * kPointerSize; 483 kPointerSize * descriptor->register_param_count_;
484
479 FrameDescription* output_frame = 485 FrameDescription* output_frame =
480 new(output_frame_size) FrameDescription(output_frame_size, 0); 486 new(output_frame_size) FrameDescription(output_frame_size, 0);
487 ASSERT(frame_index == 0);
488 output_[frame_index] = output_frame;
481 Code* notify_failure = 489 Code* notify_failure =
482 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure); 490 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure);
483 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); 491 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
484 output_frame->SetContinuation( 492 output_frame->SetContinuation(
485 reinterpret_cast<intptr_t>(notify_failure->entry())); 493 reinterpret_cast<intptr_t>(notify_failure->entry()));
486 494
487 Code* code; 495 Code* trampoline = NULL;
488 CEntryStub(1, kDontSaveFPRegs).FindCodeInCache(&code, isolate_); 496 StubFailureTrampolineStub().FindCodeInCache(&trampoline, isolate_);
489 output_frame->SetPc(reinterpret_cast<intptr_t>(code->instruction_start())); 497 ASSERT(trampoline != NULL);
498 output_frame->SetPc(reinterpret_cast<intptr_t>(
499 trampoline->instruction_start()));
490 unsigned input_frame_size = input_->GetFrameSize(); 500 unsigned input_frame_size = input_->GetFrameSize();
491 intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize); 501
492 output_frame->SetFrameSlot(0, value); 502 // JSFunction continuation
493 value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize); 503 intptr_t input_frame_offset = input_frame_size - kPointerSize;
504 intptr_t output_frame_offset = output_frame_size - kPointerSize;
505 intptr_t value = input_->GetFrameSlot(input_frame_offset);
506 output_frame->SetFrameSlot(output_frame_offset, value);
507
508 // saved frame ptr
509 input_frame_offset -= kPointerSize;
510 value = input_->GetFrameSlot(input_frame_offset);
511 output_frame_offset -= kPointerSize;
512 output_frame->SetFrameSlot(output_frame_offset, value);
513
514 // Restore context
515 input_frame_offset -= kPointerSize;
516 value = input_->GetFrameSlot(input_frame_offset);
517 output_frame->SetRegister(rsi.code(), value);
518 output_frame_offset -= kPointerSize;
519 output_frame->SetFrameSlot(output_frame_offset, value);
520
521 // Internal frame markers
522 output_frame_offset -= kPointerSize;
523 value = reinterpret_cast<intptr_t>(
524 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE));
525 output_frame->SetFrameSlot(output_frame_offset, value);
526
527 for (int i = 0; i < descriptor->register_param_count_; ++i) {
528 output_frame_offset -= kPointerSize;
529 DoTranslateCommand(iterator, 0, output_frame_offset);
530 }
531
532 value = input_->GetRegister(rbp.code());
494 output_frame->SetRegister(rbp.code(), value); 533 output_frame->SetRegister(rbp.code(), value);
495 output_frame->SetFp(value); 534 output_frame->SetFp(value);
496 value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize);
497 output_frame->SetRegister(rsi.code(), value);
498
499 int parameter_offset = kPointerSize * descriptor->register_param_count_;
500 for (int i = 0; i < descriptor->register_param_count_; ++i) {
501 Translation::Opcode opcode =
502 static_cast<Translation::Opcode>(iterator->Next());
503 ASSERT(opcode == Translation::REGISTER);
504 USE(opcode);
505 int input_reg = iterator->Next();
506 intptr_t reg_value = input_->GetRegister(input_reg);
507 output_frame->SetFrameSlot(parameter_offset, reg_value);
508 parameter_offset -= kPointerSize;
509 }
510 535
511 intptr_t handler = 536 intptr_t handler =
512 reinterpret_cast<intptr_t>(descriptor->deoptimization_handler_); 537 reinterpret_cast<intptr_t>(descriptor->deoptimization_handler_);
513 output_frame->SetRegister(rax.code(), descriptor->register_param_count_); 538 output_frame->SetRegister(rax.code(), descriptor->register_param_count_);
514 output_frame->SetRegister(rbx.code(), handler); 539 output_frame->SetRegister(rbx.code(), handler);
515
516 ASSERT(frame_index == 0);
517 output_[frame_index] = output_frame;
518 } 540 }
519 541
520 542
521 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, 543 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
522 int frame_index) { 544 int frame_index) {
523 Builtins* builtins = isolate_->builtins(); 545 Builtins* builtins = isolate_->builtins();
524 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); 546 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric);
525 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); 547 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next()));
526 unsigned height = iterator->Next(); 548 unsigned height = iterator->Next();
527 unsigned height_in_bytes = height * kPointerSize; 549 unsigned height_in_bytes = height * kPointerSize;
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 } 1194 }
1173 __ bind(&done); 1195 __ bind(&done);
1174 } 1196 }
1175 1197
1176 #undef __ 1198 #undef __
1177 1199
1178 1200
1179 } } // namespace v8::internal 1201 } } // namespace v8::internal
1180 1202
1181 #endif // V8_TARGET_ARCH_X64 1203 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698