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

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 feedback from mstarzinger which revealed use after destruction bug. 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 BindLabels(continue_label(), &continue_labels_);
14 BindLabels(break_label(), &break_labels_);
rmcilroy 2015/10/01 09:18:56 Either move this to an explicit function or call t
oth 2015/10/01 11:43:02 Done.
15 }
16
17
18 void LoopBuilder::Break() {
19 break_labels_.push_back(BytecodeLabel());
20 builder()->Jump(&break_labels_.back());
21 }
22
23
24 void LoopBuilder::Continue() {
25 continue_labels_.push_back(BytecodeLabel());
26 builder()->Jump(&continue_labels_.back());
27 }
28
29
30 void LoopBuilder::BindLabels(BytecodeLabel* target,
31 ZoneVector<BytecodeLabel>* labels) {
32 for (size_t i = 0; i < labels->size(); i++) {
33 BytecodeLabel& unbound = labels->at(i);
34 builder()->Bind(&unbound, target);
35 }
36 }
37
38 } // namespace interpreter
39 } // namespace internal
40 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698