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

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: 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
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());
637 DCHECK_LE(start_index, start_index + size);
rmcilroy 2016/07/08 11:15:06 Are we worried about overflow here? I'd just remov
oth 2016/07/10 15:34:16 Done. It matched the semantic of the original chec
636 for (size_t i = start_index; i < start_index + size; i++) { 638 for (size_t i = start_index; i < start_index + size; i++) {
637 DCHECK(0 <= i && i < targets.size());
638 builder() 639 builder()
639 ->LoadLiteral(Smi::FromInt(static_cast<int>(i))) 640 ->LoadLiteral(Smi::FromInt(static_cast<int>(i)))
640 .CompareOperation(Token::Value::EQ_STRICT, index) 641 .CompareOperation(Token::Value::EQ_STRICT, index)
641 .JumpIfTrue(&(targets[i])); 642 .JumpIfTrue(&(targets[i]));
642 } 643 }
643
644 BuildAbort(BailoutReason::kInvalidJumpTableIndex); 644 BuildAbort(BailoutReason::kInvalidJumpTableIndex);
645 } 645 }
646 646
647 void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt, 647 void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt,
648 LoopBuilder* loop_builder) { 648 LoopBuilder* loop_builder) {
649 // Recall that stmt->yield_count() is always zero inside ordinary 649 // Recall that stmt->yield_count() is always zero inside ordinary
650 // (i.e. non-generator) functions. 650 // (i.e. non-generator) functions.
651 651
652 // Collect all labels for generator resume points within the loop (if any) so 652 // 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 653 // 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. 654 // for these resume points, to be used inside the loop.
655 ZoneVector<BytecodeLabel> resume_points_in_loop(zone()); 655 ZoneVector<BytecodeLabel> resume_points_in_loop(zone());
656 size_t first_yield = stmt->first_yield_id(); 656 size_t first_yield = stmt->first_yield_id();
657 DCHECK_LE(first_yield + stmt->yield_count(), generator_resume_points_.size());
658 DCHECK_LE(first_yield, first_yield + stmt->yield_count());
rmcilroy 2016/07/08 11:15:06 ditto
oth 2016/07/10 15:34:16 Done.
657 for (size_t id = first_yield; id < first_yield + stmt->yield_count(); id++) { 659 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]; 660 auto& label = generator_resume_points_[id];
660 resume_points_in_loop.push_back(label); 661 resume_points_in_loop.push_back(label);
661 generator_resume_points_[id] = BytecodeLabel(); 662 generator_resume_points_[id] = BytecodeLabel();
662 } 663 }
663 664
664 loop_builder->LoopHeader(&resume_points_in_loop); 665 loop_builder->LoopHeader(&resume_points_in_loop);
665 666
666 if (stmt->yield_count() > 0) { 667 if (stmt->yield_count() > 0) {
667 // If we are not resuming, fall through to loop body. 668 // If we are not resuming, fall through to loop body.
668 // If we are resuming, perform state dispatch. 669 // 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(); 3168 return execution_context()->scope()->language_mode();
3168 } 3169 }
3169 3170
3170 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3171 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3171 return TypeFeedbackVector::GetIndex(slot); 3172 return TypeFeedbackVector::GetIndex(slot);
3172 } 3173 }
3173 3174
3174 } // namespace interpreter 3175 } // namespace interpreter
3175 } // namespace internal 3176 } // namespace internal
3176 } // namespace v8 3177 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698