OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 CODEGEN_TEST2_RUN(PatchStaticCall, NativePatchStaticCall, Instance::null()); | 46 CODEGEN_TEST2_RUN(PatchStaticCall, NativePatchStaticCall, Instance::null()); |
47 | 47 |
48 #define __ assembler-> | 48 #define __ assembler-> |
49 | 49 |
50 ASSEMBLER_TEST_GENERATE(IcDataAccess, assembler) { | 50 ASSEMBLER_TEST_GENERATE(IcDataAccess, assembler) { |
51 const String& function_name = | 51 const String& function_name = |
52 String::ZoneHandle(Symbols::New("callerFunction")); | 52 String::ZoneHandle(Symbols::New("callerFunction")); |
53 const Function& function = Function::ZoneHandle( | 53 const Function& function = Function::ZoneHandle( |
54 Function::New(function_name, RawFunction::kRegularFunction, | 54 Function::New(function_name, RawFunction::kRegularFunction, |
55 true, false, 0)); | 55 true, false, false, 0)); |
56 | 56 |
57 const String& target_name = String::Handle(String::New("targetFunction")); | 57 const String& target_name = String::Handle(String::New("targetFunction")); |
58 ICData& ic_data = ICData::ZoneHandle( | 58 ICData& ic_data = ICData::ZoneHandle( |
59 ICData::New(function, target_name, 15, 1)); | 59 ICData::New(function, target_name, 15, 1)); |
60 __ LoadObject(ECX, ic_data); | 60 __ LoadObject(ECX, ic_data); |
61 __ LoadObject(EDX, DartEntry::ArgumentsDescriptor(1, Array::Handle())); | 61 __ LoadObject(EDX, DartEntry::ArgumentsDescriptor(1, Array::Handle())); |
62 ExternalLabel target_label( | 62 ExternalLabel target_label( |
63 "InlineCache", StubCode::OneArgCheckInlineCacheEntryPoint()); | 63 "InlineCache", StubCode::OneArgCheckInlineCacheEntryPoint()); |
64 __ call(&target_label); | 64 __ call(&target_label); |
65 __ ret(); | 65 __ ret(); |
66 } | 66 } |
67 | 67 |
68 | 68 |
69 ASSEMBLER_TEST_RUN(IcDataAccess, entry) { | 69 ASSEMBLER_TEST_RUN(IcDataAccess, entry) { |
70 uword return_address = entry + CodePatcher::InstanceCallSizeInBytes(); | 70 uword return_address = entry + CodePatcher::InstanceCallSizeInBytes(); |
71 const ICData& ic_data = ICData::Handle( | 71 const ICData& ic_data = ICData::Handle( |
72 CodePatcher::GetInstanceCallIcDataAt(return_address)); | 72 CodePatcher::GetInstanceCallIcDataAt(return_address)); |
73 EXPECT_STREQ("targetFunction", | 73 EXPECT_STREQ("targetFunction", |
74 String::Handle(ic_data.target_name()).ToCString()); | 74 String::Handle(ic_data.target_name()).ToCString()); |
75 EXPECT_EQ(1, ic_data.num_args_tested()); | 75 EXPECT_EQ(1, ic_data.num_args_tested()); |
76 EXPECT_EQ(0, ic_data.NumberOfChecks()); | 76 EXPECT_EQ(0, ic_data.NumberOfChecks()); |
77 } | 77 } |
78 | 78 |
79 } // namespace dart | 79 } // namespace dart |
80 | 80 |
81 #endif // TARGET_ARCH_IA32 | 81 #endif // TARGET_ARCH_IA32 |
OLD | NEW |