Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2135573002: Address compilation warnings for android build. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update comment. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | src/parsing/scanner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 builder()->StackCheck(info()->literal()->start_position()); 626 builder()->StackCheck(info()->literal()->start_position());
627 627
628 // Visit statements in the function body. 628 // Visit statements in the function body.
629 VisitStatements(info()->literal()->body()); 629 VisitStatements(info()->literal()->body());
630 } 630 }
631 631
632 void BytecodeGenerator::BuildIndexedJump(Register index, size_t start_index, 632 void BytecodeGenerator::BuildIndexedJump(Register index, size_t start_index,
633 size_t size, 633 size_t size,
634 ZoneVector<BytecodeLabel>& targets) { 634 ZoneVector<BytecodeLabel>& targets) {
635 // TODO(neis): Optimize this by using a proper jump table. 635 // TODO(neis): Optimize this by using a proper jump table.
636 DCHECK_LE(start_index + size, targets.size());
636 for (size_t i = start_index; i < start_index + size; i++) { 637 for (size_t i = start_index; i < start_index + size; i++) {
637 DCHECK(0 <= i && i < targets.size());
638 builder() 638 builder()
639 ->LoadLiteral(Smi::FromInt(static_cast<int>(i))) 639 ->LoadLiteral(Smi::FromInt(static_cast<int>(i)))
640 .CompareOperation(Token::Value::EQ_STRICT, index) 640 .CompareOperation(Token::Value::EQ_STRICT, index)
641 .JumpIfTrue(&(targets[i])); 641 .JumpIfTrue(&(targets[i]));
642 } 642 }
643
644 BuildAbort(BailoutReason::kInvalidJumpTableIndex); 643 BuildAbort(BailoutReason::kInvalidJumpTableIndex);
645 } 644 }
646 645
647 void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt, 646 void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt,
648 LoopBuilder* loop_builder) { 647 LoopBuilder* loop_builder) {
649 // Recall that stmt->yield_count() is always zero inside ordinary 648 // Recall that stmt->yield_count() is always zero inside ordinary
650 // (i.e. non-generator) functions. 649 // (i.e. non-generator) functions.
651 650
652 // Collect all labels for generator resume points within the loop (if any) so 651 // Collect all labels for generator resume points within the loop (if any) so
653 // that they can be bound to the loop header below. Also create fresh labels 652 // that they can be bound to the loop header below. Also create fresh labels
654 // for these resume points, to be used inside the loop. 653 // for these resume points, to be used inside the loop.
655 ZoneVector<BytecodeLabel> resume_points_in_loop(zone()); 654 ZoneVector<BytecodeLabel> resume_points_in_loop(zone());
656 size_t first_yield = stmt->first_yield_id(); 655 size_t first_yield = stmt->first_yield_id();
656 DCHECK_LE(first_yield + stmt->yield_count(), generator_resume_points_.size());
657 for (size_t id = first_yield; id < first_yield + stmt->yield_count(); id++) { 657 for (size_t id = first_yield; id < first_yield + stmt->yield_count(); id++) {
658 DCHECK(0 <= id && id < generator_resume_points_.size());
659 auto& label = generator_resume_points_[id]; 658 auto& label = generator_resume_points_[id];
660 resume_points_in_loop.push_back(label); 659 resume_points_in_loop.push_back(label);
661 generator_resume_points_[id] = BytecodeLabel(); 660 generator_resume_points_[id] = BytecodeLabel();
662 } 661 }
663 662
664 loop_builder->LoopHeader(&resume_points_in_loop); 663 loop_builder->LoopHeader(&resume_points_in_loop);
665 664
666 if (stmt->yield_count() > 0) { 665 if (stmt->yield_count() > 0) {
667 // If we are not resuming, fall through to loop body. 666 // If we are not resuming, fall through to loop body.
668 // If we are resuming, perform state dispatch. 667 // If we are resuming, perform state dispatch.
(...skipping 2498 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 return execution_context()->scope()->language_mode(); 3166 return execution_context()->scope()->language_mode();
3168 } 3167 }
3169 3168
3170 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3169 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3171 return TypeFeedbackVector::GetIndex(slot); 3170 return TypeFeedbackVector::GetIndex(slot);
3172 } 3171 }
3173 3172
3174 } // namespace interpreter 3173 } // namespace interpreter
3175 } // namespace internal 3174 } // namespace internal
3176 } // namespace v8 3175 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | src/parsing/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698