| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 Instructions::Handle(code_.instructions()); | 162 Instructions::Handle(code_.instructions()); |
| 163 uword start = instructions.EntryPoint(); | 163 uword start = instructions.EntryPoint(); |
| 164 Disassembler::Disassemble(start, start + assembler_->CodeSize()); | 164 Disassembler::Disassemble(start, start + assembler_->CodeSize()); |
| 165 OS::Print("}\n"); | 165 OS::Print("}\n"); |
| 166 } | 166 } |
| 167 const Instructions& instructions = Instructions::Handle(code_.instructions()); | 167 const Instructions& instructions = Instructions::Handle(code_.instructions()); |
| 168 entry_ = instructions.EntryPoint(); | 168 entry_ = instructions.EntryPoint(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 // TODO(zra): Remove once supported. | |
| 173 #if !defined(TARGET_ARCH_ARM64) | |
| 174 | |
| 175 CodeGenTest::CodeGenTest(const char* name) | 172 CodeGenTest::CodeGenTest(const char* name) |
| 176 : function_(Function::ZoneHandle()), | 173 : function_(Function::ZoneHandle()), |
| 177 node_sequence_(new SequenceNode(Scanner::kNoSourcePos, | 174 node_sequence_(new SequenceNode(Scanner::kNoSourcePos, |
| 178 new LocalScope(NULL, 0, 0))), | 175 new LocalScope(NULL, 0, 0))), |
| 179 default_parameter_values_(Array::ZoneHandle()) { | 176 default_parameter_values_(Array::ZoneHandle()) { |
| 180 ASSERT(name != NULL); | 177 ASSERT(name != NULL); |
| 181 const String& function_name = String::ZoneHandle(Symbols::New(name)); | 178 const String& function_name = String::ZoneHandle(Symbols::New(name)); |
| 182 // Add function to a class and that class to the class dictionary so that | 179 // Add function to a class and that class to the class dictionary so that |
| 183 // frame walking can be used. | 180 // frame walking can be used. |
| 184 const Class& cls = Class::ZoneHandle( | 181 const Class& cls = Class::ZoneHandle( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 202 parsed_function->set_default_parameter_values(default_parameter_values_); | 199 parsed_function->set_default_parameter_values(default_parameter_values_); |
| 203 parsed_function->EnsureExpressionTemp(); | 200 parsed_function->EnsureExpressionTemp(); |
| 204 node_sequence_->scope()->AddVariable(parsed_function->expression_temp_var()); | 201 node_sequence_->scope()->AddVariable(parsed_function->expression_temp_var()); |
| 205 parsed_function->AllocateVariables(); | 202 parsed_function->AllocateVariables(); |
| 206 const Error& error = | 203 const Error& error = |
| 207 Error::Handle(Compiler::CompileParsedFunction(parsed_function)); | 204 Error::Handle(Compiler::CompileParsedFunction(parsed_function)); |
| 208 EXPECT(error.IsNull()); | 205 EXPECT(error.IsNull()); |
| 209 } | 206 } |
| 210 | 207 |
| 211 | 208 |
| 209 // TODO(zra): Remove once supported. |
| 210 #if !defined(TARGET_ARCH_ARM64) |
| 211 |
| 212 LocalVariable* CodeGenTest::CreateTempConstVariable(const char* name_part) { | 212 LocalVariable* CodeGenTest::CreateTempConstVariable(const char* name_part) { |
| 213 char name[64]; | 213 char name[64]; |
| 214 OS::SNPrint(name, 64, ":%s", name_part); | 214 OS::SNPrint(name, 64, ":%s", name_part); |
| 215 LocalVariable* temp = | 215 LocalVariable* temp = |
| 216 new LocalVariable(0, | 216 new LocalVariable(0, |
| 217 String::ZoneHandle(Symbols::New(name)), | 217 String::ZoneHandle(Symbols::New(name)), |
| 218 Type::ZoneHandle(Type::DynamicType())); | 218 Type::ZoneHandle(Type::DynamicType())); |
| 219 temp->set_is_final(); | 219 temp->set_is_final(); |
| 220 node_sequence_->scope()->AddVariable(temp); | 220 node_sequence_->scope()->AddVariable(temp); |
| 221 return temp; | 221 return temp; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 235 Isolate* isolate = Isolate::Current(); | 235 Isolate* isolate = Isolate::Current(); |
| 236 ASSERT(isolate != NULL); | 236 ASSERT(isolate != NULL); |
| 237 ASSERT(ClassFinalizer::AllClassesFinalized()); | 237 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 238 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 238 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
| 239 return error.IsNull(); | 239 return error.IsNull(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 #endif // !defined(TARGET_ARCH_ARM64) | 242 #endif // !defined(TARGET_ARCH_ARM64) |
| 243 | 243 |
| 244 } // namespace dart | 244 } // namespace dart |
| OLD | NEW |