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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 return Api::Success(); | 201 return Api::Success(); |
202 } | 202 } |
203 | 203 |
204 | 204 |
205 char* TestCase::BigintToHexValue(Dart_CObject* bigint) { | 205 char* TestCase::BigintToHexValue(Dart_CObject* bigint) { |
206 return bin::CObject::BigintToHexValue(bigint); | 206 return bin::CObject::BigintToHexValue(bigint); |
207 } | 207 } |
208 | 208 |
209 | 209 |
210 void AssemblerTest::Assemble() { | 210 void AssemblerTest::Assemble() { |
211 const String& function_name = String::ZoneHandle(Symbols::New(name_)); | 211 const String& function_name = String::ZoneHandle( |
| 212 Symbols::New(Thread::Current(), name_)); |
212 const Class& cls = Class::ZoneHandle( | 213 const Class& cls = Class::ZoneHandle( |
213 Class::New(function_name, | 214 Class::New(function_name, |
214 Script::Handle(), | 215 Script::Handle(), |
215 TokenPosition::kMinSource)); | 216 TokenPosition::kMinSource)); |
216 const Library& lib = Library::ZoneHandle(Library::New(function_name)); | 217 const Library& lib = Library::ZoneHandle(Library::New(function_name)); |
217 cls.set_library(lib); | 218 cls.set_library(lib); |
218 Function& function = Function::ZoneHandle( | 219 Function& function = Function::ZoneHandle( |
219 Function::New(function_name, RawFunction::kRegularFunction, | 220 Function::New(function_name, RawFunction::kRegularFunction, |
220 true, false, false, false, false, cls, | 221 true, false, false, false, false, cls, |
221 TokenPosition::kMinSource)); | 222 TokenPosition::kMinSource)); |
222 code_ = Code::FinalizeCode(function, assembler_); | 223 code_ = Code::FinalizeCode(function, assembler_); |
223 if (FLAG_disassemble) { | 224 if (FLAG_disassemble) { |
224 OS::Print("Code for test '%s' {\n", name_); | 225 OS::Print("Code for test '%s' {\n", name_); |
225 const Instructions& instructions = | 226 const Instructions& instructions = |
226 Instructions::Handle(code_.instructions()); | 227 Instructions::Handle(code_.instructions()); |
227 uword start = instructions.EntryPoint(); | 228 uword start = instructions.EntryPoint(); |
228 Disassembler::Disassemble(start, start + assembler_->CodeSize()); | 229 Disassembler::Disassemble(start, start + assembler_->CodeSize()); |
229 OS::Print("}\n"); | 230 OS::Print("}\n"); |
230 } | 231 } |
231 } | 232 } |
232 | 233 |
233 | 234 |
234 CodeGenTest::CodeGenTest(const char* name) | 235 CodeGenTest::CodeGenTest(const char* name) |
235 : function_(Function::ZoneHandle()), | 236 : function_(Function::ZoneHandle()), |
236 node_sequence_(new SequenceNode(TokenPosition::kMinSource, | 237 node_sequence_(new SequenceNode(TokenPosition::kMinSource, |
237 new LocalScope(NULL, 0, 0))), | 238 new LocalScope(NULL, 0, 0))), |
238 default_parameter_values_(new ZoneGrowableArray<const Instance*> ()) { | 239 default_parameter_values_(new ZoneGrowableArray<const Instance*> ()) { |
239 ASSERT(name != NULL); | 240 ASSERT(name != NULL); |
240 const String& function_name = String::ZoneHandle(Symbols::New(name)); | 241 const String& function_name = String::ZoneHandle( |
| 242 Symbols::New(Thread::Current(), name)); |
241 // Add function to a class and that class to the class dictionary so that | 243 // Add function to a class and that class to the class dictionary so that |
242 // frame walking can be used. | 244 // frame walking can be used. |
243 const Class& cls = Class::ZoneHandle( | 245 const Class& cls = Class::ZoneHandle( |
244 Class::New(function_name, Script::Handle(), | 246 Class::New(function_name, Script::Handle(), |
245 TokenPosition::kMinSource)); | 247 TokenPosition::kMinSource)); |
246 function_ = Function::New( | 248 function_ = Function::New( |
247 function_name, RawFunction::kRegularFunction, | 249 function_name, RawFunction::kRegularFunction, |
248 true, false, false, false, false, cls, TokenPosition::kMinSource); | 250 true, false, false, false, false, cls, TokenPosition::kMinSource); |
249 function_.set_result_type(Type::Handle(Type::DynamicType())); | 251 function_.set_result_type(Type::Handle(Type::DynamicType())); |
250 const Array& functions = Array::Handle(Array::New(1)); | 252 const Array& functions = Array::Handle(Array::New(1)); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 312 } |
311 // Copy the remainder of in to out. | 313 // Copy the remainder of in to out. |
312 while (*in != '\0') { | 314 while (*in != '\0') { |
313 *out++ = *in++; | 315 *out++ = *in++; |
314 } | 316 } |
315 *out = '\0'; | 317 *out = '\0'; |
316 } | 318 } |
317 | 319 |
318 | 320 |
319 } // namespace dart | 321 } // namespace dart |
OLD | NEW |