| 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 "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 | 9 |
| 10 #include "vm/ast.h" | 10 #include "vm/ast.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #define __ assembler_-> | 23 #define __ assembler_-> |
| 24 | 24 |
| 25 | 25 |
| 26 static const intptr_t kPos = 1; // Dummy token index in non-existing source. | 26 static const intptr_t kPos = 1; // Dummy token index in non-existing source. |
| 27 | 27 |
| 28 | 28 |
| 29 // Helper to allocate and return a LocalVariable. | 29 // Helper to allocate and return a LocalVariable. |
| 30 static LocalVariable* NewTestLocalVariable(const char* name) { | 30 static LocalVariable* NewTestLocalVariable(const char* name) { |
| 31 const String& variable_name = String::ZoneHandle(String::New(name)); | 31 const String& variable_name = String::ZoneHandle(String::New(name)); |
| 32 const Type& variable_type = Type::ZoneHandle(Type::VarType()); | 32 const Type& variable_type = Type::ZoneHandle(Type::DynamicType()); |
| 33 return new LocalVariable(kPos, variable_name, variable_type); | 33 return new LocalVariable(kPos, variable_name, variable_type); |
| 34 } | 34 } |
| 35 | 35 |
| 36 | 36 |
| 37 CODEGEN_TEST_GENERATE(SimpleReturnCodegen, test) { | 37 CODEGEN_TEST_GENERATE(SimpleReturnCodegen, test) { |
| 38 test->node_sequence()->Add(new ReturnNode(kPos)); | 38 test->node_sequence()->Add(new ReturnNode(kPos)); |
| 39 } | 39 } |
| 40 CODEGEN_TEST_RUN(SimpleReturnCodegen, Instance::null()) | 40 CODEGEN_TEST_RUN(SimpleReturnCodegen, Instance::null()) |
| 41 | 41 |
| 42 | 42 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 const Array& default_values = Array::ZoneHandle(Array::New(num_opt_params)); | 375 const Array& default_values = Array::ZoneHandle(Array::New(num_opt_params)); |
| 376 default_values.SetAt(0, Smi::ZoneHandle(Smi::New(10))); | 376 default_values.SetAt(0, Smi::ZoneHandle(Smi::New(10))); |
| 377 default_values.SetAt(1, Smi::ZoneHandle(Smi::New(21))); | 377 default_values.SetAt(1, Smi::ZoneHandle(Smi::New(21))); |
| 378 default_values.SetAt(2, Smi::ZoneHandle(Smi::New(-32))); | 378 default_values.SetAt(2, Smi::ZoneHandle(Smi::New(-32))); |
| 379 test->set_default_parameter_values(default_values); | 379 test->set_default_parameter_values(default_values); |
| 380 const Function& function = test->function(); | 380 const Function& function = test->function(); |
| 381 function.set_num_fixed_parameters(num_fixed_params); | 381 function.set_num_fixed_parameters(num_fixed_params); |
| 382 function.set_num_optional_parameters(num_opt_params); | 382 function.set_num_optional_parameters(num_opt_params); |
| 383 function.set_parameter_types(Array::Handle(Array::New(num_params))); | 383 function.set_parameter_types(Array::Handle(Array::New(num_params))); |
| 384 function.set_parameter_names(Array::Handle(Array::New(num_params))); | 384 function.set_parameter_names(Array::Handle(Array::New(num_params))); |
| 385 const Type& param_type = Type::Handle(Type::VarType()); | 385 const Type& param_type = Type::Handle(Type::DynamicType()); |
| 386 for (int i = 0; i < num_params - 1; i++) { | 386 for (int i = 0; i < num_params - 1; i++) { |
| 387 function.SetParameterTypeAt(i, param_type); | 387 function.SetParameterTypeAt(i, param_type); |
| 388 } | 388 } |
| 389 const bool has_opt_params = true; | 389 const bool has_opt_params = true; |
| 390 const String& native_name = | 390 const String& native_name = |
| 391 String::ZoneHandle(String::NewSymbol("TestSmiSum")); | 391 String::ZoneHandle(String::NewSymbol("TestSmiSum")); |
| 392 NativeFunction native_function = | 392 NativeFunction native_function = |
| 393 reinterpret_cast<NativeFunction>(NATIVE_ENTRY_FUNCTION(TestSmiSum)); | 393 reinterpret_cast<NativeFunction>(NATIVE_ENTRY_FUNCTION(TestSmiSum)); |
| 394 node_seq->Add(new ReturnNode(kPos, | 394 node_seq->Add(new ReturnNode(kPos, |
| 395 new NativeBodyNode(kPos, | 395 new NativeBodyNode(kPos, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 const Library& app_lib = Library::Handle( | 491 const Library& app_lib = Library::Handle( |
| 492 Isolate::Current()->object_store()->registered_libraries()); | 492 Isolate::Current()->object_store()->registered_libraries()); |
| 493 const Class& cls = Class::Handle( | 493 const Class& cls = Class::Handle( |
| 494 app_lib.LookupClass(String::Handle(String::NewSymbol("A")))); | 494 app_lib.LookupClass(String::Handle(String::NewSymbol("A")))); |
| 495 EXPECT_EQ(cls.raw(), result.clazz()); | 495 EXPECT_EQ(cls.raw(), result.clazz()); |
| 496 } | 496 } |
| 497 | 497 |
| 498 } // namespace dart | 498 } // namespace dart |
| 499 | 499 |
| 500 #endif // defined TARGET_ARCH_IA32 | 500 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |