| 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"
|
|
|