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

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

Issue 12087053: MIPS: Add StubFailureTrampolineFrames (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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/mips/code-stubs-mips.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 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 uint32_t pc = reinterpret_cast<uint32_t>( 441 uint32_t pc = reinterpret_cast<uint32_t>(
442 adaptor_trampoline->instruction_start() + 442 adaptor_trampoline->instruction_start() +
443 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); 443 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value());
444 output_frame->SetPc(pc); 444 output_frame->SetPc(pc);
445 } 445 }
446 446
447 447
448 void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator, 448 void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
449 int frame_index) { 449 int frame_index) {
450 // 450 //
451 // FROM TO <-fp 451 // FROM TO
452 // | .... | | .... | 452 // | .... | | .... |
453 // +-------------------------+ +-------------------------+ 453 // +-------------------------+ +-------------------------+
454 // | JSFunction continuation | | parameter 1 | 454 // | JSFunction continuation | | JSFunction continuation |
455 // +-------------------------+ +-------------------------+ 455 // +-------------------------+ +-------------------------+
456 // | | saved frame (fp) | | .... | 456 // | | saved frame (fp) | | saved frame (fp) |
457 // | +=========================+<-fp +-------------------------+ 457 // | +=========================+<-fp +=========================+<-fp
458 // | | JSFunction context | | parameter n | 458 // | | JSFunction context | | JSFunction context |
459 // v +-------------------------+ +-------------------------| 459 // v +-------------------------+ +-------------------------|
460 // | COMPILED_STUB marker | | JSFunction continuation | 460 // | COMPILED_STUB marker | | STUB_FAILURE marker |
461 // +-------------------------+ +-------------------------+<-sp 461 // +-------------------------+ +-------------------------+
462 // | | a0 = number of parameters 462 // | | | stub parameter 1 |
463 // | ... | a1 = failure handler address 463 // | ... | +-------------------------+
464 // | | fp = saved frame 464 // | | | ... |
465 // +-------------------------+<-sp cp = JSFunction context 465 // |-------------------------|<-sp +-------------------------+
466 // 466 // | stub parameter n |
467 // parameters in registers +-------------------------+<-sp
468 // and spilled to stack s0-s1 = number of parameters
469 // s2 = failure handler address
470 // fp = saved frame
471 // cp = JSFunction context
467 // 472 //
468 473
469 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB); 474 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB);
470 int major_key = compiled_code_->major_key(); 475 int major_key = compiled_code_->major_key();
471 CodeStubInterfaceDescriptor* descriptor = 476 CodeStubInterfaceDescriptor* descriptor =
472 isolate_->code_stub_interface_descriptor(major_key); 477 isolate_->code_stub_interface_descriptor(major_key);
473 478
474 int output_frame_size = 479 int output_frame_size = StandardFrameConstants::kFixedFrameSize +
475 (1 + descriptor->register_param_count_) * kPointerSize; 480 kPointerSize * descriptor->register_param_count_;
481
476 FrameDescription* output_frame = 482 FrameDescription* output_frame =
477 new(output_frame_size) FrameDescription(output_frame_size, 0); 483 new(output_frame_size) FrameDescription(output_frame_size, 0);
484 ASSERT(frame_index == 0);
485 output_[frame_index] = output_frame;
478 Code* notify_failure = 486 Code* notify_failure =
479 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure); 487 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure);
480 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); 488 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
481 output_frame->SetContinuation( 489 output_frame->SetContinuation(
482 reinterpret_cast<uint32_t>(notify_failure->entry())); 490 reinterpret_cast<intptr_t>(notify_failure->entry()));
483 491
484 Code* code; 492 Code* trampoline = NULL;
485 CEntryStub(1, kSaveFPRegs).FindCodeInCache(&code, isolate_); 493 StubFailureTrampolineStub().FindCodeInCache(&trampoline, isolate_);
486 output_frame->SetPc(reinterpret_cast<intptr_t>(code->instruction_start())); 494 ASSERT(trampoline != NULL);
495 output_frame->SetPc(reinterpret_cast<intptr_t>(
496 trampoline->instruction_start()));
487 unsigned input_frame_size = input_->GetFrameSize(); 497 unsigned input_frame_size = input_->GetFrameSize();
488 intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize); 498
489 output_frame->SetFrameSlot(0, value); 499 // JSFunction continuation
490 value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize); 500 intptr_t input_frame_offset = input_frame_size - kPointerSize;
501 intptr_t output_frame_offset = output_frame_size - kPointerSize;
502 intptr_t value = input_->GetFrameSlot(input_frame_offset);
503 output_frame->SetFrameSlot(output_frame_offset, value);
504
505 // saved frame ptr
506 input_frame_offset -= kPointerSize;
507 value = input_->GetFrameSlot(input_frame_offset);
508 output_frame_offset -= kPointerSize;
509 output_frame->SetFrameSlot(output_frame_offset, value);
510
511 // Restore context
512 input_frame_offset -= kPointerSize;
513 value = input_->GetFrameSlot(input_frame_offset);
514 output_frame->SetRegister(cp.code(), value);
515 output_frame_offset -= kPointerSize;
516 output_frame->SetFrameSlot(output_frame_offset, value);
517
518 // Internal frame markers
519 output_frame_offset -= kPointerSize;
520 value = reinterpret_cast<intptr_t>(
521 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE));
522 output_frame->SetFrameSlot(output_frame_offset, value);
523
524 for (int i = 0; i < descriptor->register_param_count_; ++i) {
525 output_frame_offset -= kPointerSize;
526 DoTranslateCommand(iterator, 0, output_frame_offset);
527 }
528
529 value = input_->GetRegister(fp.code());
491 output_frame->SetRegister(fp.code(), value); 530 output_frame->SetRegister(fp.code(), value);
492 output_frame->SetFp(value); 531 output_frame->SetFp(value);
493 value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize);
494 output_frame->SetRegister(cp.code(), value);
495
496 int parameter_offset = kPointerSize * descriptor->register_param_count_;
497 for (int i = 0; i < descriptor->register_param_count_; ++i) {
498 Translation::Opcode opcode =
499 static_cast<Translation::Opcode>(iterator->Next());
500 ASSERT(opcode == Translation::REGISTER);
501 USE(opcode);
502 int input_reg = iterator->Next();
503 intptr_t reg_value = input_->GetRegister(input_reg);
504 output_frame->SetFrameSlot(parameter_offset, reg_value);
505 parameter_offset -= kPointerSize;
506 }
507 532
508 ApiFunction function(descriptor->deoptimization_handler_); 533 ApiFunction function(descriptor->deoptimization_handler_);
509 ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_); 534 ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_);
510 intptr_t handler = reinterpret_cast<intptr_t>(xref.address()); 535 intptr_t handler = reinterpret_cast<intptr_t>(xref.address());
511 output_frame->SetRegister(s0.code(), descriptor->register_param_count_); 536 output_frame->SetRegister(s0.code(), descriptor->register_param_count_);
512 output_frame->SetRegister(s1.code(), 537 output_frame->SetRegister(s1.code(),
513 (descriptor->register_param_count_ - 1) * kPointerSize); 538 (descriptor->register_param_count_ - 1) * kPointerSize);
514 output_frame->SetRegister(s2.code(), handler); 539 output_frame->SetRegister(s2.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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 } 1228 }
1207 1229
1208 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), 1230 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
1209 count() * table_entry_size_); 1231 count() * table_entry_size_);
1210 } 1232 }
1211 1233
1212 #undef __ 1234 #undef __
1213 1235
1214 1236
1215 } } // namespace v8::internal 1237 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698