Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(840)

Side by Side Diff: runtime/vm/assembler_dbc_test.cc

Issue 2859673002: Pass type argument vector to generic functions (if --reify-generic-functions is (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 return Simulator::Current()->Call(
18 Array::Handle(ArgumentsDescriptor::New(0)), 18 code, Array::Handle(ArgumentsDescriptor::New(0, 0)),
19 Array::Handle(Array::New(0)), thread); 19 Array::Handle(Array::New(0)), thread);
20 } 20 }
21 21
22 22
23 #define EXECUTE_TEST_CODE_INTPTR(code) \ 23 #define EXECUTE_TEST_CODE_INTPTR(code) \
24 Smi::Value(Smi::RawCast(ExecuteTest(code))) 24 Smi::Value(Smi::RawCast(ExecuteTest(code)))
25 #define EXECUTE_TEST_CODE_BOOL(code) \ 25 #define EXECUTE_TEST_CODE_BOOL(code) \
26 (Bool::RawCast(ExecuteTest(code)) == Bool::True().raw()) 26 (Bool::RawCast(ExecuteTest(code)) == Bool::True().raw())
27 #define EXECUTE_TEST_CODE_OBJECT(code) Object::Handle(ExecuteTest(code)) 27 #define EXECUTE_TEST_CODE_OBJECT(code) Object::Handle(ExecuteTest(code))
28 #define EXECUTE_TEST_CODE_DOUBLE(code) \ 28 #define EXECUTE_TEST_CODE_DOUBLE(code) \
29 bit_cast<double, RawObject*>(ExecuteTest(code)) 29 bit_cast<double, RawObject*>(ExecuteTest(code))
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 GenerateDummyCode(&_assembler_, result); 73 GenerateDummyCode(&_assembler_, result);
74 const char* dummy_function_name = "dummy_instance_function"; 74 const char* dummy_function_name = "dummy_instance_function";
75 const Function& dummy_instance_function = 75 const Function& dummy_instance_function =
76 Function::Handle(CreateFunction(dummy_function_name)); 76 Function::Handle(CreateFunction(dummy_function_name));
77 Code& code = 77 Code& code =
78 Code::Handle(Code::FinalizeCode(dummy_instance_function, &_assembler_)); 78 Code::Handle(Code::FinalizeCode(dummy_instance_function, &_assembler_));
79 dummy_instance_function.AttachCode(code); 79 dummy_instance_function.AttachCode(code);
80 80
81 // Make a dummy ICData. 81 // Make a dummy ICData.
82 const Array& dummy_arguments_descriptor = 82 const Array& dummy_arguments_descriptor =
83 Array::Handle(ArgumentsDescriptor::New(2)); 83 Array::Handle(ArgumentsDescriptor::New(0, 2));
84 const ICData& ic_data = ICData::Handle(ICData::New( 84 const ICData& ic_data = ICData::Handle(ICData::New(
85 dummy_instance_function, String::Handle(dummy_instance_function.name()), 85 dummy_instance_function, String::Handle(dummy_instance_function.name()),
86 dummy_arguments_descriptor, Thread::kNoDeoptId, 2, 86 dummy_arguments_descriptor, Thread::kNoDeoptId, 2,
87 /* is_static_call= */ false)); 87 /* is_static_call= */ false));
88 88
89 // Wire up the Function in the ICData. 89 // Wire up the Function in the ICData.
90 GrowableArray<intptr_t> cids(2); 90 GrowableArray<intptr_t> cids(2);
91 cids.Add(kSmiCid); 91 cids.Add(kSmiCid);
92 cids.Add(kSmiCid); 92 cids.Add(kSmiCid);
93 ic_data.AddCheck(cids, dummy_instance_function); 93 ic_data.AddCheck(cids, dummy_instance_function);
(...skipping 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2812 2812
2813 ASSEMBLER_TEST_RUN(DMax, test) { 2813 ASSEMBLER_TEST_RUN(DMax, test) {
2814 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); 2814 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code()));
2815 } 2815 }
2816 2816
2817 #endif // defined(ARCH_IS_64_BIT) 2817 #endif // defined(ARCH_IS_64_BIT)
2818 2818
2819 } // namespace dart 2819 } // namespace dart
2820 2820
2821 #endif // defined(TARGET_ARCH_DBC) 2821 #endif // defined(TARGET_ARCH_DBC)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698