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

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

Issue 1247783002: Make array allocation stub shared between isolates. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 83 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
84 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); 84 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
85 EXPECT_VALID(result); 85 EXPECT_VALID(result);
86 RawLibrary* raw_library = Library::RawCast(Api::UnwrapHandle(lib)); 86 RawLibrary* raw_library = Library::RawCast(Api::UnwrapHandle(lib));
87 Library& lib_handle = Library::ZoneHandle(raw_library); 87 Library& lib_handle = Library::ZoneHandle(raw_library);
88 Class& cls = Class::Handle( 88 Class& cls = Class::Handle(
89 lib_handle.LookupClass(String::Handle(Symbols::New("A")))); 89 lib_handle.LookupClass(String::Handle(Symbols::New("A"))));
90 EXPECT(!cls.IsNull()); 90 EXPECT(!cls.IsNull());
91 91
92 Isolate* isolate = Isolate::Current(); 92 Isolate* isolate = Isolate::Current();
93 StubCode* stub_code = isolate->stub_code();
94 const Code& stub = Code::Handle(isolate, 93 const Code& stub = Code::Handle(isolate,
95 stub_code->GetAllocationStubForClass(cls)); 94 StubCode::GetAllocationStubForClass(cls));
96 Class& owner = Class::Handle(); 95 Class& owner = Class::Handle();
97 owner ^= stub.owner(); 96 owner ^= stub.owner();
98 owner.DisableAllocationStub(); 97 owner.DisableAllocationStub();
99 result = Dart_Invoke(lib, NewString("main"), 0, NULL); 98 result = Dart_Invoke(lib, NewString("main"), 0, NULL);
100 EXPECT_VALID(result); 99 EXPECT_VALID(result);
101 100
102 owner.DisableAllocationStub(); 101 owner.DisableAllocationStub();
103 result = Dart_Invoke(lib, NewString("main"), 0, NULL); 102 result = Dart_Invoke(lib, NewString("main"), 0, NULL);
104 EXPECT_VALID(result); 103 EXPECT_VALID(result);
105 104
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 EXPECT(val.IsInteger()); 177 EXPECT(val.IsInteger());
179 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); 178 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value());
180 179
181 intptr_t final_class_table_size = 180 intptr_t final_class_table_size =
182 Isolate::Current()->class_table()->NumCids(); 181 Isolate::Current()->class_table()->NumCids();
183 // Eval should not eat into this non-renewable resource. 182 // Eval should not eat into this non-renewable resource.
184 EXPECT_EQ(initial_class_table_size, final_class_table_size); 183 EXPECT_EQ(initial_class_table_size, final_class_table_size);
185 } 184 }
186 185
187 } // namespace dart 186 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698