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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 #include <memory> | 32 #include <memory> |
33 | 33 |
34 #include "src/v8.h" | 34 #include "src/v8.h" |
35 | 35 |
36 #include "src/ast/ast-numbering.h" | 36 #include "src/ast/ast-numbering.h" |
37 #include "src/ast/ast-value-factory.h" | 37 #include "src/ast/ast-value-factory.h" |
38 #include "src/ast/ast.h" | 38 #include "src/ast/ast.h" |
39 #include "src/compiler.h" | 39 #include "src/compiler.h" |
40 #include "src/execution.h" | 40 #include "src/execution.h" |
| 41 #include "src/flags.h" |
41 #include "src/isolate.h" | 42 #include "src/isolate.h" |
42 #include "src/objects.h" | 43 #include "src/objects.h" |
43 #include "src/parsing/parse-info.h" | 44 #include "src/parsing/parse-info.h" |
44 #include "src/parsing/parser.h" | 45 #include "src/parsing/parser.h" |
45 #include "src/parsing/preparser.h" | 46 #include "src/parsing/preparser.h" |
46 #include "src/parsing/rewriter.h" | 47 #include "src/parsing/rewriter.h" |
47 #include "src/parsing/scanner-character-streams.h" | 48 #include "src/parsing/scanner-character-streams.h" |
48 #include "src/parsing/token.h" | 49 #include "src/parsing/token.h" |
49 #include "src/utils.h" | 50 #include "src/utils.h" |
50 | 51 |
(...skipping 3358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3409 i::Scope* scope = info.literal()->scope(); | 3410 i::Scope* scope = info.literal()->scope(); |
3410 i::Scope* inner_scope = scope->inner_scope(); | 3411 i::Scope* inner_scope = scope->inner_scope(); |
3411 DCHECK_NOT_NULL(inner_scope); | 3412 DCHECK_NOT_NULL(inner_scope); |
3412 DCHECK_NULL(inner_scope->sibling()); | 3413 DCHECK_NULL(inner_scope->sibling()); |
3413 const i::AstRawString* var_name = | 3414 const i::AstRawString* var_name = |
3414 info.ast_value_factory()->GetOneByteString("x"); | 3415 info.ast_value_factory()->GetOneByteString("x"); |
3415 i::Variable* var = inner_scope->Lookup(var_name); | 3416 i::Variable* var = inner_scope->Lookup(var_name); |
3416 bool expected = outers[i].assigned || inners[j].assigned; | 3417 bool expected = outers[i].assigned || inners[j].assigned; |
3417 CHECK(var != NULL); | 3418 CHECK(var != NULL); |
3418 CHECK(var->is_used() || !expected); | 3419 CHECK(var->is_used() || !expected); |
3419 CHECK((var->maybe_assigned() == i::kMaybeAssigned) == expected); | 3420 bool is_maybe_assigned = var->maybe_assigned() == i::kMaybeAssigned; |
| 3421 if (i::FLAG_lazy_inner_functions) { |
| 3422 // If we parse inner functions lazily, allow being pessimistic about |
| 3423 // maybe_assigned. |
| 3424 CHECK(is_maybe_assigned || (is_maybe_assigned == expected)); |
| 3425 } else { |
| 3426 CHECK(is_maybe_assigned == expected); |
| 3427 } |
3420 } | 3428 } |
3421 } | 3429 } |
3422 } | 3430 } |
3423 } | 3431 } |
3424 | 3432 |
3425 namespace { | 3433 namespace { |
3426 | 3434 |
3427 int* global_use_counts = NULL; | 3435 int* global_use_counts = NULL; |
3428 | 3436 |
3429 void MockUseCounterCallback(v8::Isolate* isolate, | 3437 void MockUseCounterCallback(v8::Isolate* isolate, |
(...skipping 4893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8323 const char* data[] = { | 8331 const char* data[] = { |
8324 "const arguments = 1", | 8332 "const arguments = 1", |
8325 "let arguments", | 8333 "let arguments", |
8326 "var arguments", | 8334 "var arguments", |
8327 NULL | 8335 NULL |
8328 }; | 8336 }; |
8329 // clang-format on | 8337 // clang-format on |
8330 RunParserSyncTest(context_data, data, kSuccess); | 8338 RunParserSyncTest(context_data, data, kSuccess); |
8331 } | 8339 } |
8332 } | 8340 } |
OLD | NEW |