| 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 3362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3413 i::Scope* scope = info.literal()->scope(); | 3414 i::Scope* scope = info.literal()->scope(); |
| 3414 i::Scope* inner_scope = scope->inner_scope(); | 3415 i::Scope* inner_scope = scope->inner_scope(); |
| 3415 DCHECK_NOT_NULL(inner_scope); | 3416 DCHECK_NOT_NULL(inner_scope); |
| 3416 DCHECK_NULL(inner_scope->sibling()); | 3417 DCHECK_NULL(inner_scope->sibling()); |
| 3417 const i::AstRawString* var_name = | 3418 const i::AstRawString* var_name = |
| 3418 info.ast_value_factory()->GetOneByteString("x"); | 3419 info.ast_value_factory()->GetOneByteString("x"); |
| 3419 i::Variable* var = inner_scope->Lookup(var_name); | 3420 i::Variable* var = inner_scope->Lookup(var_name); |
| 3420 bool expected = outers[i].assigned || inners[j].assigned; | 3421 bool expected = outers[i].assigned || inners[j].assigned; |
| 3421 CHECK(var != NULL); | 3422 CHECK(var != NULL); |
| 3422 CHECK(var->is_used() || !expected); | 3423 CHECK(var->is_used() || !expected); |
| 3423 CHECK((var->maybe_assigned() == i::kMaybeAssigned) == expected); | 3424 bool is_maybe_assigned = var->maybe_assigned() == i::kMaybeAssigned; |
| 3425 if (i::FLAG_lazy_inner_functions) { |
| 3426 // If we parse inner functions lazily, allow being pessimistic about |
| 3427 // maybe_assigned. |
| 3428 CHECK(is_maybe_assigned || (is_maybe_assigned == expected)); |
| 3429 } else { |
| 3430 CHECK(is_maybe_assigned == expected); |
| 3431 } |
| 3424 } | 3432 } |
| 3425 } | 3433 } |
| 3426 } | 3434 } |
| 3427 } | 3435 } |
| 3428 } | 3436 } |
| 3429 | 3437 |
| 3430 namespace { | 3438 namespace { |
| 3431 | 3439 |
| 3432 int* global_use_counts = NULL; | 3440 int* global_use_counts = NULL; |
| 3433 | 3441 |
| (...skipping 4894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8328 const char* data[] = { | 8336 const char* data[] = { |
| 8329 "const arguments = 1", | 8337 "const arguments = 1", |
| 8330 "let arguments", | 8338 "let arguments", |
| 8331 "var arguments", | 8339 "var arguments", |
| 8332 NULL | 8340 NULL |
| 8333 }; | 8341 }; |
| 8334 // clang-format on | 8342 // clang-format on |
| 8335 RunParserSyncTest(context_data, data, kSuccess); | 8343 RunParserSyncTest(context_data, data, kSuccess); |
| 8336 } | 8344 } |
| 8337 } | 8345 } |
| OLD | NEW |