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

Side by Side Diff: test/cctest/test-ast-expression-visitor.cc

Issue 1314843002: Visit additional AST nodes as expressions in AstExpressionVisitor . (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: revised Created 5 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
« no previous file with comments | « src/ast-expression-visitor.cc ('k') | test/cctest/test-typing-reset.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/ast-expression-visitor.h" 10 #include "src/ast-expression-visitor.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 } 157 }
158 // sum = sum + +log(values[p>>3]); 158 // sum = sum + +log(values[p>>3]);
159 CHECK_EXPR(Assignment, DEFAULT_TYPE) { 159 CHECK_EXPR(Assignment, DEFAULT_TYPE) {
160 CHECK_VAR(sum, DEFAULT_TYPE); 160 CHECK_VAR(sum, DEFAULT_TYPE);
161 CHECK_EXPR(BinaryOperation, DEFAULT_TYPE) { 161 CHECK_EXPR(BinaryOperation, DEFAULT_TYPE) {
162 CHECK_VAR(sum, DEFAULT_TYPE); 162 CHECK_VAR(sum, DEFAULT_TYPE);
163 CHECK_EXPR(BinaryOperation, DEFAULT_TYPE) { 163 CHECK_EXPR(BinaryOperation, DEFAULT_TYPE) {
164 CHECK_EXPR(Call, DEFAULT_TYPE) { 164 CHECK_EXPR(Call, DEFAULT_TYPE) {
165 CHECK_VAR(log, DEFAULT_TYPE); 165 CHECK_VAR(log, DEFAULT_TYPE);
166 CHECK_VAR(values, DEFAULT_TYPE); 166 CHECK_EXPR(Property, DEFAULT_TYPE) {
167 CHECK_EXPR(BinaryOperation, DEFAULT_TYPE) { 167 CHECK_VAR(values, DEFAULT_TYPE);
168 CHECK_VAR(p, DEFAULT_TYPE); 168 CHECK_EXPR(BinaryOperation, DEFAULT_TYPE) {
169 CHECK_EXPR(Literal, DEFAULT_TYPE); 169 CHECK_VAR(p, DEFAULT_TYPE);
170 CHECK_EXPR(Literal, DEFAULT_TYPE);
171 }
170 } 172 }
171 } 173 }
172 CHECK_EXPR(Literal, DEFAULT_TYPE); 174 CHECK_EXPR(Literal, DEFAULT_TYPE);
173 } 175 }
174 } 176 }
175 } 177 }
176 // return +sum; 178 // return +sum;
177 CHECK_EXPR(BinaryOperation, DEFAULT_TYPE) { 179 CHECK_EXPR(BinaryOperation, DEFAULT_TYPE) {
178 CHECK_VAR(sum, DEFAULT_TYPE); 180 CHECK_VAR(sum, DEFAULT_TYPE);
179 CHECK_EXPR(Literal, DEFAULT_TYPE); 181 CHECK_EXPR(Literal, DEFAULT_TYPE);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 223 }
222 } 224 }
223 CHECK_EXPR(Literal, DEFAULT_TYPE); 225 CHECK_EXPR(Literal, DEFAULT_TYPE);
224 } 226 }
225 } 227 }
226 // "use asm"; 228 // "use asm";
227 CHECK_EXPR(Literal, DEFAULT_TYPE); 229 CHECK_EXPR(Literal, DEFAULT_TYPE);
228 // var exp = stdlib.Math.exp; 230 // var exp = stdlib.Math.exp;
229 CHECK_EXPR(Assignment, DEFAULT_TYPE) { 231 CHECK_EXPR(Assignment, DEFAULT_TYPE) {
230 CHECK_VAR(exp, DEFAULT_TYPE); 232 CHECK_VAR(exp, DEFAULT_TYPE);
231 CHECK_VAR(stdlib, DEFAULT_TYPE); 233 CHECK_EXPR(Property, DEFAULT_TYPE) {
232 CHECK_EXPR(Literal, DEFAULT_TYPE); 234 CHECK_EXPR(Property, DEFAULT_TYPE) {
233 CHECK_EXPR(Literal, DEFAULT_TYPE); 235 CHECK_VAR(stdlib, DEFAULT_TYPE);
236 CHECK_EXPR(Literal, DEFAULT_TYPE);
237 }
238 CHECK_EXPR(Literal, DEFAULT_TYPE);
239 }
234 } 240 }
235 // var log = stdlib.Math.log; 241 // var log = stdlib.Math.log;
236 CHECK_EXPR(Assignment, DEFAULT_TYPE) { 242 CHECK_EXPR(Assignment, DEFAULT_TYPE) {
237 CHECK_VAR(log, DEFAULT_TYPE); 243 CHECK_VAR(log, DEFAULT_TYPE);
238 CHECK_VAR(stdlib, DEFAULT_TYPE); 244 CHECK_EXPR(Property, DEFAULT_TYPE) {
239 CHECK_EXPR(Literal, DEFAULT_TYPE); 245 CHECK_EXPR(Property, DEFAULT_TYPE) {
240 CHECK_EXPR(Literal, DEFAULT_TYPE); 246 CHECK_VAR(stdlib, DEFAULT_TYPE);
247 CHECK_EXPR(Literal, DEFAULT_TYPE);
248 }
249 CHECK_EXPR(Literal, DEFAULT_TYPE);
250 }
241 } 251 }
242 // var values = new stdlib.Float64Array(buffer); 252 // var values = new stdlib.Float64Array(buffer);
243 CHECK_EXPR(Assignment, DEFAULT_TYPE) { 253 CHECK_EXPR(Assignment, DEFAULT_TYPE) {
244 CHECK_VAR(values, DEFAULT_TYPE); 254 CHECK_VAR(values, DEFAULT_TYPE);
245 CHECK_EXPR(CallNew, DEFAULT_TYPE) { 255 CHECK_EXPR(CallNew, DEFAULT_TYPE) {
246 CHECK_VAR(stdlib, DEFAULT_TYPE); 256 CHECK_EXPR(Property, DEFAULT_TYPE) {
247 CHECK_EXPR(Literal, DEFAULT_TYPE); 257 CHECK_VAR(stdlib, DEFAULT_TYPE);
258 CHECK_EXPR(Literal, DEFAULT_TYPE);
259 }
248 CHECK_VAR(buffer, DEFAULT_TYPE); 260 CHECK_VAR(buffer, DEFAULT_TYPE);
249 } 261 }
250 } 262 }
251 // return { geometricMean: geometricMean }; 263 // return { geometricMean: geometricMean };
252 CHECK_EXPR(ObjectLiteral, DEFAULT_TYPE) { 264 CHECK_EXPR(ObjectLiteral, DEFAULT_TYPE) {
253 CHECK_VAR(geometricMean, DEFAULT_TYPE); 265 CHECK_VAR(geometricMean, DEFAULT_TYPE);
254 } 266 }
255 } 267 }
256 } 268 }
257 CHECK_TYPES_END 269 CHECK_TYPES_END
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 CHECK_EXPR(Assignment, DEFAULT_TYPE) { 302 CHECK_EXPR(Assignment, DEFAULT_TYPE) {
291 CHECK_VAR(.switch_tag, DEFAULT_TYPE); 303 CHECK_VAR(.switch_tag, DEFAULT_TYPE);
292 CHECK_EXPR(Literal, DEFAULT_TYPE); 304 CHECK_EXPR(Literal, DEFAULT_TYPE);
293 } 305 }
294 CHECK_VAR(.switch_tag, DEFAULT_TYPE); 306 CHECK_VAR(.switch_tag, DEFAULT_TYPE);
295 CHECK_EXPR(Literal, DEFAULT_TYPE); 307 CHECK_EXPR(Literal, DEFAULT_TYPE);
296 } 308 }
297 } 309 }
298 CHECK_TYPES_END 310 CHECK_TYPES_END
299 } 311 }
312
313
314 TEST(VisitThrow) {
315 v8::V8::Initialize();
316 HandleAndZoneScope handles;
317 ZoneVector<ExpressionTypeEntry> types(handles.main_zone());
318 // Check that traversing an empty for statement works.
319 const char test_function[] =
320 "function foo() {\n"
321 " throw 123;\n"
322 "}\n";
323 CollectTypes(&handles, test_function, &types);
324 CHECK_TYPES_BEGIN {
325 CHECK_EXPR(FunctionLiteral, DEFAULT_TYPE) {
326 CHECK_EXPR(Throw, DEFAULT_TYPE) { CHECK_EXPR(Literal, DEFAULT_TYPE); }
327 }
328 }
329 CHECK_TYPES_END
330 }
331
332
333 TEST(VisitYield) {
334 v8::V8::Initialize();
335 HandleAndZoneScope handles;
336 ZoneVector<ExpressionTypeEntry> types(handles.main_zone());
337 // Check that traversing an empty for statement works.
338 const char test_function[] =
339 "function* foo() {\n"
340 " yield 123;\n"
341 "}\n";
342 CollectTypes(&handles, test_function, &types);
343 CHECK_TYPES_BEGIN {
344 CHECK_EXPR(FunctionLiteral, DEFAULT_TYPE) {
345 // Generator function yields generator on entry.
346 CHECK_EXPR(Yield, DEFAULT_TYPE) {
347 CHECK_VAR(.generator_object, DEFAULT_TYPE);
348 CHECK_EXPR(Assignment, DEFAULT_TYPE) {
349 CHECK_VAR(.generator_object, DEFAULT_TYPE);
350 CHECK_EXPR(CallRuntime, DEFAULT_TYPE);
351 }
352 }
353 // Then yields undefined.
354 CHECK_EXPR(Yield, DEFAULT_TYPE) {
355 CHECK_VAR(.generator_object, DEFAULT_TYPE);
356 CHECK_EXPR(Literal, DEFAULT_TYPE);
357 }
358 // Then yields 123.
359 CHECK_EXPR(Yield, DEFAULT_TYPE) {
360 CHECK_VAR(.generator_object, DEFAULT_TYPE);
361 CHECK_EXPR(Literal, DEFAULT_TYPE);
362 }
363 }
364 }
365 CHECK_TYPES_END
366 }
OLDNEW
« no previous file with comments | « src/ast-expression-visitor.cc ('k') | test/cctest/test-typing-reset.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698