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 url, | 127 Dart_Handle url, |
128 Dart_Handle import_map) { | 128 Dart_Handle import_map) { |
129 if (tag == kCanonicalizeUrl) { | 129 if (tag == kCanonicalizeUrl) { |
130 return url; | 130 return url; |
131 } | 131 } |
132 return Api::Success(Isolate::Current()); | 132 return Api::Success(Isolate::Current()); |
133 } | 133 } |
134 | 134 |
135 | 135 |
136 uword AssemblerTest::Assemble() { | 136 uword AssemblerTest::Assemble() { |
137 const Code& code = Code::Handle(Code::FinalizeCode(name_, assembler_)); | 137 const String& function_name = String::ZoneHandle(String::NewSymbol(name_)); |
| 138 Function& function = Function::ZoneHandle( |
| 139 Function::New(function_name, RawFunction::kFunction, true, false, 0)); |
| 140 const Code& code = Code::Handle(Code::FinalizeCode(function, assembler_)); |
138 if (FLAG_disassemble) { | 141 if (FLAG_disassemble) { |
139 OS::Print("Code for test '%s' {\n", name_); | 142 OS::Print("Code for test '%s' {\n", name_); |
140 const Instructions& instructions = | 143 const Instructions& instructions = |
141 Instructions::Handle(code.instructions()); | 144 Instructions::Handle(code.instructions()); |
142 uword start = instructions.EntryPoint(); | 145 uword start = instructions.EntryPoint(); |
143 Disassembler::Disassemble(start, start + assembler_->CodeSize()); | 146 Disassembler::Disassemble(start, start + assembler_->CodeSize()); |
144 OS::Print("}\n"); | 147 OS::Print("}\n"); |
145 } | 148 } |
146 const Instructions& instructions = Instructions::Handle(code.instructions()); | 149 const Instructions& instructions = Instructions::Handle(code.instructions()); |
147 return instructions.EntryPoint(); | 150 return instructions.EntryPoint(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 197 |
195 bool CompilerTest::TestCompileFunction(const Function& function) { | 198 bool CompilerTest::TestCompileFunction(const Function& function) { |
196 Isolate* isolate = Isolate::Current(); | 199 Isolate* isolate = Isolate::Current(); |
197 ASSERT(isolate != NULL); | 200 ASSERT(isolate != NULL); |
198 ASSERT(ClassFinalizer::AllClassesFinalized()); | 201 ASSERT(ClassFinalizer::AllClassesFinalized()); |
199 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 202 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
200 return error.IsNull(); | 203 return error.IsNull(); |
201 } | 204 } |
202 | 205 |
203 } // namespace dart | 206 } // namespace dart |
OLD | NEW |