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

Side by Side Diff: src/interpreter/control-flow-builders.cc

Issue 1373903005: [Interpreter] Add for/while/do support to the bytecode generator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate comments / re-work IfBuilder. Created 5 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/interpreter/control-flow-builders.h"
6
7 namespace v8 {
8 namespace internal {
9 namespace interpreter {
10
11
12 LoopBuilder::~LoopBuilder() {
13 DCHECK_EQ(continue_sites_.size(), 0);
rmcilroy 2015/10/01 12:12:08 nit - DCHECK(continue_sites_.empty());
oth 2015/10/01 13:13:56 Done.
14 DCHECK_EQ(break_sites_.size(), 0);
15 }
16
17
18 void LoopBuilder::SetContinueTarget(const BytecodeLabel* const target) {
19 BindLabels(target, &continue_sites_);
20 }
21
22
23 void LoopBuilder::SetBreakTarget(const BytecodeLabel* const target) {
24 BindLabels(target, &break_sites_);
25 }
26
27
28 void LoopBuilder::EmitJump(ZoneVector<BytecodeLabel>* sites) {
29 sites->push_back(BytecodeLabel());
30 builder()->Jump(&sites->back());
31 }
32
33
34 void LoopBuilder::BindLabels(const BytecodeLabel* const target,
35 ZoneVector<BytecodeLabel>* labels) {
36 for (size_t i = 0; i < labels->size(); i++) {
37 BytecodeLabel& unbound = labels->at(i);
38 builder()->Bind(&unbound, target);
39 }
40 labels->resize(0);
rmcilroy 2015/10/01 12:12:07 nit - labels->clear() ?
oth 2015/10/01 13:13:56 Done.
41 }
42
43 } // namespace interpreter
44 } // namespace internal
45 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698