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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Isolate::Current()->flags().set_checked(true); | 176 // Isolate::Current()->flags().set_checked(true); |
177 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 177 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
178 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 178 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
179 EXPECT_VALID(result); | 179 EXPECT_VALID(result); |
180 RawLibrary* raw_library = Library::RawCast(Api::UnwrapHandle(lib)); | 180 RawLibrary* raw_library = Library::RawCast(Api::UnwrapHandle(lib)); |
181 Library& lib_handle = Library::ZoneHandle(raw_library); | 181 Library& lib_handle = Library::ZoneHandle(raw_library); |
182 Class& cls = Class::Handle( | 182 Class& cls = Class::Handle( |
183 lib_handle.LookupClass(String::Handle(Symbols::New("A")))); | 183 lib_handle.LookupClass(String::Handle(Symbols::New("A")))); |
184 EXPECT(!cls.IsNull()); | 184 EXPECT(!cls.IsNull()); |
185 | 185 |
186 Isolate* isolate = Isolate::Current(); | 186 Zone* zone = thread->zone(); |
187 const Code& stub = Code::Handle(isolate, | 187 const Code& stub = Code::Handle(zone, |
188 StubCode::GetAllocationStubForClass(cls)); | 188 StubCode::GetAllocationStubForClass(cls)); |
189 Class& owner = Class::Handle(); | 189 Class& owner = Class::Handle(); |
190 owner ^= stub.owner(); | 190 owner ^= stub.owner(); |
191 owner.DisableAllocationStub(); | 191 owner.DisableAllocationStub(); |
192 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 192 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
193 EXPECT_VALID(result); | 193 EXPECT_VALID(result); |
194 | 194 |
195 owner.DisableAllocationStub(); | 195 owner.DisableAllocationStub(); |
196 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 196 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
197 EXPECT_VALID(result); | 197 EXPECT_VALID(result); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 EXPECT(val.IsInteger()); | 271 EXPECT(val.IsInteger()); |
272 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); | 272 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); |
273 | 273 |
274 intptr_t final_class_table_size = | 274 intptr_t final_class_table_size = |
275 Isolate::Current()->class_table()->NumCids(); | 275 Isolate::Current()->class_table()->NumCids(); |
276 // Eval should not eat into this non-renewable resource. | 276 // Eval should not eat into this non-renewable resource. |
277 EXPECT_EQ(initial_class_table_size, final_class_table_size); | 277 EXPECT_EQ(initial_class_table_size, final_class_table_size); |
278 } | 278 } |
279 | 279 |
280 } // namespace dart | 280 } // namespace dart |
OLD | NEW |