OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
10 | 10 |
(...skipping 480 matching lines...) Loading... |
491 Translation* translation, size_t frame_state_offset, | 491 Translation* translation, size_t frame_state_offset, |
492 OutputFrameStateCombine state_combine) { | 492 OutputFrameStateCombine state_combine) { |
493 // Outer-most state must be added to translation first. | 493 // Outer-most state must be added to translation first. |
494 if (descriptor->outer_state() != nullptr) { | 494 if (descriptor->outer_state() != nullptr) { |
495 BuildTranslationForFrameStateDescriptor(descriptor->outer_state(), instr, | 495 BuildTranslationForFrameStateDescriptor(descriptor->outer_state(), instr, |
496 translation, frame_state_offset, | 496 translation, frame_state_offset, |
497 OutputFrameStateCombine::Ignore()); | 497 OutputFrameStateCombine::Ignore()); |
498 } | 498 } |
499 frame_state_offset += descriptor->outer_state()->GetTotalSize(); | 499 frame_state_offset += descriptor->outer_state()->GetTotalSize(); |
500 | 500 |
501 // TODO(bmeurer): Fix this special case here. | 501 Handle<SharedFunctionInfo> shared_info; |
502 int id = Translation::kSelfLiteralId; | 502 if (!descriptor->shared_info().ToHandle(&shared_info)) { |
503 if (descriptor->outer_state() != nullptr) { | 503 shared_info = info()->shared_info(); |
504 InstructionOperandConverter converter(this, instr); | |
505 Handle<HeapObject> function(converter.InputHeapObject(frame_state_offset)); | |
506 id = DefineDeoptimizationLiteral(function); | |
507 } | 504 } |
| 505 int shared_info_id = DefineDeoptimizationLiteral(shared_info); |
508 | 506 |
509 switch (descriptor->type()) { | 507 switch (descriptor->type()) { |
510 case JS_FRAME: | 508 case JS_FRAME: |
511 translation->BeginJSFrame( | 509 translation->BeginJSFrame( |
512 descriptor->bailout_id(), id, | 510 descriptor->bailout_id(), shared_info_id, |
513 static_cast<unsigned int>(descriptor->GetSize(state_combine) - | 511 static_cast<unsigned int>(descriptor->GetSize(state_combine) - |
514 (1 + descriptor->parameters_count()))); | 512 (1 + descriptor->parameters_count()))); |
515 break; | 513 break; |
516 case ARGUMENTS_ADAPTOR: | 514 case ARGUMENTS_ADAPTOR: |
517 translation->BeginArgumentsAdaptorFrame( | 515 translation->BeginArgumentsAdaptorFrame( |
518 id, static_cast<unsigned int>(descriptor->parameters_count())); | 516 shared_info_id, |
| 517 static_cast<unsigned int>(descriptor->parameters_count())); |
519 break; | 518 break; |
520 } | 519 } |
521 | 520 |
522 for (size_t i = 1; i < descriptor->GetSize(state_combine); i++) { | 521 for (size_t i = 0; i < descriptor->GetSize(state_combine); i++) { |
523 OperandAndType op = TypedOperandForFrameState( | 522 OperandAndType op = TypedOperandForFrameState( |
524 descriptor, instr, frame_state_offset, i, state_combine); | 523 descriptor, instr, frame_state_offset, i, state_combine); |
525 AddTranslationForOperand(translation, instr, op.operand, op.type); | 524 AddTranslationForOperand(translation, instr, op.operand, op.type); |
526 } | 525 } |
527 } | 526 } |
528 | 527 |
529 | 528 |
530 int CodeGenerator::BuildTranslation(Instruction* instr, int pc_offset, | 529 int CodeGenerator::BuildTranslation(Instruction* instr, int pc_offset, |
531 size_t frame_state_offset, | 530 size_t frame_state_offset, |
532 OutputFrameStateCombine state_combine) { | 531 OutputFrameStateCombine state_combine) { |
(...skipping 69 matching lines...) Loading... |
602 DCHECK((type & (kRepFloat64 | kRepTagged)) != 0); | 601 DCHECK((type & (kRepFloat64 | kRepTagged)) != 0); |
603 constant_object = isolate()->factory()->NewNumber(constant.ToFloat64()); | 602 constant_object = isolate()->factory()->NewNumber(constant.ToFloat64()); |
604 break; | 603 break; |
605 case Constant::kHeapObject: | 604 case Constant::kHeapObject: |
606 DCHECK((type & kRepMask) == kRepTagged); | 605 DCHECK((type & kRepMask) == kRepTagged); |
607 constant_object = constant.ToHeapObject(); | 606 constant_object = constant.ToHeapObject(); |
608 break; | 607 break; |
609 default: | 608 default: |
610 CHECK(false); | 609 CHECK(false); |
611 } | 610 } |
612 int literal_id = DefineDeoptimizationLiteral(constant_object); | 611 if (constant_object.is_identical_to(info()->closure())) { |
613 translation->StoreLiteral(literal_id); | 612 translation->StoreJSFrameFunction(); |
| 613 } else { |
| 614 int literal_id = DefineDeoptimizationLiteral(constant_object); |
| 615 translation->StoreLiteral(literal_id); |
| 616 } |
614 } else { | 617 } else { |
615 CHECK(false); | 618 CHECK(false); |
616 } | 619 } |
617 } | 620 } |
618 | 621 |
619 | 622 |
620 void CodeGenerator::MarkLazyDeoptSite() { | 623 void CodeGenerator::MarkLazyDeoptSite() { |
621 last_lazy_deopt_pc_ = masm()->pc_offset(); | 624 last_lazy_deopt_pc_ = masm()->pc_offset(); |
622 } | 625 } |
623 | 626 |
(...skipping 57 matching lines...) Loading... |
681 : masm_(gen->masm()), next_(gen->ools_) { | 684 : masm_(gen->masm()), next_(gen->ools_) { |
682 gen->ools_ = this; | 685 gen->ools_ = this; |
683 } | 686 } |
684 | 687 |
685 | 688 |
686 OutOfLineCode::~OutOfLineCode() {} | 689 OutOfLineCode::~OutOfLineCode() {} |
687 | 690 |
688 } // namespace compiler | 691 } // namespace compiler |
689 } // namespace internal | 692 } // namespace internal |
690 } // namespace v8 | 693 } // namespace v8 |
OLD | NEW |