OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_DBC) | 6 #if defined(TARGET_ARCH_DBC) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/stack_frame.h" | 9 #include "vm/stack_frame.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
14 static RawObject* ExecuteTest(const Code& code) { | 14 static RawObject* ExecuteTest(const Code& code) { |
15 Thread* thread = Thread::Current(); | 15 Thread* thread = Thread::Current(); |
16 TransitionToGenerated transition(thread); | 16 TransitionToGenerated transition(thread); |
17 return Simulator::Current()->Call(code, | 17 const intptr_t kTypeArgsLen = 0; |
18 Array::Handle(ArgumentsDescriptor::New(0)), | 18 const intptr_t kNumArgs = 0; |
19 Array::Handle(Array::New(0)), thread); | 19 return Simulator::Current()->Call( |
| 20 code, Array::Handle(ArgumentsDescriptor::New(kTypeArgsLen, kNumArgs)), |
| 21 Array::Handle(Array::New(0)), thread); |
20 } | 22 } |
21 | 23 |
22 | 24 |
23 #define EXECUTE_TEST_CODE_INTPTR(code) \ | 25 #define EXECUTE_TEST_CODE_INTPTR(code) \ |
24 Smi::Value(Smi::RawCast(ExecuteTest(code))) | 26 Smi::Value(Smi::RawCast(ExecuteTest(code))) |
25 #define EXECUTE_TEST_CODE_BOOL(code) \ | 27 #define EXECUTE_TEST_CODE_BOOL(code) \ |
26 (Bool::RawCast(ExecuteTest(code)) == Bool::True().raw()) | 28 (Bool::RawCast(ExecuteTest(code)) == Bool::True().raw()) |
27 #define EXECUTE_TEST_CODE_OBJECT(code) Object::Handle(ExecuteTest(code)) | 29 #define EXECUTE_TEST_CODE_OBJECT(code) Object::Handle(ExecuteTest(code)) |
28 #define EXECUTE_TEST_CODE_DOUBLE(code) \ | 30 #define EXECUTE_TEST_CODE_DOUBLE(code) \ |
29 bit_cast<double, RawObject*>(ExecuteTest(code)) | 31 bit_cast<double, RawObject*>(ExecuteTest(code)) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 Assembler _assembler_; | 74 Assembler _assembler_; |
73 GenerateDummyCode(&_assembler_, result); | 75 GenerateDummyCode(&_assembler_, result); |
74 const char* dummy_function_name = "dummy_instance_function"; | 76 const char* dummy_function_name = "dummy_instance_function"; |
75 const Function& dummy_instance_function = | 77 const Function& dummy_instance_function = |
76 Function::Handle(CreateFunction(dummy_function_name)); | 78 Function::Handle(CreateFunction(dummy_function_name)); |
77 Code& code = | 79 Code& code = |
78 Code::Handle(Code::FinalizeCode(dummy_instance_function, &_assembler_)); | 80 Code::Handle(Code::FinalizeCode(dummy_instance_function, &_assembler_)); |
79 dummy_instance_function.AttachCode(code); | 81 dummy_instance_function.AttachCode(code); |
80 | 82 |
81 // Make a dummy ICData. | 83 // Make a dummy ICData. |
| 84 const intptr_t kTypeArgsLen = 0; |
| 85 const intptr_t kNumArgs = 2; |
82 const Array& dummy_arguments_descriptor = | 86 const Array& dummy_arguments_descriptor = |
83 Array::Handle(ArgumentsDescriptor::New(2)); | 87 Array::Handle(ArgumentsDescriptor::New(kTypeArgsLen, kNumArgs)); |
84 const ICData& ic_data = ICData::Handle(ICData::New( | 88 const ICData& ic_data = ICData::Handle(ICData::New( |
85 dummy_instance_function, String::Handle(dummy_instance_function.name()), | 89 dummy_instance_function, String::Handle(dummy_instance_function.name()), |
86 dummy_arguments_descriptor, Thread::kNoDeoptId, 2, | 90 dummy_arguments_descriptor, Thread::kNoDeoptId, 2, |
87 /* is_static_call= */ false)); | 91 /* is_static_call= */ false)); |
88 | 92 |
89 // Wire up the Function in the ICData. | 93 // Wire up the Function in the ICData. |
90 GrowableArray<intptr_t> cids(2); | 94 GrowableArray<intptr_t> cids(2); |
91 cids.Add(kSmiCid); | 95 cids.Add(kSmiCid); |
92 cids.Add(kSmiCid); | 96 cids.Add(kSmiCid); |
93 ic_data.AddCheck(cids, dummy_instance_function); | 97 ic_data.AddCheck(cids, dummy_instance_function); |
(...skipping 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 | 2816 |
2813 ASSEMBLER_TEST_RUN(DMax, test) { | 2817 ASSEMBLER_TEST_RUN(DMax, test) { |
2814 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); | 2818 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); |
2815 } | 2819 } |
2816 | 2820 |
2817 #endif // defined(ARCH_IS_64_BIT) | 2821 #endif // defined(ARCH_IS_64_BIT) |
2818 | 2822 |
2819 } // namespace dart | 2823 } // namespace dart |
2820 | 2824 |
2821 #endif // defined(TARGET_ARCH_DBC) | 2825 #endif // defined(TARGET_ARCH_DBC) |
OLD | NEW |