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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); | 451 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); |
452 intptr_t pc_value = reinterpret_cast<intptr_t>( | 452 intptr_t pc_value = reinterpret_cast<intptr_t>( |
453 adaptor_trampoline->instruction_start() + | 453 adaptor_trampoline->instruction_start() + |
454 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); | 454 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); |
455 output_frame->SetPc(pc_value); | 455 output_frame->SetPc(pc_value); |
456 } | 456 } |
457 | 457 |
458 | 458 |
459 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, | 459 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, |
460 int frame_index) { | 460 int frame_index) { |
| 461 Builtins* builtins = isolate_->builtins(); |
| 462 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); |
461 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); | 463 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); |
462 unsigned height = iterator->Next(); | 464 unsigned height = iterator->Next(); |
463 unsigned height_in_bytes = height * kPointerSize; | 465 unsigned height_in_bytes = height * kPointerSize; |
464 if (FLAG_trace_deopt) { | 466 if (FLAG_trace_deopt) { |
465 PrintF(" translating construct stub => height=%d\n", height_in_bytes); | 467 PrintF(" translating construct stub => height=%d\n", height_in_bytes); |
466 } | 468 } |
467 | 469 |
468 unsigned fixed_frame_size = 6 * kPointerSize; | 470 unsigned fixed_frame_size = 7 * kPointerSize; |
469 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 471 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
470 | 472 |
471 // Allocate and store the output frame description. | 473 // Allocate and store the output frame description. |
472 FrameDescription* output_frame = | 474 FrameDescription* output_frame = |
473 new(output_frame_size) FrameDescription(output_frame_size, function); | 475 new(output_frame_size) FrameDescription(output_frame_size, function); |
474 output_frame->SetFrameType(StackFrame::CONSTRUCT); | 476 output_frame->SetFrameType(StackFrame::CONSTRUCT); |
475 | 477 |
476 // Construct stub can not be topmost or bottommost. | 478 // Construct stub can not be topmost or bottommost. |
477 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); | 479 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); |
478 ASSERT(output_[frame_index] == NULL); | 480 ASSERT(output_[frame_index] == NULL); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 // A marker value is used in place of the function. | 529 // A marker value is used in place of the function. |
528 output_offset -= kPointerSize; | 530 output_offset -= kPointerSize; |
529 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); | 531 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); |
530 output_frame->SetFrameSlot(output_offset, value); | 532 output_frame->SetFrameSlot(output_offset, value); |
531 if (FLAG_trace_deopt) { | 533 if (FLAG_trace_deopt) { |
532 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 534 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
533 V8PRIxPTR " ; function (construct sentinel)\n", | 535 V8PRIxPTR " ; function (construct sentinel)\n", |
534 top_address + output_offset, output_offset, value); | 536 top_address + output_offset, output_offset, value); |
535 } | 537 } |
536 | 538 |
| 539 // The output frame reflects a JSConstructStubGeneric frame. |
| 540 output_offset -= kPointerSize; |
| 541 value = reinterpret_cast<intptr_t>(construct_stub); |
| 542 output_frame->SetFrameSlot(output_offset, value); |
| 543 if (FLAG_trace_deopt) { |
| 544 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
| 545 V8PRIxPTR " ; code object\n", |
| 546 top_address + output_offset, output_offset, value); |
| 547 } |
| 548 |
537 // Number of incoming arguments. | 549 // Number of incoming arguments. |
538 output_offset -= kPointerSize; | 550 output_offset -= kPointerSize; |
539 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); | 551 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); |
540 output_frame->SetFrameSlot(output_offset, value); | 552 output_frame->SetFrameSlot(output_offset, value); |
541 if (FLAG_trace_deopt) { | 553 if (FLAG_trace_deopt) { |
542 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 554 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
543 V8PRIxPTR " ; argc (%d)\n", | 555 V8PRIxPTR " ; argc (%d)\n", |
544 top_address + output_offset, output_offset, value, height - 1); | 556 top_address + output_offset, output_offset, value, height - 1); |
545 } | 557 } |
546 | 558 |
547 // The newly allocated object was passed as receiver in the artificial | 559 // The newly allocated object was passed as receiver in the artificial |
548 // constructor stub environment created by HEnvironment::CopyForInlining(). | 560 // constructor stub environment created by HEnvironment::CopyForInlining(). |
549 output_offset -= kPointerSize; | 561 output_offset -= kPointerSize; |
550 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); | 562 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); |
551 output_frame->SetFrameSlot(output_offset, value); | 563 output_frame->SetFrameSlot(output_offset, value); |
552 if (FLAG_trace_deopt) { | 564 if (FLAG_trace_deopt) { |
553 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 565 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
554 V8PRIxPTR " ; allocated receiver\n", | 566 V8PRIxPTR " ; allocated receiver\n", |
555 top_address + output_offset, output_offset, value); | 567 top_address + output_offset, output_offset, value); |
556 } | 568 } |
557 | 569 |
558 ASSERT(0 == output_offset); | 570 ASSERT(0 == output_offset); |
559 | 571 |
560 Builtins* builtins = isolate_->builtins(); | |
561 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); | |
562 intptr_t pc = reinterpret_cast<intptr_t>( | 572 intptr_t pc = reinterpret_cast<intptr_t>( |
563 construct_stub->instruction_start() + | 573 construct_stub->instruction_start() + |
564 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); | 574 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); |
565 output_frame->SetPc(pc); | 575 output_frame->SetPc(pc); |
566 } | 576 } |
567 | 577 |
568 | 578 |
569 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, | 579 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, |
570 int frame_index) { | 580 int frame_index) { |
571 int node_id = iterator->Next(); | 581 int node_id = iterator->Next(); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 } | 975 } |
966 __ bind(&done); | 976 __ bind(&done); |
967 } | 977 } |
968 | 978 |
969 #undef __ | 979 #undef __ |
970 | 980 |
971 | 981 |
972 } } // namespace v8::internal | 982 } } // namespace v8::internal |
973 | 983 |
974 #endif // V8_TARGET_ARCH_X64 | 984 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |