Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: runtime/vm/isolate_reload_test.cc

Issue 2253733002: Fix handle sharing bug in implementation of shape changes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/isolate_reload.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_tools_api.h" 6 #include "include/dart_tools_api.h"
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/lockers.h" 10 #include "vm/lockers.h"
(...skipping 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after
2769 EXPECT_VALID(lib); 2769 EXPECT_VALID(lib);
2770 2770
2771 const char* kReloadScript = 2771 const char* kReloadScript =
2772 "class Foo<A> {\n" 2772 "class Foo<A> {\n"
2773 " var a;\n" 2773 " var a;\n"
2774 "}\n"; 2774 "}\n";
2775 lib = TestCase::ReloadTestScript(kReloadScript); 2775 lib = TestCase::ReloadTestScript(kReloadScript);
2776 EXPECT_VALID(lib); 2776 EXPECT_VALID(lib);
2777 } 2777 }
2778 2778
2779
2780 // Regression for handle sharing bug: Change the shape of two classes and see
2781 // that their instances don't change class.
2782 TEST_CASE(IsolateReload_ChangeInstanceFormat8) {
2783 const char* kScript =
2784 "class A{\n"
2785 " var x;\n"
2786 "}\n"
2787 "class B {\n"
2788 " var x, y, z, w;\n"
2789 "}\n"
2790 "var a, b;\n"
2791 "main() {\n"
2792 " a = new A();\n"
2793 " b = new B();\n"
2794 " return '$a $b';\n"
2795 "}\n";
2796
2797 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2798 EXPECT_VALID(lib);
2799 EXPECT_STREQ("Instance of 'A' Instance of 'B'", SimpleInvokeStr(lib, "main"));
2800
2801 const char* kReloadScript =
2802 "class A{\n"
2803 " var x, y;\n"
2804 "}\n"
2805 "class B {\n"
2806 " var x, y, z, w, v;\n"
2807 "}\n"
2808 "var a, b;\n"
2809 "main() {\n"
2810 " return '$a $b';\n"
2811 "}\n";
2812
2813 lib = TestCase::ReloadTestScript(kReloadScript);
2814 EXPECT_VALID(lib);
2815 EXPECT_STREQ("Instance of 'A' Instance of 'B'", SimpleInvokeStr(lib, "main"));
2816 }
2817
2818
2779 static bool NothingModifiedCallback(const char* url, int64_t since) { 2819 static bool NothingModifiedCallback(const char* url, int64_t since) {
2780 return false; 2820 return false;
2781 } 2821 }
2782 2822
2783 2823
2784 TEST_CASE(IsolateReload_NoLibsModified) { 2824 TEST_CASE(IsolateReload_NoLibsModified) {
2785 const char* kImportScript = 2825 const char* kImportScript =
2786 "importedFunc() => 'fancy';"; 2826 "importedFunc() => 'fancy';";
2787 TestCase::AddTestLib("test:lib1", kImportScript); 2827 TestCase::AddTestLib("test:lib1", kImportScript);
2788 2828
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2980 EXPECT_VALID(lib); 3020 EXPECT_VALID(lib);
2981 Dart_SetFileModifiedCallback(NULL); 3021 Dart_SetFileModifiedCallback(NULL);
2982 3022
2983 // Modification of an exported library propagates. 3023 // Modification of an exported library propagates.
2984 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main")); 3024 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main"));
2985 } 3025 }
2986 3026
2987 #endif // !PRODUCT 3027 #endif // !PRODUCT
2988 3028
2989 } // namespace dart 3029 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate_reload.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698