OLD | NEW |
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 6955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6966 RunParserSyncTest(context_data, data, kError); | 6966 RunParserSyncTest(context_data, data, kError); |
6967 RunParserSyncTest(context_data, rest_data, kError); | 6967 RunParserSyncTest(context_data, rest_data, kError); |
6968 static const ParserFlag flags[] = {kAllowHarmonyObjectRestSpread}; | 6968 static const ParserFlag flags[] = {kAllowHarmonyObjectRestSpread}; |
6969 RunParserSyncTest(context_data, data, kError, NULL, 0, flags, | 6969 RunParserSyncTest(context_data, data, kError, NULL, 0, flags, |
6970 arraysize(flags)); | 6970 arraysize(flags)); |
6971 RunParserSyncTest(context_data, rest_data, kError, NULL, 0, flags, | 6971 RunParserSyncTest(context_data, rest_data, kError, NULL, 0, flags, |
6972 arraysize(flags)); | 6972 arraysize(flags)); |
6973 } | 6973 } |
6974 } | 6974 } |
6975 | 6975 |
| 6976 TEST(ObjectRestNegativeTestSlow) { |
| 6977 // clang-format off |
| 6978 const char* context_data[][2] = { |
| 6979 {"var { ", " } = { a: 1};"}, |
| 6980 { NULL, NULL } |
| 6981 }; |
| 6982 |
| 6983 using v8::internal::Code; |
| 6984 std::string statement; |
| 6985 for (int i = 0; i < Code::kMaxArguments; ++i) { |
| 6986 statement += std::to_string(i) + " : " + "x, "; |
| 6987 } |
| 6988 statement += "...y"; |
| 6989 |
| 6990 const char* statement_data[] = { |
| 6991 statement.c_str(), |
| 6992 NULL |
| 6993 }; |
| 6994 |
| 6995 // clang-format on |
| 6996 // The test is quite slow, so run it with a reduced set of flags. |
| 6997 static const ParserFlag flags[] = {kAllowLazy, kAllowHarmonyObjectRestSpread}; |
| 6998 RunParserSyncTest(context_data, statement_data, kError, NULL, 0, flags, |
| 6999 arraysize(flags)); |
| 7000 } |
6976 | 7001 |
6977 TEST(DestructuringAssignmentPositiveTests) { | 7002 TEST(DestructuringAssignmentPositiveTests) { |
6978 const char* context_data[][2] = { | 7003 const char* context_data[][2] = { |
6979 {"'use strict'; let x, y, z; (", " = {});"}, | 7004 {"'use strict'; let x, y, z; (", " = {});"}, |
6980 {"var x, y, z; (", " = {});"}, | 7005 {"var x, y, z; (", " = {});"}, |
6981 {"'use strict'; let x, y, z; for (x in ", " = {});"}, | 7006 {"'use strict'; let x, y, z; for (x in ", " = {});"}, |
6982 {"'use strict'; let x, y, z; for (x of ", " = {});"}, | 7007 {"'use strict'; let x, y, z; for (x of ", " = {});"}, |
6983 {"var x, y, z; for (x in ", " = {});"}, | 7008 {"var x, y, z; for (x in ", " = {});"}, |
6984 {"var x, y, z; for (x of ", " = {});"}, | 7009 {"var x, y, z; for (x of ", " = {});"}, |
6985 {"var x, y, z; for (", " in {});"}, | 7010 {"var x, y, z; for (", " in {});"}, |
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8926 DCHECK_NULL(scope->sibling()); | 8951 DCHECK_NULL(scope->sibling()); |
8927 DCHECK(scope->is_function_scope()); | 8952 DCHECK(scope->is_function_scope()); |
8928 const i::AstRawString* var_name = | 8953 const i::AstRawString* var_name = |
8929 info.ast_value_factory()->GetOneByteString("my_var"); | 8954 info.ast_value_factory()->GetOneByteString("my_var"); |
8930 i::Variable* var = scope->Lookup(var_name); | 8955 i::Variable* var = scope->Lookup(var_name); |
8931 CHECK_EQ(inners[i].ctxt_allocate, | 8956 CHECK_EQ(inners[i].ctxt_allocate, |
8932 i::ScopeTestHelper::MustAllocateInContext(var)); | 8957 i::ScopeTestHelper::MustAllocateInContext(var)); |
8933 } | 8958 } |
8934 } | 8959 } |
8935 } | 8960 } |
OLD | NEW |