OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/class_finalizer.h" | 6 #include "vm/class_finalizer.h" |
7 #include "vm/code_patcher.h" | 7 #include "vm/code_patcher.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 #endif | 102 #endif |
103 BackgroundCompiler::EnsureInit(thread); | 103 BackgroundCompiler::EnsureInit(thread); |
104 Isolate* isolate = thread->isolate(); | 104 Isolate* isolate = thread->isolate(); |
105 ASSERT(isolate->background_compiler() != NULL); | 105 ASSERT(isolate->background_compiler() != NULL); |
106 isolate->background_compiler()->CompileOptimized(func); | 106 isolate->background_compiler()->CompileOptimized(func); |
107 Monitor* m = new Monitor(); | 107 Monitor* m = new Monitor(); |
108 MonitorLocker ml(m); | 108 MonitorLocker ml(m); |
109 while (!func.HasOptimizedCode()) { | 109 while (!func.HasOptimizedCode()) { |
110 ml.WaitWithSafepointCheck(thread, 1); | 110 ml.WaitWithSafepointCheck(thread, 1); |
111 } | 111 } |
112 BackgroundCompiler::Stop(isolate->background_compiler()); | 112 BackgroundCompiler::Stop(isolate); |
113 } | 113 } |
114 | 114 |
115 | 115 |
116 TEST_CASE(RegenerateAllocStubs) { | 116 TEST_CASE(RegenerateAllocStubs) { |
117 const char* kScriptChars = | 117 const char* kScriptChars = |
118 "class A {\n" | 118 "class A {\n" |
119 "}\n" | 119 "}\n" |
120 "unOpt() => new A(); \n" | 120 "unOpt() => new A(); \n" |
121 "optIt() => new A(); \n" | 121 "optIt() => new A(); \n" |
122 "A main() {\n" | 122 "A main() {\n" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 EXPECT(val.IsInteger()); | 223 EXPECT(val.IsInteger()); |
224 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); | 224 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); |
225 | 225 |
226 intptr_t final_class_table_size = | 226 intptr_t final_class_table_size = |
227 Isolate::Current()->class_table()->NumCids(); | 227 Isolate::Current()->class_table()->NumCids(); |
228 // Eval should not eat into this non-renewable resource. | 228 // Eval should not eat into this non-renewable resource. |
229 EXPECT_EQ(initial_class_table_size, final_class_table_size); | 229 EXPECT_EQ(initial_class_table_size, final_class_table_size); |
230 } | 230 } |
231 | 231 |
232 } // namespace dart | 232 } // namespace dart |
OLD | NEW |