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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2452403003: Changed statement ZoneList to a ZoneChunkList
Patch Set: Created 4 years, 1 month 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 | « test/cctest/test-liveedit.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 i::ParseInfo info(handles.main_zone(), script); 906 i::ParseInfo info(handles.main_zone(), script);
907 i::Parser parser(&info); 907 i::Parser parser(&info);
908 info.set_allow_lazy_parsing(false); 908 info.set_allow_lazy_parsing(false);
909 info.set_toplevel(true); 909 info.set_toplevel(true);
910 910
911 CHECK(i::Compiler::ParseAndAnalyze(&info)); 911 CHECK(i::Compiler::ParseAndAnalyze(&info));
912 912
913 CHECK(info.scope()->declarations()->length() == 1); 913 CHECK(info.scope()->declarations()->length() == 1);
914 i::FunctionLiteral* fun = 914 i::FunctionLiteral* fun =
915 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); 915 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun();
916 CHECK(fun->body()->length() == 1); 916 CHECK(fun->body()->size() == 1);
917 CHECK(fun->body()->at(0)->IsReturnStatement()); 917 CHECK(fun->body()->front()->IsReturnStatement());
918 i::ReturnStatement* ret = fun->body()->at(0)->AsReturnStatement(); 918 i::ReturnStatement* ret = fun->body()->front()->AsReturnStatement();
919 i::Literal* lit = ret->expression()->AsLiteral(); 919 i::Literal* lit = ret->expression()->AsLiteral();
920 if (lit != NULL) { 920 if (lit != NULL) {
921 const i::AstValue* val = lit->raw_value(); 921 const i::AstValue* val = lit->raw_value();
922 CHECK(with_dot == val->ContainsDot()); 922 CHECK(with_dot == val->ContainsDot());
923 } else if (with_dot) { 923 } else if (with_dot) {
924 i::BinaryOperation* bin = ret->expression()->AsBinaryOperation(); 924 i::BinaryOperation* bin = ret->expression()->AsBinaryOperation();
925 CHECK(bin != NULL); 925 CHECK(bin != NULL);
926 CHECK_EQ(i::Token::MUL, bin->op()); 926 CHECK_EQ(i::Token::MUL, bin->op());
927 i::Literal* rlit = bin->right()->AsLiteral(); 927 i::Literal* rlit = bin->right()->AsLiteral();
928 const i::AstValue* val = rlit->raw_value(); 928 const i::AstValue* val = rlit->raw_value();
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked(); 1214 factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked();
1215 i::Handle<i::Script> script = factory->NewScript(source_code); 1215 i::Handle<i::Script> script = factory->NewScript(source_code);
1216 i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); 1216 i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
1217 i::ParseInfo info(&zone, script); 1217 i::ParseInfo info(&zone, script);
1218 info.set_allow_lazy_parsing(); 1218 info.set_allow_lazy_parsing();
1219 i::Parser parser(&info); 1219 i::Parser parser(&info);
1220 parser.Parse(&info); 1220 parser.Parse(&info);
1221 function = info.literal(); 1221 function = info.literal();
1222 CHECK_NOT_NULL(function); 1222 CHECK_NOT_NULL(function);
1223 CHECK_NOT_NULL(function->body()); 1223 CHECK_NOT_NULL(function->body());
1224 CHECK_EQ(1, function->body()->length()); 1224 CHECK_EQ(1, function->body()->size());
1225 i::FunctionLiteral* inner = 1225 i::FunctionLiteral* inner = function->body()
1226 function->body()->first()->AsExpressionStatement()->expression()-> 1226 ->front()
1227 AsCall()->expression()->AsFunctionLiteral(); 1227 ->AsExpressionStatement()
1228 ->expression()
1229 ->AsCall()
1230 ->expression()
1231 ->AsFunctionLiteral();
1228 i::Scope* inner_scope = inner->scope(); 1232 i::Scope* inner_scope = inner->scope();
1229 i::FunctionLiteral* fun = nullptr; 1233 i::FunctionLiteral* fun = nullptr;
1230 if (inner_scope->declarations()->length() > 0) { 1234 if (inner_scope->declarations()->length() > 0) {
1231 fun = inner_scope->declarations()->at(0)->AsFunctionDeclaration()->fun(); 1235 fun = inner_scope->declarations()->at(0)->AsFunctionDeclaration()->fun();
1232 } else { 1236 } else {
1233 // TODO(conradw): This path won't be hit until the other test cases can be 1237 // TODO(conradw): This path won't be hit until the other test cases can be
1234 // uncommented. 1238 // uncommented.
1235 UNREACHABLE(); 1239 UNREACHABLE();
1236 CHECK_NOT_NULL(inner->body()); 1240 CHECK_NOT_NULL(inner->body());
1237 CHECK_GE(2, inner->body()->length()); 1241 CHECK_GE(size_t(2), inner->body()->size());
1238 i::Expression* exp = inner->body()->at(1)->AsExpressionStatement()-> 1242 auto it = inner->body()->begin();
1239 expression()->AsBinaryOperation()->right(); 1243 it++;
1244 i::Expression* exp = (*it)
1245 ->AsExpressionStatement()
1246 ->expression()
1247 ->AsBinaryOperation()
1248 ->right();
1240 if (exp->IsFunctionLiteral()) { 1249 if (exp->IsFunctionLiteral()) {
1241 fun = exp->AsFunctionLiteral(); 1250 fun = exp->AsFunctionLiteral();
1242 } else if (exp->IsObjectLiteral()) { 1251 } else if (exp->IsObjectLiteral()) {
1243 fun = exp->AsObjectLiteral()->properties()->at(0)->value()-> 1252 fun = exp->AsObjectLiteral()->properties()->at(0)->value()->
1244 AsFunctionLiteral(); 1253 AsFunctionLiteral();
1245 } else { 1254 } else {
1246 fun = exp->AsClassLiteral()->properties()->at(0)->value()-> 1255 fun = exp->AsClassLiteral()->properties()->at(0)->value()->
1247 AsFunctionLiteral(); 1256 AsFunctionLiteral();
1248 } 1257 }
1249 } 1258 }
(...skipping 7075 matching lines...) Expand 10 before | Expand all | Expand 10 after
8325 const char* data[] = { 8334 const char* data[] = {
8326 "const arguments = 1", 8335 "const arguments = 1",
8327 "let arguments", 8336 "let arguments",
8328 "var arguments", 8337 "var arguments",
8329 NULL 8338 NULL
8330 }; 8339 };
8331 // clang-format on 8340 // clang-format on
8332 RunParserSyncTest(context_data, data, kSuccess); 8341 RunParserSyncTest(context_data, data, kSuccess);
8333 } 8342 }
8334 } 8343 }
OLDNEW
« no previous file with comments | « test/cctest/test-liveedit.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698