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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 if (tag == Dart_kCanonicalizeUrl) { | 139 if (tag == Dart_kCanonicalizeUrl) { |
140 return url; | 140 return url; |
141 } | 141 } |
142 return Api::Success(); | 142 return Api::Success(); |
143 } | 143 } |
144 | 144 |
145 | 145 |
146 void AssemblerTest::Assemble() { | 146 void AssemblerTest::Assemble() { |
147 const String& function_name = String::ZoneHandle(Symbols::New(name_)); | 147 const String& function_name = String::ZoneHandle(Symbols::New(name_)); |
148 const Class& cls = Class::ZoneHandle( | 148 const Class& cls = Class::ZoneHandle( |
149 Class::New(function_name, Script::Handle(), Scanner::kDummyTokenIndex)); | 149 Class::New(function_name, Script::Handle(), Scanner::kDummyTokenIndex)); |
| 150 const Library& lib = Library::ZoneHandle(Library::New(function_name)); |
| 151 cls.set_library(lib); |
150 Function& function = Function::ZoneHandle( | 152 Function& function = Function::ZoneHandle( |
151 Function::New(function_name, RawFunction::kRegularFunction, | 153 Function::New(function_name, RawFunction::kRegularFunction, |
152 true, false, false, false, cls, 0)); | 154 true, false, false, false, cls, 0)); |
153 code_ = Code::FinalizeCode(function, assembler_); | 155 code_ = Code::FinalizeCode(function, assembler_); |
154 if (FLAG_disassemble) { | 156 if (FLAG_disassemble) { |
155 OS::Print("Code for test '%s' {\n", name_); | 157 OS::Print("Code for test '%s' {\n", name_); |
156 const Instructions& instructions = | 158 const Instructions& instructions = |
157 Instructions::Handle(code_.instructions()); | 159 Instructions::Handle(code_.instructions()); |
158 uword start = instructions.EntryPoint(); | 160 uword start = instructions.EntryPoint(); |
159 Disassembler::Disassemble(start, start + assembler_->CodeSize()); | 161 Disassembler::Disassemble(start, start + assembler_->CodeSize()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 227 |
226 bool CompilerTest::TestCompileFunction(const Function& function) { | 228 bool CompilerTest::TestCompileFunction(const Function& function) { |
227 Isolate* isolate = Isolate::Current(); | 229 Isolate* isolate = Isolate::Current(); |
228 ASSERT(isolate != NULL); | 230 ASSERT(isolate != NULL); |
229 ASSERT(ClassFinalizer::AllClassesFinalized()); | 231 ASSERT(ClassFinalizer::AllClassesFinalized()); |
230 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 232 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
231 return error.IsNull(); | 233 return error.IsNull(); |
232 } | 234 } |
233 | 235 |
234 } // namespace dart | 236 } // namespace dart |
OLD | NEW |