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

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: Rebase. 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
« no previous file with comments | « src/interpreter/control-flow-builders.h ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(continue_sites_.empty());
14 DCHECK(break_sites_.empty());
15 }
16
17
18 void LoopBuilder::SetContinueTarget(const BytecodeLabel& target) {
19 BindLabels(target, &continue_sites_);
20 }
21
22
23 void LoopBuilder::SetBreakTarget(const BytecodeLabel& 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& target,
35 ZoneVector<BytecodeLabel>* sites) {
36 for (size_t i = 0; i < sites->size(); i++) {
37 BytecodeLabel& site = sites->at(i);
38 builder()->Bind(target, &site);
39 }
40 sites->clear();
41 }
42
43 } // namespace interpreter
44 } // namespace internal
45 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/control-flow-builders.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698