| 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" |
| 11 | 11 |
| 12 #include "platform/globals.h" | 12 #include "platform/globals.h" |
| 13 #include "vm/assembler.h" | 13 #include "vm/assembler.h" |
| 14 #include "vm/ast_printer.h" | 14 #include "vm/ast_printer.h" |
| 15 #include "vm/compiler.h" | 15 #include "vm/compiler.h" |
| 16 #include "vm/dart_api_impl.h" | 16 #include "vm/dart_api_impl.h" |
| 17 #include "vm/disassembler.h" | 17 #include "vm/disassembler.h" |
| 18 #include "vm/parser.h" | 18 #include "vm/parser.h" |
| 19 #include "vm/symbols.h" | 19 #include "vm/symbols.h" |
| 20 #include "vm/thread.h" |
| 20 #include "vm/virtual_memory.h" | 21 #include "vm/virtual_memory.h" |
| 21 | 22 |
| 22 using dart::bin::Builtin; | 23 using dart::bin::Builtin; |
| 23 using dart::bin::DartUtils; | 24 using dart::bin::DartUtils; |
| 24 | 25 |
| 25 namespace dart { | 26 namespace dart { |
| 26 | 27 |
| 27 DECLARE_FLAG(bool, disassemble); | 28 DECLARE_FLAG(bool, disassemble); |
| 28 | 29 |
| 29 TestCaseBase* TestCaseBase::first_ = NULL; | 30 TestCaseBase* TestCaseBase::first_ = NULL; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 functions.SetAt(0, function_); | 239 functions.SetAt(0, function_); |
| 239 cls.SetFunctions(functions); | 240 cls.SetFunctions(functions); |
| 240 Library& lib = Library::Handle(Library::CoreLibrary()); | 241 Library& lib = Library::Handle(Library::CoreLibrary()); |
| 241 lib.AddClass(cls); | 242 lib.AddClass(cls); |
| 242 } | 243 } |
| 243 | 244 |
| 244 | 245 |
| 245 void CodeGenTest::Compile() { | 246 void CodeGenTest::Compile() { |
| 246 if (function_.HasCode()) return; | 247 if (function_.HasCode()) return; |
| 247 ParsedFunction* parsed_function = | 248 ParsedFunction* parsed_function = |
| 248 new ParsedFunction(Isolate::Current(), function_); | 249 new ParsedFunction(Thread::Current(), function_); |
| 249 parsed_function->SetNodeSequence(node_sequence_); | 250 parsed_function->SetNodeSequence(node_sequence_); |
| 250 parsed_function->set_instantiator(NULL); | 251 parsed_function->set_instantiator(NULL); |
| 251 parsed_function->set_default_parameter_values(default_parameter_values_); | 252 parsed_function->set_default_parameter_values(default_parameter_values_); |
| 252 node_sequence_->scope()->AddVariable( | 253 node_sequence_->scope()->AddVariable( |
| 253 parsed_function->current_context_var()); | 254 parsed_function->current_context_var()); |
| 254 parsed_function->EnsureExpressionTemp(); | 255 parsed_function->EnsureExpressionTemp(); |
| 255 node_sequence_->scope()->AddVariable(parsed_function->expression_temp_var()); | 256 node_sequence_->scope()->AddVariable(parsed_function->expression_temp_var()); |
| 256 parsed_function->AllocateVariables(); | 257 parsed_function->AllocateVariables(); |
| 257 const Error& error = | 258 const Error& error = |
| 258 Error::Handle(Compiler::CompileParsedFunction(parsed_function)); | 259 Error::Handle(Compiler::CompileParsedFunction(parsed_function)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 277 Isolate* isolate = Isolate::Current(); | 278 Isolate* isolate = Isolate::Current(); |
| 278 ASSERT(isolate != NULL); | 279 ASSERT(isolate != NULL); |
| 279 ASSERT(ClassFinalizer::AllClassesFinalized()); | 280 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 280 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, | 281 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, |
| 281 function)); | 282 function)); |
| 282 return error.IsNull(); | 283 return error.IsNull(); |
| 283 } | 284 } |
| 284 | 285 |
| 285 | 286 |
| 286 } // namespace dart | 287 } // namespace dart |
| OLD | NEW |