OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/arm64/macro-assembler-arm64.h" | 8 #include "src/arm64/macro-assembler-arm64.h" |
9 #include "src/compiler/code-generator-impl.h" | 9 #include "src/compiler/code-generator-impl.h" |
10 #include "src/compiler/gap-resolver.h" | 10 #include "src/compiler/gap-resolver.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 auto offset = i.InputRegister32(1); \ | 295 auto offset = i.InputRegister32(1); \ |
296 auto length = i.InputOperand32(2); \ | 296 auto length = i.InputOperand32(2); \ |
297 __ Cmp(offset, length); \ | 297 __ Cmp(offset, length); \ |
298 auto ool = new (zone()) OutOfLineLoadZero(this, result); \ | 298 auto ool = new (zone()) OutOfLineLoadZero(this, result); \ |
299 __ B(hs, ool->entry()); \ | 299 __ B(hs, ool->entry()); \ |
300 __ asm_instr(result, MemOperand(buffer, offset, UXTW)); \ | 300 __ asm_instr(result, MemOperand(buffer, offset, UXTW)); \ |
301 __ Bind(ool->exit()); \ | 301 __ Bind(ool->exit()); \ |
302 } while (0) | 302 } while (0) |
303 | 303 |
304 | 304 |
| 305 #define ASSEMBLE_CHECKED_LOAD_INTEGER_64(asm_instr) \ |
| 306 do { \ |
| 307 auto result = i.OutputRegister(); \ |
| 308 auto buffer = i.InputRegister(0); \ |
| 309 auto offset = i.InputRegister32(1); \ |
| 310 auto length = i.InputOperand32(2); \ |
| 311 __ Cmp(offset, length); \ |
| 312 auto ool = new (zone()) OutOfLineLoadZero(this, result); \ |
| 313 __ B(hs, ool->entry()); \ |
| 314 __ asm_instr(result, MemOperand(buffer, offset, UXTW)); \ |
| 315 __ Bind(ool->exit()); \ |
| 316 } while (0) |
| 317 |
| 318 |
305 #define ASSEMBLE_CHECKED_STORE_FLOAT(width) \ | 319 #define ASSEMBLE_CHECKED_STORE_FLOAT(width) \ |
306 do { \ | 320 do { \ |
307 auto buffer = i.InputRegister(0); \ | 321 auto buffer = i.InputRegister(0); \ |
308 auto offset = i.InputRegister32(1); \ | 322 auto offset = i.InputRegister32(1); \ |
309 auto length = i.InputOperand32(2); \ | 323 auto length = i.InputOperand32(2); \ |
310 auto value = i.InputFloat##width##Register(3); \ | 324 auto value = i.InputFloat##width##Register(3); \ |
311 __ Cmp(offset, length); \ | 325 __ Cmp(offset, length); \ |
312 Label done; \ | 326 Label done; \ |
313 __ B(hs, &done); \ | 327 __ B(hs, &done); \ |
314 __ Str(value, MemOperand(buffer, offset, UXTW)); \ | 328 __ Str(value, MemOperand(buffer, offset, UXTW)); \ |
315 __ Bind(&done); \ | 329 __ Bind(&done); \ |
316 } while (0) | 330 } while (0) |
317 | 331 |
318 | 332 |
319 #define ASSEMBLE_CHECKED_STORE_INTEGER(asm_instr) \ | 333 #define ASSEMBLE_CHECKED_STORE_INTEGER(asm_instr) \ |
320 do { \ | 334 do { \ |
321 auto buffer = i.InputRegister(0); \ | 335 auto buffer = i.InputRegister(0); \ |
322 auto offset = i.InputRegister32(1); \ | 336 auto offset = i.InputRegister32(1); \ |
323 auto length = i.InputOperand32(2); \ | 337 auto length = i.InputOperand32(2); \ |
324 auto value = i.InputRegister32(3); \ | 338 auto value = i.InputRegister32(3); \ |
325 __ Cmp(offset, length); \ | 339 __ Cmp(offset, length); \ |
326 Label done; \ | 340 Label done; \ |
327 __ B(hs, &done); \ | 341 __ B(hs, &done); \ |
328 __ asm_instr(value, MemOperand(buffer, offset, UXTW)); \ | 342 __ asm_instr(value, MemOperand(buffer, offset, UXTW)); \ |
329 __ Bind(&done); \ | 343 __ Bind(&done); \ |
330 } while (0) | 344 } while (0) |
331 | 345 |
332 | 346 |
| 347 #define ASSEMBLE_CHECKED_STORE_INTEGER_64(asm_instr) \ |
| 348 do { \ |
| 349 auto buffer = i.InputRegister(0); \ |
| 350 auto offset = i.InputRegister32(1); \ |
| 351 auto length = i.InputOperand32(2); \ |
| 352 auto value = i.InputRegister(3); \ |
| 353 __ Cmp(offset, length); \ |
| 354 Label done; \ |
| 355 __ B(hs, &done); \ |
| 356 __ asm_instr(value, MemOperand(buffer, offset, UXTW)); \ |
| 357 __ Bind(&done); \ |
| 358 } while (0) |
| 359 |
| 360 |
333 #define ASSEMBLE_SHIFT(asm_instr, width) \ | 361 #define ASSEMBLE_SHIFT(asm_instr, width) \ |
334 do { \ | 362 do { \ |
335 if (instr->InputAt(1)->IsRegister()) { \ | 363 if (instr->InputAt(1)->IsRegister()) { \ |
336 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), \ | 364 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), \ |
337 i.InputRegister##width(1)); \ | 365 i.InputRegister##width(1)); \ |
338 } else { \ | 366 } else { \ |
339 uint32_t imm = \ | 367 uint32_t imm = \ |
340 static_cast<uint32_t>(i.InputOperand##width(1).ImmediateValue()); \ | 368 static_cast<uint32_t>(i.InputOperand##width(1).ImmediateValue()); \ |
341 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), \ | 369 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), \ |
342 imm % (width)); \ | 370 imm % (width)); \ |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 break; | 963 break; |
936 case kCheckedLoadInt16: | 964 case kCheckedLoadInt16: |
937 ASSEMBLE_CHECKED_LOAD_INTEGER(Ldrsh); | 965 ASSEMBLE_CHECKED_LOAD_INTEGER(Ldrsh); |
938 break; | 966 break; |
939 case kCheckedLoadUint16: | 967 case kCheckedLoadUint16: |
940 ASSEMBLE_CHECKED_LOAD_INTEGER(Ldrh); | 968 ASSEMBLE_CHECKED_LOAD_INTEGER(Ldrh); |
941 break; | 969 break; |
942 case kCheckedLoadWord32: | 970 case kCheckedLoadWord32: |
943 ASSEMBLE_CHECKED_LOAD_INTEGER(Ldr); | 971 ASSEMBLE_CHECKED_LOAD_INTEGER(Ldr); |
944 break; | 972 break; |
| 973 case kCheckedLoadWord64: |
| 974 ASSEMBLE_CHECKED_LOAD_INTEGER_64(Ldr); |
| 975 break; |
945 case kCheckedLoadFloat32: | 976 case kCheckedLoadFloat32: |
946 ASSEMBLE_CHECKED_LOAD_FLOAT(32); | 977 ASSEMBLE_CHECKED_LOAD_FLOAT(32); |
947 break; | 978 break; |
948 case kCheckedLoadFloat64: | 979 case kCheckedLoadFloat64: |
949 ASSEMBLE_CHECKED_LOAD_FLOAT(64); | 980 ASSEMBLE_CHECKED_LOAD_FLOAT(64); |
950 break; | 981 break; |
951 case kCheckedStoreWord8: | 982 case kCheckedStoreWord8: |
952 ASSEMBLE_CHECKED_STORE_INTEGER(Strb); | 983 ASSEMBLE_CHECKED_STORE_INTEGER(Strb); |
953 break; | 984 break; |
954 case kCheckedStoreWord16: | 985 case kCheckedStoreWord16: |
955 ASSEMBLE_CHECKED_STORE_INTEGER(Strh); | 986 ASSEMBLE_CHECKED_STORE_INTEGER(Strh); |
956 break; | 987 break; |
957 case kCheckedStoreWord32: | 988 case kCheckedStoreWord32: |
958 ASSEMBLE_CHECKED_STORE_INTEGER(Str); | 989 ASSEMBLE_CHECKED_STORE_INTEGER(Str); |
959 break; | 990 break; |
| 991 case kCheckedStoreWord64: |
| 992 ASSEMBLE_CHECKED_STORE_INTEGER_64(Str); |
| 993 break; |
960 case kCheckedStoreFloat32: | 994 case kCheckedStoreFloat32: |
961 ASSEMBLE_CHECKED_STORE_FLOAT(32); | 995 ASSEMBLE_CHECKED_STORE_FLOAT(32); |
962 break; | 996 break; |
963 case kCheckedStoreFloat64: | 997 case kCheckedStoreFloat64: |
964 ASSEMBLE_CHECKED_STORE_FLOAT(64); | 998 ASSEMBLE_CHECKED_STORE_FLOAT(64); |
965 break; | 999 break; |
966 } | 1000 } |
967 } // NOLINT(readability/fn_size) | 1001 } // NOLINT(readability/fn_size) |
968 | 1002 |
969 | 1003 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 padding_size -= kInstructionSize; | 1400 padding_size -= kInstructionSize; |
1367 } | 1401 } |
1368 } | 1402 } |
1369 } | 1403 } |
1370 | 1404 |
1371 #undef __ | 1405 #undef __ |
1372 | 1406 |
1373 } // namespace compiler | 1407 } // namespace compiler |
1374 } // namespace internal | 1408 } // namespace internal |
1375 } // namespace v8 | 1409 } // namespace v8 |
OLD | NEW |