OLD | NEW |
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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 <-fp |
452 // | .... | | .... | | 452 // | .... | | .... | |
453 // +-------------------------+ +-------------------------+ | 453 // +-------------------------+ +-------------------------+ |
454 // | JSFunction continuation | | JSFunction continuation | | 454 // | JSFunction continuation | | parameter 1 | |
| 455 // +-------------------------+ +-------------------------+ |
| 456 // | | saved frame (fp) | | .... | |
| 457 // | +=========================+<-fp +-------------------------+ |
| 458 // | | JSFunction context | | parameter n | |
| 459 // v +-------------------------+ +-------------------------| |
| 460 // | COMPILED_STUB marker | | JSFunction continuation | |
455 // +-------------------------+ +-------------------------+<-sp | 461 // +-------------------------+ +-------------------------+<-sp |
456 // | | saved frame (fp) | | 462 // | | a0 = number of parameters |
457 // | +=========================+<-fp | 463 // | ... | a1 = failure handler address |
458 // | | JSFunction context | | 464 // | | fp = saved frame |
459 // v +-------------------------+ | 465 // +-------------------------+<-sp cp = JSFunction context |
460 // | COMPILED_STUB marker | fp = saved frame | |
461 // +-------------------------+ f8 = JSFunction context | |
462 // | | | |
463 // | ... | | |
464 // | | | |
465 // +-------------------------+<-sp | |
466 // | 466 // |
467 // | 467 // |
468 int output_frame_size = 1 * kPointerSize; | |
469 FrameDescription* output_frame = | |
470 new(output_frame_size) FrameDescription(output_frame_size, 0); | |
471 Code* notify_miss = | |
472 isolate_->builtins()->builtin(Builtins::kNotifyICMiss); | |
473 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); | |
474 output_frame->SetContinuation( | |
475 reinterpret_cast<intptr_t>(notify_miss->entry())); | |
476 | 468 |
477 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB); | 469 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB); |
478 int major_key = compiled_code_->major_key(); | 470 int major_key = compiled_code_->major_key(); |
479 CodeStubInterfaceDescriptor* descriptor = | 471 CodeStubInterfaceDescriptor* descriptor = |
480 isolate_->code_stub_interface_descriptor(major_key); | 472 isolate_->code_stub_interface_descriptor(major_key); |
481 Handle<Code> miss_ic(descriptor->deoptimization_handler_); | 473 |
482 output_frame->SetPc(reinterpret_cast<intptr_t>(miss_ic->instruction_start())); | 474 int output_frame_size = |
| 475 (1 + descriptor->register_param_count_) * kPointerSize; |
| 476 FrameDescription* output_frame = |
| 477 new(output_frame_size) FrameDescription(output_frame_size, 0); |
| 478 Code* notify_failure = |
| 479 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure); |
| 480 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); |
| 481 output_frame->SetContinuation( |
| 482 reinterpret_cast<uint32_t>(notify_failure->entry())); |
| 483 |
| 484 Code* code; |
| 485 CEntryStub(1, kSaveFPRegs).FindCodeInCache(&code, isolate_); |
| 486 output_frame->SetPc(reinterpret_cast<intptr_t>(code->instruction_start())); |
483 unsigned input_frame_size = input_->GetFrameSize(); | 487 unsigned input_frame_size = input_->GetFrameSize(); |
484 intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize); | 488 intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize); |
485 output_frame->SetFrameSlot(0, value); | 489 output_frame->SetFrameSlot(0, value); |
486 value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize); | 490 value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize); |
487 output_frame->SetRegister(fp.code(), value); | 491 output_frame->SetRegister(fp.code(), value); |
488 output_frame->SetFp(value); | 492 output_frame->SetFp(value); |
489 value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize); | 493 value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize); |
490 output_frame->SetRegister(cp.code(), value); | 494 output_frame->SetRegister(cp.code(), value); |
491 | 495 |
492 Translation::Opcode opcode = | 496 int parameter_offset = kPointerSize * descriptor->register_param_count_; |
493 static_cast<Translation::Opcode>(iterator->Next()); | 497 for (int i = 0; i < descriptor->register_param_count_; ++i) { |
494 ASSERT(opcode == Translation::REGISTER); | 498 Translation::Opcode opcode = |
495 USE(opcode); | 499 static_cast<Translation::Opcode>(iterator->Next()); |
496 int input_reg = iterator->Next(); | 500 ASSERT(opcode == Translation::REGISTER); |
497 intptr_t input_value = input_->GetRegister(input_reg); | 501 USE(opcode); |
498 output_frame->SetRegister(a1.code(), input_value); | 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 } |
499 | 507 |
500 int32_t next = iterator->Next(); | 508 ApiFunction function(descriptor->deoptimization_handler_); |
501 opcode = static_cast<Translation::Opcode>(next); | 509 ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_); |
502 ASSERT(opcode == Translation::REGISTER); | 510 intptr_t handler = reinterpret_cast<intptr_t>(xref.address()); |
503 input_reg = iterator->Next(); | 511 output_frame->SetRegister(s0.code(), descriptor->register_param_count_); |
504 input_value = input_->GetRegister(input_reg); | 512 output_frame->SetRegister(s1.code(), |
505 output_frame->SetRegister(a0.code(), input_value); | 513 (descriptor->register_param_count_ - 1) * kPointerSize); |
| 514 output_frame->SetRegister(s2.code(), handler); |
506 | 515 |
507 ASSERT(frame_index == 0); | 516 ASSERT(frame_index == 0); |
508 output_[frame_index] = output_frame; | 517 output_[frame_index] = output_frame; |
509 } | 518 } |
510 | 519 |
511 | 520 |
512 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, | 521 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, |
513 int frame_index) { | 522 int frame_index) { |
514 Builtins* builtins = isolate_->builtins(); | 523 Builtins* builtins = isolate_->builtins(); |
515 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); | 524 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 } | 1206 } |
1198 | 1207 |
1199 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), | 1208 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), |
1200 count() * table_entry_size_); | 1209 count() * table_entry_size_); |
1201 } | 1210 } |
1202 | 1211 |
1203 #undef __ | 1212 #undef __ |
1204 | 1213 |
1205 | 1214 |
1206 } } // namespace v8::internal | 1215 } } // namespace v8::internal |
OLD | NEW |