| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 CHECK_EQ(73.8818412254460241, t.c); | 1137 CHECK_EQ(73.8818412254460241, t.c); |
| 1138 CHECK_EQ(2.75, t.x); | 1138 CHECK_EQ(2.75, t.x); |
| 1139 CHECK_EQ(1.5, t.y); | 1139 CHECK_EQ(1.5, t.y); |
| 1140 CHECK_EQ(17.0, t.z); | 1140 CHECK_EQ(17.0, t.z); |
| 1141 CHECK_EQ(14.7610017472335499, t.i); | 1141 CHECK_EQ(14.7610017472335499, t.i); |
| 1142 CHECK_EQ(16.0, t.j); | 1142 CHECK_EQ(16.0, t.j); |
| 1143 CHECK_EQ(73.8818412254460241, t.k); | 1143 CHECK_EQ(73.8818412254460241, t.k); |
| 1144 } | 1144 } |
| 1145 } | 1145 } |
| 1146 | 1146 |
| 1147 |
| 1148 TEST(14) { |
| 1149 // Test the pld instruction |
| 1150 InitializeVM(); |
| 1151 v8::HandleScope scope; |
| 1152 |
| 1153 typedef struct { |
| 1154 int32_t a; |
| 1155 int32_t b[32]; |
| 1156 int32_t c; |
| 1157 int32_t d[32]; |
| 1158 int32_t e; |
| 1159 int32_t f; |
| 1160 } I; |
| 1161 I i; |
| 1162 |
| 1163 i.a = 4; |
| 1164 i.c = 16; |
| 1165 i.e = 32; |
| 1166 |
| 1167 Assembler assm(Isolate::Current(), NULL, 0); |
| 1168 |
| 1169 // Test data preload |
| 1170 // Prefetch data into cache for known future loads |
| 1171 __ pld(MemOperand(r0, OFFSET_OF(I, c))); |
| 1172 __ ldr(r1, MemOperand(r0, OFFSET_OF(I, a))); |
| 1173 __ mov(r1, Operand(r1, ASR, 1)); |
| 1174 __ add(r1, r1, Operand(r1)); |
| 1175 __ str(r1, MemOperand(r0, OFFSET_OF(I, a))); |
| 1176 |
| 1177 __ pld(MemOperand(r0, OFFSET_OF(I, e))); |
| 1178 __ ldr(r2, MemOperand(r0, OFFSET_OF(I, c))); |
| 1179 __ mov(r2, Operand(r2, ASR, 1)); |
| 1180 __ add(r2, r2, Operand(r2)); |
| 1181 __ str(r2, MemOperand(r0, OFFSET_OF(I, a))); |
| 1182 |
| 1183 __ ldr(r3, MemOperand(r0, OFFSET_OF(I, e))); |
| 1184 __ mov(r2, Operand(r3, ASR, 1)); |
| 1185 __ add(r3, r3, Operand(r2)); |
| 1186 __ str(r3, MemOperand(r0, OFFSET_OF(I, c))); |
| 1187 |
| 1188 __ add(r3, r1, Operand(r2)); |
| 1189 __ str(r3, MemOperand(r0, OFFSET_OF(I, f))); |
| 1190 __ mov(pc, Operand(lr)); |
| 1191 |
| 1192 CodeDesc desc; |
| 1193 assm.GetCode(&desc); |
| 1194 Object* code = HEAP->CreateCode( |
| 1195 desc, |
| 1196 Code::ComputeFlags(Code::STUB), |
| 1197 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); |
| 1198 CHECK(code->IsCode()); |
| 1199 #ifdef DEBUG |
| 1200 Code::cast(code)->Print(); |
| 1201 #endif |
| 1202 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 1203 Object* dummy = CALL_GENERATED_CODE(f, &i, 0, 0, 0, 0); |
| 1204 USE(dummy); |
| 1205 |
| 1206 CHECK_EQ(16, i.a); |
| 1207 CHECK_EQ(48, i.c); |
| 1208 CHECK_EQ(32, i.e); |
| 1209 CHECK_EQ(20, i.f); |
| 1210 } |
| 1211 |
| 1147 #undef __ | 1212 #undef __ |
| OLD | NEW |