| 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/assembler.h" | 6 #include "vm/assembler.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 kNumArguments, | 106 kNumArguments, |
| 107 Object::empty_array(), | 107 Object::empty_array(), |
| 108 kResolveType)); | 108 kResolveType)); |
| 109 EXPECT(!function.IsNull()); | 109 EXPECT(!function.IsNull()); |
| 110 const Array& args = Array::Handle(Array::New(kNumArguments)); | 110 const Array& args = Array::Handle(Array::New(kNumArguments)); |
| 111 const String& arg0 = String::Handle(String::New("junk")); | 111 const String& arg0 = String::Handle(String::New("junk")); |
| 112 args.SetAt(0, arg0); | 112 args.SetAt(0, arg0); |
| 113 const Smi& arg1 = Smi::Handle(Smi::New(kTestValue)); | 113 const Smi& arg1 = Smi::Handle(Smi::New(kTestValue)); |
| 114 args.SetAt(1, arg1); | 114 args.SetAt(1, arg1); |
| 115 const Smi& retval = Smi::Handle( | 115 const Smi& retval = Smi::Handle( |
| 116 reinterpret_cast<RawSmi*>(DartEntry::InvokeStatic(function, args))); | 116 reinterpret_cast<RawSmi*>(DartEntry::InvokeFunction(function, args))); |
| 117 EXPECT_EQ(kTestValue, retval.Value()); | 117 EXPECT_EQ(kTestValue, retval.Value()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Now try to resolve a static function with invalid argument count. | 120 // Now try to resolve a static function with invalid argument count. |
| 121 { | 121 { |
| 122 const int kNumArguments = 1; | 122 const int kNumArguments = 1; |
| 123 const Function& bad_function = Function::Handle( | 123 const Function& bad_function = Function::Handle( |
| 124 Resolver::ResolveStatic(library, | 124 Resolver::ResolveStatic(library, |
| 125 class_name, | 125 class_name, |
| 126 static_function_name, | 126 static_function_name, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 kNumPositionalArguments, | 181 kNumPositionalArguments, |
| 182 kNumNamedArguments)); | 182 kNumNamedArguments)); |
| 183 EXPECT(!function.IsNull()); | 183 EXPECT(!function.IsNull()); |
| 184 const Array& args = Array::Handle(Array::New(kNumPositionalArguments)); | 184 const Array& args = Array::Handle(Array::New(kNumPositionalArguments)); |
| 185 args.SetAt(0, receiver); | 185 args.SetAt(0, receiver); |
| 186 const String& arg0 = String::Handle(String::New("junk")); | 186 const String& arg0 = String::Handle(String::New("junk")); |
| 187 args.SetAt(1, arg0); | 187 args.SetAt(1, arg0); |
| 188 const Smi& arg1 = Smi::Handle(Smi::New(kTestValue)); | 188 const Smi& arg1 = Smi::Handle(Smi::New(kTestValue)); |
| 189 args.SetAt(2, arg1); | 189 args.SetAt(2, arg1); |
| 190 const Smi& retval = Smi::Handle( | 190 const Smi& retval = Smi::Handle( |
| 191 reinterpret_cast<RawSmi*>(DartEntry::InvokeDynamic(function, args))); | 191 reinterpret_cast<RawSmi*>(DartEntry::InvokeFunction(function, args))); |
| 192 EXPECT_EQ(kTestValue, retval.Value()); | 192 EXPECT_EQ(kTestValue, retval.Value()); |
| 193 } | 193 } |
| 194 | 194 |
| 195 // Now try to resolve an instance function with invalid argument count. | 195 // Now try to resolve an instance function with invalid argument count. |
| 196 { | 196 { |
| 197 const int kNumPositionalArguments = 1; | 197 const int kNumPositionalArguments = 1; |
| 198 const int kNumNamedArguments = 0; | 198 const int kNumNamedArguments = 0; |
| 199 const Function& bad_function = Function::Handle( | 199 const Function& bad_function = Function::Handle( |
| 200 Resolver::ResolveDynamic(receiver, | 200 Resolver::ResolveDynamic(receiver, |
| 201 function_name, | 201 function_name, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 215 super_function_name, | 215 super_function_name, |
| 216 kNumPositionalArguments, | 216 kNumPositionalArguments, |
| 217 kNumNamedArguments)); | 217 kNumNamedArguments)); |
| 218 EXPECT(!super_function.IsNull()); | 218 EXPECT(!super_function.IsNull()); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 222 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 223 | 223 |
| 224 } // namespace dart | 224 } // namespace dart |
| OLD | NEW |