| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "test/cctest/compiler/function-tester.h" | 7 #include "test/cctest/compiler/function-tester.h" |
| 8 | 8 |
| 9 using namespace v8::internal; | 9 using namespace v8::internal; |
| 10 using namespace v8::internal::compiler; | 10 using namespace v8::internal::compiler; |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 FunctionTester T("(function(a,b) { var x; with(a) { x = b; } return x; })"); | 444 FunctionTester T("(function(a,b) { var x; with(a) { x = b; } return x; })"); |
| 445 | 445 |
| 446 T.CheckCall(T.undefined(), T.NewObject("({x:23})"), T.Val(1)); | 446 T.CheckCall(T.undefined(), T.NewObject("({x:23})"), T.Val(1)); |
| 447 T.CheckCall(T.Val(2), T.NewObject("({y:23})"), T.Val(2)); | 447 T.CheckCall(T.Val(2), T.NewObject("({y:23})"), T.Val(2)); |
| 448 T.CheckCall(T.Val(23), T.NewObject("({b:23})"), T.Val(3)); | 448 T.CheckCall(T.Val(23), T.NewObject("({b:23})"), T.Val(3)); |
| 449 T.CheckCall(T.undefined(), T.NewObject("({__proto__:{x:42}})"), T.Val(4)); | 449 T.CheckCall(T.undefined(), T.NewObject("({__proto__:{x:42}})"), T.Val(4)); |
| 450 } | 450 } |
| 451 | 451 |
| 452 | 452 |
| 453 TEST(BlockLoadStore) { | 453 TEST(BlockLoadStore) { |
| 454 FLAG_harmony_scoping = true; | |
| 455 FunctionTester T("(function(a) { 'use strict'; { let x = a+a; return x; }})"); | 454 FunctionTester T("(function(a) { 'use strict'; { let x = a+a; return x; }})"); |
| 456 | 455 |
| 457 T.CheckCall(T.Val(46), T.Val(23)); | 456 T.CheckCall(T.Val(46), T.Val(23)); |
| 458 T.CheckCall(T.Val("aa"), T.Val("a")); | 457 T.CheckCall(T.Val("aa"), T.Val("a")); |
| 459 } | 458 } |
| 460 | 459 |
| 461 | 460 |
| 462 TEST(BlockLoadStoreNested) { | 461 TEST(BlockLoadStoreNested) { |
| 463 FLAG_harmony_scoping = true; | |
| 464 const char* src = | 462 const char* src = |
| 465 "(function(a,b) {" | 463 "(function(a,b) {" |
| 466 "'use strict';" | 464 "'use strict';" |
| 467 "{ let x = a, y = a;" | 465 "{ let x = a, y = a;" |
| 468 " { let y = b;" | 466 " { let y = b;" |
| 469 " return x + y;" | 467 " return x + y;" |
| 470 " }" | 468 " }" |
| 471 "}})"; | 469 "}})"; |
| 472 FunctionTester T(src); | 470 FunctionTester T(src); |
| 473 | 471 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 " get z() { return 0; }" | 534 " get z() { return 0; }" |
| 537 " constructor() {}" | 535 " constructor() {}" |
| 538 " }" | 536 " }" |
| 539 " return new C().x() + C.y();" | 537 " return new C().x() + C.y();" |
| 540 "})"; | 538 "})"; |
| 541 FunctionTester T(src); | 539 FunctionTester T(src); |
| 542 | 540 |
| 543 T.CheckCall(T.Val(65), T.Val(23), T.Val(42)); | 541 T.CheckCall(T.Val(65), T.Val(23), T.Val(42)); |
| 544 T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b")); | 542 T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b")); |
| 545 } | 543 } |
| OLD | NEW |