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 3435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3446 {false, "function f(arg) {function h() { g(arg) }; h()}"}, | 3446 {false, "function f(arg) {function h() { g(arg) }; h()}"}, |
3447 {false, "function f(arg) {function h() { g(arg) }; return h}"}, | 3447 {false, "function f(arg) {function h() { g(arg) }; return h}"}, |
3448 {false, "function f(arg=1) {}"}, | 3448 {false, "function f(arg=1) {}"}, |
3449 {false, "function f(arg=1) {g(arg)}"}, | 3449 {false, "function f(arg=1) {g(arg)}"}, |
3450 {false, "function f(arg, arguments) {g(arg); arguments[0] = 42; g(arg)}"}, | 3450 {false, "function f(arg, arguments) {g(arg); arguments[0] = 42; g(arg)}"}, |
3451 {false, | 3451 {false, |
3452 "function f(arg, ...arguments) {g(arg); arguments[0] = 42; g(arg)}"}, | 3452 "function f(arg, ...arguments) {g(arg); arguments[0] = 42; g(arg)}"}, |
3453 {false, | 3453 {false, |
3454 "function f(arg, arguments=[]) {g(arg); arguments[0] = 42; g(arg)}"}, | 3454 "function f(arg, arguments=[]) {g(arg); arguments[0] = 42; g(arg)}"}, |
3455 {false, "function f(...arg) {g(arg); arguments[0] = 42; g(arg)}"}, | 3455 {false, "function f(...arg) {g(arg); arguments[0] = 42; g(arg)}"}, |
| 3456 {false, |
| 3457 "function f(arg) {g(arg); g(function() {arguments[0] = 42}); g(arg)}"}, |
3456 | 3458 |
3457 // strict arguments object | 3459 // strict arguments object |
3458 {false, "function f(arg, x=1) {g(arg); arguments[0] = 42; g(arg)}"}, | 3460 {false, "function f(arg, x=1) {g(arg); arguments[0] = 42; g(arg)}"}, |
3459 {false, "function f(arg, ...x) {g(arg); arguments[0] = 42; g(arg)}"}, | 3461 {false, "function f(arg, ...x) {g(arg); arguments[0] = 42; g(arg)}"}, |
3460 {false, "function f(arg=1) {g(arg); arguments[0] = 42; g(arg)}"}, | 3462 {false, "function f(arg=1) {g(arg); arguments[0] = 42; g(arg)}"}, |
3461 {false, | 3463 {false, |
3462 "function f(arg) {'use strict'; g(arg); arguments[0] = 42; g(arg)}"}, | 3464 "function f(arg) {'use strict'; g(arg); arguments[0] = 42; g(arg)}"}, |
3463 {false, "function f(arg) {g(arg); f.arguments[0] = 42; g(arg)}"}, | 3465 {false, "function f(arg) {g(arg); f.arguments[0] = 42; g(arg)}"}, |
3464 {false, "function f(arg, args=arguments) {g(arg); args[0] = 42; g(arg)}"}, | 3466 {false, "function f(arg, args=arguments) {g(arg); args[0] = 42; g(arg)}"}, |
3465 | 3467 |
3466 {true, "function f(arg) {g(arg); arg = 42; g(arg)}"}, | 3468 {true, "function f(arg) {g(arg); arg = 42; g(arg)}"}, |
3467 {true, "function f(arg) {g(arg); eval('arg = 42'); g(arg)}"}, | 3469 {true, "function f(arg) {g(arg); eval('arg = 42'); g(arg)}"}, |
3468 {true, "function f(arg) {g(arg); var arg = 42; g(arg)}"}, | 3470 {true, "function f(arg) {g(arg); var arg = 42; g(arg)}"}, |
3469 {true, "function f(arg, x=1) {g(arg); arg = 42; g(arg)}"}, | 3471 {true, "function f(arg, x=1) {g(arg); arg = 42; g(arg)}"}, |
3470 {true, "function f(arg, ...x) {g(arg); arg = 42; g(arg)}"}, | 3472 {true, "function f(arg, ...x) {g(arg); arg = 42; g(arg)}"}, |
3471 {true, "function f(arg=1) {g(arg); arg = 42; g(arg)}"}, | 3473 {true, "function f(arg=1) {g(arg); arg = 42; g(arg)}"}, |
3472 {true, "function f(arg) {'use strict'; g(arg); arg = 42; g(arg)}"}, | 3474 {true, "function f(arg) {'use strict'; g(arg); arg = 42; g(arg)}"}, |
3473 {true, "function f(arg, {a=(g(arg), arg=42)}) {g(arg)}"}, | 3475 {true, "function f(arg, {a=(g(arg), arg=42)}) {g(arg)}"}, |
| 3476 {true, "function f(arg) {g(arg); g(function() {arg = 42}); g(arg)}"}, |
| 3477 {true, |
| 3478 "function f(arg) {g(arg); g(function() {eval('arg = 42')}); g(arg)}"}, |
3474 {true, "function f(arg) {g(arg); g(() => arg = 42); g(arg)}"}, | 3479 {true, "function f(arg) {g(arg); g(() => arg = 42); g(arg)}"}, |
3475 {true, "function f(arg) {g(arg); g(() => eval('arg = 42')); g(arg)}"}, | 3480 {true, "function f(arg) {g(arg); g(() => eval('arg = 42')); g(arg)}"}, |
3476 {true, "function f(arg) {g(arg); g(() => arguments[0] = 42); g(arg)}"}, | |
3477 {true, "function f(...arg) {g(arg); eval('arg = 42'); g(arg)}"}, | 3481 {true, "function f(...arg) {g(arg); eval('arg = 42'); g(arg)}"}, |
3478 | 3482 |
3479 // sloppy arguments object | 3483 // sloppy arguments object |
3480 {true, "function f(arg) {g(arg); arguments[0] = 42; g(arg)}"}, | 3484 {true, "function f(arg) {g(arg); arguments[0] = 42; g(arg)}"}, |
3481 {true, "function f(arg) {g(arg); h(arguments); g(arg)}"}, | 3485 {true, "function f(arg) {g(arg); h(arguments); g(arg)}"}, |
3482 {true, | 3486 {true, |
3483 "function f(arg) {((args) => {arguments[0] = 42})(arguments); " | 3487 "function f(arg) {((args) => {arguments[0] = 42})(arguments); " |
3484 "g(arg)}"}, | 3488 "g(arg)}"}, |
3485 {true, "function f(arg) {g(arg); eval('arguments[0] = 42'); g(arg)}"}, | 3489 {true, "function f(arg) {g(arg); eval('arguments[0] = 42'); g(arg)}"}, |
| 3490 {true, "function f(arg) {g(arg); g(() => arguments[0] = 42); g(arg)}"}, |
3486 }; | 3491 }; |
3487 | 3492 |
3488 const char* suffix = "; f"; | 3493 const char* suffix = "; f"; |
3489 | 3494 |
3490 for (unsigned i = 0; i < arraysize(tests); ++i) { | 3495 for (unsigned i = 0; i < arraysize(tests); ++i) { |
3491 bool assigned = tests[i].arg_assigned; | 3496 bool assigned = tests[i].arg_assigned; |
3492 const char* source = tests[i].source; | 3497 const char* source = tests[i].source; |
3493 for (unsigned allow_lazy = 0; allow_lazy < 2; ++allow_lazy) { | 3498 for (unsigned allow_lazy = 0; allow_lazy < 2; ++allow_lazy) { |
3494 i::ScopedVector<char> program(Utf8LengthHelper(source) + | 3499 i::ScopedVector<char> program(Utf8LengthHelper(source) + |
3495 Utf8LengthHelper(suffix) + 1); | 3500 Utf8LengthHelper(suffix) + 1); |
(...skipping 5199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8695 DCHECK_NOT_NULL(scope); | 8700 DCHECK_NOT_NULL(scope); |
8696 DCHECK_NULL(scope->sibling()); | 8701 DCHECK_NULL(scope->sibling()); |
8697 DCHECK(scope->is_function_scope()); | 8702 DCHECK(scope->is_function_scope()); |
8698 const i::AstRawString* var_name = | 8703 const i::AstRawString* var_name = |
8699 info.ast_value_factory()->GetOneByteString("my_var"); | 8704 info.ast_value_factory()->GetOneByteString("my_var"); |
8700 i::Variable* var = scope->Lookup(var_name); | 8705 i::Variable* var = scope->Lookup(var_name); |
8701 CHECK_EQ(inners[i].ctxt_allocate, | 8706 CHECK_EQ(inners[i].ctxt_allocate, |
8702 i::ScopeTestHelper::MustAllocateInContext(var)); | 8707 i::ScopeTestHelper::MustAllocateInContext(var)); |
8703 } | 8708 } |
8704 } | 8709 } |
OLD | NEW |