| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 const bool has_opt_params = true; | 216 const bool has_opt_params = true; |
| 217 const String& native_name = | 217 const String& native_name = |
| 218 String::ZoneHandle(String::NewSymbol("TestSmiSub")); | 218 String::ZoneHandle(String::NewSymbol("TestSmiSub")); |
| 219 NativeFunction native_function = | 219 NativeFunction native_function = |
| 220 reinterpret_cast<NativeFunction>(NATIVE_ENTRY_FUNCTION(TestSmiSub)); | 220 reinterpret_cast<NativeFunction>(NATIVE_ENTRY_FUNCTION(TestSmiSub)); |
| 221 node_seq->Add(new ReturnNode(kPos, | 221 node_seq->Add(new ReturnNode(kPos, |
| 222 new NativeBodyNode(kPos, | 222 new NativeBodyNode(kPos, |
| 223 native_name, | 223 native_name, |
| 224 native_function, | 224 native_function, |
| 225 num_params, | 225 num_params, |
| 226 has_opt_params))); | 226 has_opt_params, |
| 227 false))); |
| 227 } | 228 } |
| 228 | 229 |
| 229 | 230 |
| 230 // Tested Dart code: | 231 // Tested Dart code: |
| 231 // return dec(5); | 232 // return dec(5); |
| 232 CODEGEN_TEST2_GENERATE(StaticDecCallCodegen, function, test) { | 233 CODEGEN_TEST2_GENERATE(StaticDecCallCodegen, function, test) { |
| 233 SequenceNode* node_seq = test->node_sequence(); | 234 SequenceNode* node_seq = test->node_sequence(); |
| 234 ArgumentListNode* arguments = new ArgumentListNode(kPos); | 235 ArgumentListNode* arguments = new ArgumentListNode(kPos); |
| 235 arguments->Add(new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(5)))); | 236 arguments->Add(new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(5)))); |
| 236 node_seq->Add(new ReturnNode(kPos, | 237 node_seq->Add(new ReturnNode(kPos, |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 const bool has_opt_params = true; | 388 const bool has_opt_params = true; |
| 388 const String& native_name = | 389 const String& native_name = |
| 389 String::ZoneHandle(String::NewSymbol("TestSmiSum")); | 390 String::ZoneHandle(String::NewSymbol("TestSmiSum")); |
| 390 NativeFunction native_function = | 391 NativeFunction native_function = |
| 391 reinterpret_cast<NativeFunction>(NATIVE_ENTRY_FUNCTION(TestSmiSum)); | 392 reinterpret_cast<NativeFunction>(NATIVE_ENTRY_FUNCTION(TestSmiSum)); |
| 392 node_seq->Add(new ReturnNode(kPos, | 393 node_seq->Add(new ReturnNode(kPos, |
| 393 new NativeBodyNode(kPos, | 394 new NativeBodyNode(kPos, |
| 394 native_name, | 395 native_name, |
| 395 native_function, | 396 native_function, |
| 396 num_params, | 397 num_params, |
| 397 has_opt_params))); | 398 has_opt_params, |
| 399 false))); |
| 398 } | 400 } |
| 399 | 401 |
| 400 | 402 |
| 401 // Tested Dart code, calling function sum declared above: | 403 // Tested Dart code, calling function sum declared above: |
| 402 // return sum(1, 3); | 404 // return sum(1, 3); |
| 403 // Optional arguments are not passed and hence are set to their default values. | 405 // Optional arguments are not passed and hence are set to their default values. |
| 404 CODEGEN_TEST2_GENERATE(StaticSumCallNoOptCodegen, function, test) { | 406 CODEGEN_TEST2_GENERATE(StaticSumCallNoOptCodegen, function, test) { |
| 405 SequenceNode* node_seq = test->node_sequence(); | 407 SequenceNode* node_seq = test->node_sequence(); |
| 406 ArgumentListNode* arguments = new ArgumentListNode(kPos); | 408 ArgumentListNode* arguments = new ArgumentListNode(kPos); |
| 407 arguments->Add(new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(1)))); | 409 arguments->Add(new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(1)))); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 app_lib ^= libs.At(num_libs - 1); | 499 app_lib ^= libs.At(num_libs - 1); |
| 498 ASSERT(!app_lib.IsNull()); | 500 ASSERT(!app_lib.IsNull()); |
| 499 const Class& cls = Class::Handle( | 501 const Class& cls = Class::Handle( |
| 500 app_lib.LookupClass(String::Handle(String::NewSymbol("A")))); | 502 app_lib.LookupClass(String::Handle(String::NewSymbol("A")))); |
| 501 EXPECT_EQ(cls.raw(), result.clazz()); | 503 EXPECT_EQ(cls.raw(), result.clazz()); |
| 502 } | 504 } |
| 503 | 505 |
| 504 } // namespace dart | 506 } // namespace dart |
| 505 | 507 |
| 506 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) | 508 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) |
| OLD | NEW |