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

Side by Side 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, 7 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
« no previous file with comments | « runtime/vm/unit_test.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "vm/unit_test.h" 5 #include "vm/unit_test.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 204
205 char* TestCase::BigintToHexValue(Dart_CObject* bigint) { 205 char* TestCase::BigintToHexValue(Dart_CObject* bigint) {
206 return bin::CObject::BigintToHexValue(bigint); 206 return bin::CObject::BigintToHexValue(bigint);
207 } 207 }
208 208
209 209
210 void AssemblerTest::Assemble() { 210 void AssemblerTest::Assemble() {
211 const String& function_name = String::ZoneHandle( 211 const String& function_name = String::ZoneHandle(
212 Symbols::New(Thread::Current(), name_)); 212 Symbols::New(Thread::Current(), name_));
213
214 // We make a dummy script so that exception objects can be composed for
215 // assembler instructions that do runtime calls, in particular on DBC.
216 const char* kDummyScript = "assembler_test_dummy_function() {}";
217 const Script& script = Script::Handle(Script::New(
218 function_name,
219 String::Handle(String::New(kDummyScript)),
220 RawScript::kSourceTag));
221 script.Tokenize(String::Handle());
222
213 const Class& cls = Class::ZoneHandle( 223 const Class& cls = Class::ZoneHandle(
214 Class::New(function_name, 224 Class::New(function_name,
215 Script::Handle(), 225 script,
216 TokenPosition::kMinSource)); 226 TokenPosition::kMinSource));
217 const Library& lib = Library::ZoneHandle(Library::New(function_name)); 227 const Library& lib = Library::ZoneHandle(Library::New(function_name));
218 cls.set_library(lib); 228 cls.set_library(lib);
219 Function& function = Function::ZoneHandle( 229 Function& function = Function::ZoneHandle(
220 Function::New(function_name, RawFunction::kRegularFunction, 230 Function::New(function_name, RawFunction::kRegularFunction,
221 true, false, false, false, false, cls, 231 true, false, false, false, false, cls,
222 TokenPosition::kMinSource)); 232 TokenPosition::kMinSource));
223 code_ = Code::FinalizeCode(function, assembler_); 233 code_ = Code::FinalizeCode(function, assembler_);
234 code_.set_owner(function);
235 code_.set_exception_handlers(Object::empty_exception_handlers());
224 if (FLAG_disassemble) { 236 if (FLAG_disassemble) {
225 OS::Print("Code for test '%s' {\n", name_); 237 OS::Print("Code for test '%s' {\n", name_);
226 const Instructions& instructions = 238 const Instructions& instructions =
227 Instructions::Handle(code_.instructions()); 239 Instructions::Handle(code_.instructions());
228 uword start = instructions.EntryPoint(); 240 uword start = instructions.EntryPoint();
229 Disassembler::Disassemble(start, start + assembler_->CodeSize()); 241 Disassembler::Disassemble(start, start + assembler_->CodeSize());
230 OS::Print("}\n"); 242 OS::Print("}\n");
231 } 243 }
232 } 244 }
233 245
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 324 }
313 // Copy the remainder of in to out. 325 // Copy the remainder of in to out.
314 while (*in != '\0') { 326 while (*in != '\0') {
315 *out++ = *in++; 327 *out++ = *in++;
316 } 328 }
317 *out = '\0'; 329 *out = '\0';
318 } 330 }
319 331
320 332
321 } // namespace dart 333 } // namespace dart
OLDNEW
« 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