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 "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/globals.h" | 6 #include "vm/globals.h" |
7 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 7 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
8 | 8 |
9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 const Array& default_values = Array::ZoneHandle(Array::New(num_opt_params)); | 215 const Array& default_values = Array::ZoneHandle(Array::New(num_opt_params)); |
216 default_values.SetAt(0, Smi::ZoneHandle(Smi::New(1))); // b = 1. | 216 default_values.SetAt(0, Smi::ZoneHandle(Smi::New(1))); // b = 1. |
217 test->set_default_parameter_values(default_values); | 217 test->set_default_parameter_values(default_values); |
218 const Function& function = test->function(); | 218 const Function& function = test->function(); |
219 function.set_num_fixed_parameters(num_fixed_params); | 219 function.set_num_fixed_parameters(num_fixed_params); |
220 function.set_num_optional_parameters(num_opt_params); | 220 function.set_num_optional_parameters(num_opt_params); |
221 const bool has_opt_params = true; | 221 const bool has_opt_params = true; |
222 const String& native_name = | 222 const String& native_name = |
223 String::ZoneHandle(Symbols::New("TestSmiSub")); | 223 String::ZoneHandle(Symbols::New("TestSmiSub")); |
224 NativeFunction native_function = | 224 NativeFunction native_function = |
225 reinterpret_cast<NativeFunction>(NATIVE_ENTRY_FUNCTION(TestSmiSub)); | 225 reinterpret_cast<NativeFunction>(TestSmiSub); |
226 node_seq->Add(new ReturnNode(kPos, | 226 node_seq->Add(new ReturnNode(kPos, |
227 new NativeBodyNode(kPos, | 227 new NativeBodyNode(kPos, |
228 native_name, | 228 native_name, |
229 native_function, | 229 native_function, |
230 num_params, | 230 num_params, |
231 has_opt_params, | 231 has_opt_params, |
232 false))); | 232 false))); |
233 } | 233 } |
234 | 234 |
235 | 235 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 function.set_parameter_types(Array::Handle(Array::New(num_params))); | 392 function.set_parameter_types(Array::Handle(Array::New(num_params))); |
393 function.set_parameter_names(Array::Handle(Array::New(num_params))); | 393 function.set_parameter_names(Array::Handle(Array::New(num_params))); |
394 const Type& param_type = Type::Handle(Type::DynamicType()); | 394 const Type& param_type = Type::Handle(Type::DynamicType()); |
395 for (int i = 0; i < num_params - 1; i++) { | 395 for (int i = 0; i < num_params - 1; i++) { |
396 function.SetParameterTypeAt(i, param_type); | 396 function.SetParameterTypeAt(i, param_type); |
397 } | 397 } |
398 const bool has_opt_params = true; | 398 const bool has_opt_params = true; |
399 const String& native_name = | 399 const String& native_name = |
400 String::ZoneHandle(Symbols::New("TestSmiSum")); | 400 String::ZoneHandle(Symbols::New("TestSmiSum")); |
401 NativeFunction native_function = | 401 NativeFunction native_function = |
402 reinterpret_cast<NativeFunction>(NATIVE_ENTRY_FUNCTION(TestSmiSum)); | 402 reinterpret_cast<NativeFunction>(TestSmiSum); |
403 node_seq->Add(new ReturnNode(kPos, | 403 node_seq->Add(new ReturnNode(kPos, |
404 new NativeBodyNode(kPos, | 404 new NativeBodyNode(kPos, |
405 native_name, | 405 native_name, |
406 native_function, | 406 native_function, |
407 num_params, | 407 num_params, |
408 has_opt_params, | 408 has_opt_params, |
409 false))); | 409 false))); |
410 } | 410 } |
411 | 411 |
412 | 412 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 app_lib ^= libs.At(num_libs - 1); | 511 app_lib ^= libs.At(num_libs - 1); |
512 ASSERT(!app_lib.IsNull()); | 512 ASSERT(!app_lib.IsNull()); |
513 const Class& cls = Class::Handle( | 513 const Class& cls = Class::Handle( |
514 app_lib.LookupClass(String::Handle(Symbols::New("A")))); | 514 app_lib.LookupClass(String::Handle(Symbols::New("A")))); |
515 EXPECT_EQ(cls.raw(), result.clazz()); | 515 EXPECT_EQ(cls.raw(), result.clazz()); |
516 } | 516 } |
517 | 517 |
518 } // namespace dart | 518 } // namespace dart |
519 | 519 |
520 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) | 520 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) |
OLD | NEW |