| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 #include "bin/builtin.h" | 9 #include "bin/builtin.h" |
| 10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 Dart_Handle TestCase::library_handler(Dart_LibraryTag tag, | 127 Dart_Handle TestCase::library_handler(Dart_LibraryTag tag, |
| 128 Dart_Handle library, | 128 Dart_Handle library, |
| 129 Dart_Handle url) { | 129 Dart_Handle url) { |
| 130 if (tag == kCanonicalizeUrl) { | 130 if (tag == kCanonicalizeUrl) { |
| 131 return url; | 131 return url; |
| 132 } | 132 } |
| 133 return Api::Success(Isolate::Current()); | 133 return Api::Success(Isolate::Current()); |
| 134 } | 134 } |
| 135 | 135 |
| 136 | 136 |
| 137 uword AssemblerTest::Assemble() { | 137 void AssemblerTest::Assemble() { |
| 138 const String& function_name = String::ZoneHandle(Symbols::New(name_)); | 138 const String& function_name = String::ZoneHandle(Symbols::New(name_)); |
| 139 const Class& cls = Class::ZoneHandle( | 139 const Class& cls = Class::ZoneHandle( |
| 140 Class::New(function_name, Script::Handle(), Scanner::kDummyTokenIndex)); | 140 Class::New(function_name, Script::Handle(), Scanner::kDummyTokenIndex)); |
| 141 Function& function = Function::ZoneHandle( | 141 Function& function = Function::ZoneHandle( |
| 142 Function::New(function_name, RawFunction::kRegularFunction, | 142 Function::New(function_name, RawFunction::kRegularFunction, |
| 143 true, false, false, false, cls, 0)); | 143 true, false, false, false, cls, 0)); |
| 144 const Code& code = Code::Handle(Code::FinalizeCode(function, assembler_)); | 144 code_ = Code::FinalizeCode(function, assembler_); |
| 145 if (FLAG_disassemble) { | 145 if (FLAG_disassemble) { |
| 146 OS::Print("Code for test '%s' {\n", name_); | 146 OS::Print("Code for test '%s' {\n", name_); |
| 147 const Instructions& instructions = | 147 const Instructions& instructions = |
| 148 Instructions::Handle(code.instructions()); | 148 Instructions::Handle(code_.instructions()); |
| 149 uword start = instructions.EntryPoint(); | 149 uword start = instructions.EntryPoint(); |
| 150 Disassembler::Disassemble(start, start + assembler_->CodeSize()); | 150 Disassembler::Disassemble(start, start + assembler_->CodeSize()); |
| 151 OS::Print("}\n"); | 151 OS::Print("}\n"); |
| 152 } | 152 } |
| 153 const Instructions& instructions = Instructions::Handle(code.instructions()); | 153 const Instructions& instructions = Instructions::Handle(code_.instructions()); |
| 154 return instructions.EntryPoint(); | 154 entry_ = instructions.EntryPoint(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 | 157 |
| 158 CodeGenTest::CodeGenTest(const char* name) | 158 CodeGenTest::CodeGenTest(const char* name) |
| 159 : function_(Function::ZoneHandle()), | 159 : function_(Function::ZoneHandle()), |
| 160 node_sequence_(new SequenceNode(Scanner::kDummyTokenIndex, | 160 node_sequence_(new SequenceNode(Scanner::kDummyTokenIndex, |
| 161 new LocalScope(NULL, 0, 0))), | 161 new LocalScope(NULL, 0, 0))), |
| 162 default_parameter_values_(Array::ZoneHandle()) { | 162 default_parameter_values_(Array::ZoneHandle()) { |
| 163 ASSERT(name != NULL); | 163 ASSERT(name != NULL); |
| 164 const String& function_name = String::ZoneHandle(Symbols::New(name)); | 164 const String& function_name = String::ZoneHandle(Symbols::New(name)); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 bool CompilerTest::TestCompileFunction(const Function& function) { | 218 bool CompilerTest::TestCompileFunction(const Function& function) { |
| 219 Isolate* isolate = Isolate::Current(); | 219 Isolate* isolate = Isolate::Current(); |
| 220 ASSERT(isolate != NULL); | 220 ASSERT(isolate != NULL); |
| 221 ASSERT(ClassFinalizer::AllClassesFinalized()); | 221 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 222 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 222 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
| 223 return error.IsNull(); | 223 return error.IsNull(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 } // namespace dart | 226 } // namespace dart |
| OLD | NEW |