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