| OLD | NEW |
| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 function_name, | 353 function_name, |
| 354 script, | 354 script, |
| 355 TokenPosition::kMinSource)); | 355 TokenPosition::kMinSource)); |
| 356 Function& function = Function::ZoneHandle( | 356 Function& function = Function::ZoneHandle( |
| 357 Function::New(function_name, RawFunction::kRegularFunction, | 357 Function::New(function_name, RawFunction::kRegularFunction, |
| 358 true, false, false, false, false, cls, | 358 true, false, false, false, false, cls, |
| 359 TokenPosition::kMinSource)); | 359 TokenPosition::kMinSource)); |
| 360 code_ = Code::FinalizeCode(function, assembler_); | 360 code_ = Code::FinalizeCode(function, assembler_); |
| 361 code_.set_owner(function); | 361 code_.set_owner(function); |
| 362 code_.set_exception_handlers(Object::empty_exception_handlers()); | 362 code_.set_exception_handlers(Object::empty_exception_handlers()); |
| 363 #ifndef PRODUCT |
| 363 if (FLAG_disassemble) { | 364 if (FLAG_disassemble) { |
| 364 OS::Print("Code for test '%s' {\n", name_); | 365 OS::Print("Code for test '%s' {\n", name_); |
| 365 const Instructions& instructions = | 366 const Instructions& instructions = |
| 366 Instructions::Handle(code_.instructions()); | 367 Instructions::Handle(code_.instructions()); |
| 367 uword start = instructions.EntryPoint(); | 368 uword start = instructions.EntryPoint(); |
| 368 Disassembler::Disassemble(start, start + assembler_->CodeSize()); | 369 Disassembler::Disassemble(start, start + assembler_->CodeSize()); |
| 369 OS::Print("}\n"); | 370 OS::Print("}\n"); |
| 370 } | 371 } |
| 372 #endif // !PRODUCT |
| 371 } | 373 } |
| 372 | 374 |
| 373 | 375 |
| 374 CodeGenTest::CodeGenTest(const char* name) | 376 CodeGenTest::CodeGenTest(const char* name) |
| 375 : function_(Function::ZoneHandle()), | 377 : function_(Function::ZoneHandle()), |
| 376 node_sequence_(new SequenceNode(TokenPosition::kMinSource, | 378 node_sequence_(new SequenceNode(TokenPosition::kMinSource, |
| 377 new LocalScope(NULL, 0, 0))), | 379 new LocalScope(NULL, 0, 0))), |
| 378 default_parameter_values_(new ZoneGrowableArray<const Instance*> ()) { | 380 default_parameter_values_(new ZoneGrowableArray<const Instance*> ()) { |
| 379 ASSERT(name != NULL); | 381 ASSERT(name != NULL); |
| 380 const String& function_name = String::ZoneHandle( | 382 const String& function_name = String::ZoneHandle( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 } | 453 } |
| 452 // Copy the remainder of in to out. | 454 // Copy the remainder of in to out. |
| 453 while (*in != '\0') { | 455 while (*in != '\0') { |
| 454 *out++ = *in++; | 456 *out++ = *in++; |
| 455 } | 457 } |
| 456 *out = '\0'; | 458 *out = '\0'; |
| 457 } | 459 } |
| 458 | 460 |
| 459 | 461 |
| 460 } // namespace dart | 462 } // namespace dart |
| OLD | NEW |