OLD | NEW |
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); | 450 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); |
451 uint32_t pc = reinterpret_cast<uint32_t>( | 451 uint32_t pc = reinterpret_cast<uint32_t>( |
452 adaptor_trampoline->instruction_start() + | 452 adaptor_trampoline->instruction_start() + |
453 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); | 453 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); |
454 output_frame->SetPc(pc); | 454 output_frame->SetPc(pc); |
455 } | 455 } |
456 | 456 |
457 | 457 |
458 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, | 458 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, |
459 int frame_index) { | 459 int frame_index) { |
| 460 Builtins* builtins = isolate_->builtins(); |
| 461 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); |
460 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); | 462 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); |
461 unsigned height = iterator->Next(); | 463 unsigned height = iterator->Next(); |
462 unsigned height_in_bytes = height * kPointerSize; | 464 unsigned height_in_bytes = height * kPointerSize; |
463 if (FLAG_trace_deopt) { | 465 if (FLAG_trace_deopt) { |
464 PrintF(" translating construct stub => height=%d\n", height_in_bytes); | 466 PrintF(" translating construct stub => height=%d\n", height_in_bytes); |
465 } | 467 } |
466 | 468 |
467 unsigned fixed_frame_size = 7 * kPointerSize; | 469 unsigned fixed_frame_size = 8 * kPointerSize; |
468 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 470 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
469 | 471 |
470 // Allocate and store the output frame description. | 472 // Allocate and store the output frame description. |
471 FrameDescription* output_frame = | 473 FrameDescription* output_frame = |
472 new(output_frame_size) FrameDescription(output_frame_size, function); | 474 new(output_frame_size) FrameDescription(output_frame_size, function); |
473 output_frame->SetFrameType(StackFrame::CONSTRUCT); | 475 output_frame->SetFrameType(StackFrame::CONSTRUCT); |
474 | 476 |
475 // Construct stub can not be topmost or bottommost. | 477 // Construct stub can not be topmost or bottommost. |
476 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); | 478 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); |
477 ASSERT(output_[frame_index] == NULL); | 479 ASSERT(output_[frame_index] == NULL); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 524 |
523 // A marker value is used in place of the function. | 525 // A marker value is used in place of the function. |
524 output_offset -= kPointerSize; | 526 output_offset -= kPointerSize; |
525 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); | 527 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); |
526 output_frame->SetFrameSlot(output_offset, value); | 528 output_frame->SetFrameSlot(output_offset, value); |
527 if (FLAG_trace_deopt) { | 529 if (FLAG_trace_deopt) { |
528 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function (construct sentinel)\n", | 530 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function (construct sentinel)\n", |
529 top_address + output_offset, output_offset, value); | 531 top_address + output_offset, output_offset, value); |
530 } | 532 } |
531 | 533 |
| 534 // The output frame reflects a JSConstructStubGeneric frame. |
| 535 output_offset -= kPointerSize; |
| 536 value = reinterpret_cast<intptr_t>(construct_stub); |
| 537 output_frame->SetFrameSlot(output_offset, value); |
| 538 if (FLAG_trace_deopt) { |
| 539 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; code object\n", |
| 540 top_address + output_offset, output_offset, value); |
| 541 } |
| 542 |
532 // Number of incoming arguments. | 543 // Number of incoming arguments. |
533 output_offset -= kPointerSize; | 544 output_offset -= kPointerSize; |
534 value = reinterpret_cast<uint32_t>(Smi::FromInt(height - 1)); | 545 value = reinterpret_cast<uint32_t>(Smi::FromInt(height - 1)); |
535 output_frame->SetFrameSlot(output_offset, value); | 546 output_frame->SetFrameSlot(output_offset, value); |
536 if (FLAG_trace_deopt) { | 547 if (FLAG_trace_deopt) { |
537 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; argc (%d)\n", | 548 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; argc (%d)\n", |
538 top_address + output_offset, output_offset, value, height - 1); | 549 top_address + output_offset, output_offset, value, height - 1); |
539 } | 550 } |
540 | 551 |
541 // Constructor function being invoked by the stub. | 552 // Constructor function being invoked by the stub. |
(...skipping 10 matching lines...) Expand all Loading... |
552 output_offset -= kPointerSize; | 563 output_offset -= kPointerSize; |
553 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); | 564 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); |
554 output_frame->SetFrameSlot(output_offset, value); | 565 output_frame->SetFrameSlot(output_offset, value); |
555 if (FLAG_trace_deopt) { | 566 if (FLAG_trace_deopt) { |
556 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; allocated receiver\n", | 567 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; allocated receiver\n", |
557 top_address + output_offset, output_offset, value); | 568 top_address + output_offset, output_offset, value); |
558 } | 569 } |
559 | 570 |
560 ASSERT(0 == output_offset); | 571 ASSERT(0 == output_offset); |
561 | 572 |
562 Builtins* builtins = isolate_->builtins(); | |
563 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); | |
564 uint32_t pc = reinterpret_cast<uint32_t>( | 573 uint32_t pc = reinterpret_cast<uint32_t>( |
565 construct_stub->instruction_start() + | 574 construct_stub->instruction_start() + |
566 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); | 575 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); |
567 output_frame->SetPc(pc); | 576 output_frame->SetPc(pc); |
568 } | 577 } |
569 | 578 |
570 | 579 |
571 // This code is very similar to ia32 code, but relies on register names (fp, sp) | 580 // This code is very similar to ia32 code, but relies on register names (fp, sp) |
572 // and how the frame is laid out. | 581 // and how the frame is laid out. |
573 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, | 582 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 __ push(ip); | 978 __ push(ip); |
970 __ b(&done); | 979 __ b(&done); |
971 ASSERT(masm()->pc_offset() - start == table_entry_size_); | 980 ASSERT(masm()->pc_offset() - start == table_entry_size_); |
972 } | 981 } |
973 __ bind(&done); | 982 __ bind(&done); |
974 } | 983 } |
975 | 984 |
976 #undef __ | 985 #undef __ |
977 | 986 |
978 } } // namespace v8::internal | 987 } } // namespace v8::internal |
OLD | NEW |