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: test/cctest/compiler/test-run-jsbranches.cc

Issue 502043002: Fix continue statements within for-in loops. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "test/cctest/compiler/function-tester.h" 7 #include "test/cctest/compiler/function-tester.h"
8 8
9 using namespace v8::internal; 9 using namespace v8::internal;
10 using namespace v8::internal::compiler; 10 using namespace v8::internal::compiler;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 TestForIn( 141 TestForIn(
142 "(function(a, b) {" 142 "(function(a, b) {"
143 "var obj = {'a' : undefined};" 143 "var obj = {'a' : undefined};"
144 "for (obj.a in a) {" 144 "for (obj.a in a) {"
145 " if (b) { delete a[b]; b = undefined; }" 145 " if (b) { delete a[b]; b = undefined; }"
146 "}" 146 "}"
147 "return obj.a;})"); 147 "return obj.a;})");
148 } 148 }
149 149
150 150
151 TEST(ForInContinueStatement) {
152 const char* src =
153 "(function(a,b) {"
154 " var r = '-';"
155 " for (var x in a) {"
156 " r += 'A-';"
157 " if (b) continue;"
158 " r += 'B-';"
159 " }"
160 " return r;"
161 "})";
162 FunctionTester T(src);
163
164 T.CheckCall(T.Val("-A-B-"), T.NewObject("({x:1})"), T.false_value());
165 T.CheckCall(T.Val("-A-B-A-B-"), T.NewObject("({x:1,y:2})"), T.false_value());
166 T.CheckCall(T.Val("-A-"), T.NewObject("({x:1})"), T.true_value());
167 T.CheckCall(T.Val("-A-A-"), T.NewObject("({x:1,y:2})"), T.true_value());
168 }
169
170
151 TEST(SwitchStatement) { 171 TEST(SwitchStatement) {
152 const char* src = 172 const char* src =
153 "(function(a,b) {" 173 "(function(a,b) {"
154 " var r = '-';" 174 " var r = '-';"
155 " switch (a) {" 175 " switch (a) {"
156 " case 'x' : r += 'X-';" 176 " case 'x' : r += 'X-';"
157 " case b + 'b': r += 'B-';" 177 " case b + 'b': r += 'B-';"
158 " default : r += 'D-';" 178 " default : r += 'D-';"
159 " case 'y' : r += 'Y-';" 179 " case 'y' : r += 'Y-';"
160 " }" 180 " }"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 273 }
254 274
255 275
256 TEST(NestedForConditional) { 276 TEST(NestedForConditional) {
257 FunctionTester T("(function(a,b) { for (; a > 1; a--) return b ? 1 : 2; })"); 277 FunctionTester T("(function(a,b) { for (; a > 1; a--) return b ? 1 : 2; })");
258 278
259 T.CheckCall(T.Val(1), T.Val(3), T.true_value()); 279 T.CheckCall(T.Val(1), T.Val(3), T.true_value());
260 T.CheckCall(T.Val(2), T.Val(2), T.false_value()); 280 T.CheckCall(T.Val(2), T.Val(2), T.false_value());
261 T.CheckCall(T.undefined(), T.Val(1), T.null()); 281 T.CheckCall(T.undefined(), T.Val(1), T.null());
262 } 282 }
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698