OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 OS::Print("Code for function '%s' {\n", function_fullname); | 168 OS::Print("Code for function '%s' {\n", function_fullname); |
169 const Instructions& instructions = | 169 const Instructions& instructions = |
170 Instructions::Handle(code.instructions()); | 170 Instructions::Handle(code.instructions()); |
171 uword start = instructions.EntryPoint(); | 171 uword start = instructions.EntryPoint(); |
172 Disassembler::Disassemble(start, start + assembler.CodeSize()); | 172 Disassembler::Disassemble(start, start + assembler.CodeSize()); |
173 OS::Print("}\n"); | 173 OS::Print("}\n"); |
174 } | 174 } |
175 function_.SetCode(code); | 175 function_.SetCode(code); |
176 CodeIndexTable* code_index_table = isolate->code_index_table(); | 176 CodeIndexTable* code_index_table = isolate->code_index_table(); |
177 ASSERT(code_index_table != NULL); | 177 ASSERT(code_index_table != NULL); |
178 code_index_table->AddFunction(function_); | 178 code_index_table->AddCode(code); |
179 retval = true; | 179 retval = true; |
180 } else { | 180 } else { |
181 retval = false; | 181 retval = false; |
182 } | 182 } |
183 EXPECT(retval); | 183 EXPECT(retval); |
184 isolate->set_long_jump_base(base); | 184 isolate->set_long_jump_base(base); |
185 } | 185 } |
186 | 186 |
187 | 187 |
188 bool CompilerTest::TestCompileScript(const Library& library, | 188 bool CompilerTest::TestCompileScript(const Library& library, |
189 const Script& script) { | 189 const Script& script) { |
190 Isolate* isolate = Isolate::Current(); | 190 Isolate* isolate = Isolate::Current(); |
191 ASSERT(isolate != NULL); | 191 ASSERT(isolate != NULL); |
192 const Error& error = Error::Handle(Compiler::Compile(library, script)); | 192 const Error& error = Error::Handle(Compiler::Compile(library, script)); |
193 return error.IsNull(); | 193 return error.IsNull(); |
194 } | 194 } |
195 | 195 |
196 | 196 |
197 bool CompilerTest::TestCompileFunction(const Function& function) { | 197 bool CompilerTest::TestCompileFunction(const Function& function) { |
198 Isolate* isolate = Isolate::Current(); | 198 Isolate* isolate = Isolate::Current(); |
199 ASSERT(isolate != NULL); | 199 ASSERT(isolate != NULL); |
200 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 200 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
201 return error.IsNull(); | 201 return error.IsNull(); |
202 } | 202 } |
203 | 203 |
204 } // namespace dart | 204 } // namespace dart |
OLD | NEW |