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

Unified Diff: runtime/vm/unit_test.cc

Issue 1944503002: Adds more DBC assembler tests. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/unit_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/unit_test.cc
diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc
index 24064f0284c305d9bb0c1ee2c6fc3ea141efaf36..54352e5a350dbf8358c017a0837491d3882a39b8 100644
--- a/runtime/vm/unit_test.cc
+++ b/runtime/vm/unit_test.cc
@@ -210,9 +210,19 @@ char* TestCase::BigintToHexValue(Dart_CObject* bigint) {
void AssemblerTest::Assemble() {
const String& function_name = String::ZoneHandle(
Symbols::New(Thread::Current(), name_));
+
+ // We make a dummy script so that exception objects can be composed for
+ // assembler instructions that do runtime calls, in particular on DBC.
+ const char* kDummyScript = "assembler_test_dummy_function() {}";
+ const Script& script = Script::Handle(Script::New(
+ function_name,
+ String::Handle(String::New(kDummyScript)),
+ RawScript::kSourceTag));
+ script.Tokenize(String::Handle());
+
const Class& cls = Class::ZoneHandle(
Class::New(function_name,
- Script::Handle(),
+ script,
TokenPosition::kMinSource));
const Library& lib = Library::ZoneHandle(Library::New(function_name));
cls.set_library(lib);
@@ -221,6 +231,8 @@ void AssemblerTest::Assemble() {
true, false, false, false, false, cls,
TokenPosition::kMinSource));
code_ = Code::FinalizeCode(function, assembler_);
+ code_.set_owner(function);
+ code_.set_exception_handlers(Object::empty_exception_handlers());
if (FLAG_disassemble) {
OS::Print("Code for test '%s' {\n", name_);
const Instructions& instructions =
« no previous file with comments | « runtime/vm/unit_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698