OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/bytecode-generator.h" | 5 #include "src/interpreter/bytecode-generator.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/interpreter/bytecode-register-allocator.h" | 10 #include "src/interpreter/bytecode-register-allocator.h" |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 loop_builder->LoopHeader(&resume_points_in_loop); | 678 loop_builder->LoopHeader(&resume_points_in_loop); |
679 | 679 |
680 if (stmt->yield_count() > 0) { | 680 if (stmt->yield_count() > 0) { |
681 // If we are not resuming, fall through to loop body. | 681 // If we are not resuming, fall through to loop body. |
682 // If we are resuming, perform state dispatch. | 682 // If we are resuming, perform state dispatch. |
683 BytecodeLabel not_resuming; | 683 BytecodeLabel not_resuming; |
684 builder() | 684 builder() |
685 ->LoadLiteral(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)) | 685 ->LoadLiteral(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)) |
686 .CompareOperation(Token::Value::EQ, generator_state_) | 686 .CompareOperation(Token::Value::EQ, generator_state_) |
687 .JumpIfTrue(¬_resuming); | 687 .JumpIfTrue(¬_resuming); |
688 BuildIndexedJump(generator_state_, first_yield, | 688 BuildIndexedJump(generator_state_, first_yield, stmt->yield_count(), |
689 stmt->yield_count(), generator_resume_points_); | 689 generator_resume_points_); |
690 builder()->Bind(¬_resuming); | 690 builder()->Bind(¬_resuming); |
691 } | 691 } |
692 } | 692 } |
693 | 693 |
694 void BytecodeGenerator::VisitGeneratorPrologue() { | 694 void BytecodeGenerator::VisitGeneratorPrologue() { |
695 // The generator resume trampoline abuses the new.target register both to | 695 // The generator resume trampoline abuses the new.target register both to |
696 // indicate that this is a resume call and to pass in the generator object. | 696 // indicate that this is a resume call and to pass in the generator object. |
697 // In ordinary calls, new.target is always undefined because generator | 697 // In ordinary calls, new.target is always undefined because generator |
698 // functions are non-constructable. | 698 // functions are non-constructable. |
699 Register generator_object = Register::new_target(); | 699 Register generator_object = Register::new_target(); |
(...skipping 2570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3270 } | 3270 } |
3271 | 3271 |
3272 | 3272 |
3273 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3273 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3274 return info()->shared_info()->feedback_vector()->GetIndex(slot); | 3274 return info()->shared_info()->feedback_vector()->GetIndex(slot); |
3275 } | 3275 } |
3276 | 3276 |
3277 } // namespace interpreter | 3277 } // namespace interpreter |
3278 } // namespace internal | 3278 } // namespace internal |
3279 } // namespace v8 | 3279 } // namespace v8 |
OLD | NEW |