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

Unified Diff: runtime/vm/compiler_test.cc

Issue 557913002: Allow invalidation and recompilation of instance allocation stubs. Requested in order to implement… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler_test.cc
===================================================================
--- runtime/vm/compiler_test.cc (revision 40156)
+++ runtime/vm/compiler_test.cc (working copy)
@@ -4,6 +4,7 @@
#include "platform/assert.h"
#include "vm/class_finalizer.h"
+#include "vm/code_patcher.h"
#include "vm/compiler.h"
#include "vm/dart_api_impl.h"
#include "vm/object.h"
@@ -68,6 +69,37 @@
}
+TEST_CASE(RegenerateAllocStubs) {
+ const char* kScriptChars =
+ "class A {\n"
+ "}\n"
+ "unOpt() => new A(); \n"
+ "optIt() => new A(); \n"
+ "main() {\n"
+ " return unOpt();\n"
+ "}\n";
+
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+ Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
+ EXPECT_VALID(result);
+ RawLibrary* raw_library = Library::RawCast(Api::UnwrapHandle(lib));
+ Library& lib_handle = Library::ZoneHandle(raw_library);
+ Class& cls = Class::Handle(
+ lib_handle.LookupClass(String::Handle(Symbols::New("A"))));
+ EXPECT(!cls.IsNull());
+
+ Isolate* isolate = Isolate::Current();
+ StubCode* stub_code = isolate->stub_code();
+ const Code& stub = Code::Handle(isolate,
+ stub_code->GetAllocationStubForClass(cls));
+ Class& owner = Class::Handle();
+ owner ^= stub.owner();
+ owner.DisableAllocationStub();
+ result = Dart_Invoke(lib, NewString("main"), 0, NULL);
+ EXPECT_VALID(result);
+}
+
+
TEST_CASE(EvalExpression) {
const char* kScriptChars =
"int ten = 2 * 5; \n"
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698