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

Side by Side Diff: src/arm/assembler-arm.h

Issue 11191029: Use VLDR instead of VMOVs from GPR when a 64-bit double can't be encoded as a VMOV immediate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix comment by ulan: remove badly merged code (redundant). Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm/assembler-arm.cc » ('j') | src/arm/assembler-arm.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 *reinterpret_cast<Instr*>(buffer_ + pos) = instr; 1284 *reinterpret_cast<Instr*>(buffer_ + pos) = instr;
1285 } 1285 }
1286 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } 1286 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); }
1287 static void instr_at_put(byte* pc, Instr instr) { 1287 static void instr_at_put(byte* pc, Instr instr) {
1288 *reinterpret_cast<Instr*>(pc) = instr; 1288 *reinterpret_cast<Instr*>(pc) = instr;
1289 } 1289 }
1290 static Condition GetCondition(Instr instr); 1290 static Condition GetCondition(Instr instr);
1291 static bool IsBranch(Instr instr); 1291 static bool IsBranch(Instr instr);
1292 static int GetBranchOffset(Instr instr); 1292 static int GetBranchOffset(Instr instr);
1293 static bool IsLdrRegisterImmediate(Instr instr); 1293 static bool IsLdrRegisterImmediate(Instr instr);
1294 static bool IsVldrDRegisterImmediate(Instr instr);
1294 static int GetLdrRegisterImmediateOffset(Instr instr); 1295 static int GetLdrRegisterImmediateOffset(Instr instr);
1296 static int GetVldrDRegisterImmediateOffset(Instr instr);
1295 static Instr SetLdrRegisterImmediateOffset(Instr instr, int offset); 1297 static Instr SetLdrRegisterImmediateOffset(Instr instr, int offset);
1298 static Instr SetVldrDRegisterImmediateOffset(Instr instr, int offset);
1296 static bool IsStrRegisterImmediate(Instr instr); 1299 static bool IsStrRegisterImmediate(Instr instr);
1297 static Instr SetStrRegisterImmediateOffset(Instr instr, int offset); 1300 static Instr SetStrRegisterImmediateOffset(Instr instr, int offset);
1298 static bool IsAddRegisterImmediate(Instr instr); 1301 static bool IsAddRegisterImmediate(Instr instr);
1299 static Instr SetAddRegisterImmediateOffset(Instr instr, int offset); 1302 static Instr SetAddRegisterImmediateOffset(Instr instr, int offset);
1300 static Register GetRd(Instr instr); 1303 static Register GetRd(Instr instr);
1301 static Register GetRn(Instr instr); 1304 static Register GetRn(Instr instr);
1302 static Register GetRm(Instr instr); 1305 static Register GetRm(Instr instr);
1303 static bool IsPush(Instr instr); 1306 static bool IsPush(Instr instr);
1304 static bool IsPop(Instr instr); 1307 static bool IsPop(Instr instr);
1305 static bool IsStrRegFpOffset(Instr instr); 1308 static bool IsStrRegFpOffset(Instr instr);
1306 static bool IsLdrRegFpOffset(Instr instr); 1309 static bool IsLdrRegFpOffset(Instr instr);
1307 static bool IsStrRegFpNegOffset(Instr instr); 1310 static bool IsStrRegFpNegOffset(Instr instr);
1308 static bool IsLdrRegFpNegOffset(Instr instr); 1311 static bool IsLdrRegFpNegOffset(Instr instr);
1309 static bool IsLdrPcImmediateOffset(Instr instr); 1312 static bool IsLdrPcImmediateOffset(Instr instr);
1313 static bool IsVldrDPcImmediateOffset(Instr instr);
1310 static bool IsTstImmediate(Instr instr); 1314 static bool IsTstImmediate(Instr instr);
1311 static bool IsCmpRegister(Instr instr); 1315 static bool IsCmpRegister(Instr instr);
1312 static bool IsCmpImmediate(Instr instr); 1316 static bool IsCmpImmediate(Instr instr);
1313 static Register GetCmpImmediateRegister(Instr instr); 1317 static Register GetCmpImmediateRegister(Instr instr);
1314 static int GetCmpImmediateRawImmediate(Instr instr); 1318 static int GetCmpImmediateRawImmediate(Instr instr);
1315 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); 1319 static bool IsNop(Instr instr, int type = NON_MARKING_NOP);
1316 static bool IsMovT(Instr instr); 1320 static bool IsMovT(Instr instr);
1317 static bool IsMovW(Instr instr); 1321 static bool IsMovW(Instr instr);
1318 1322
1319 // Constants in pools are accessed via pc relative addressing, which can 1323 // Constants in pools are accessed via pc relative addressing, which can
1320 // reach +/-4KB thereby defining a maximum distance between the instruction 1324 // reach +/-4KB for integer PC-relative loads and +/-1KB for floating-point
1321 // and the accessed constant. 1325 // PC-relative loads, thereby defining a maximum distance between the
1322 static const int kMaxDistToPool = 4*KB; 1326 // instruction and the accessed constant.
1323 static const int kMaxNumPendingRelocInfo = kMaxDistToPool/kInstrSize; 1327 static const int kMaxDistToIntPool = 4*KB;
1324 STATIC_ASSERT((kConstantPoolLengthMaxMask & kMaxNumPendingRelocInfo) == 1328 static const int kMaxDistToFPPool = 1*KB;
1325 kMaxNumPendingRelocInfo); 1329 // All relocations could be integer, it therefore acts as the limit.
1330 static const int kMaxNumPendingRelocInfo = kMaxDistToIntPool/kInstrSize;
1326 1331
1327 // Postpone the generation of the constant pool for the specified number of 1332 // Postpone the generation of the constant pool for the specified number of
1328 // instructions. 1333 // instructions.
1329 void BlockConstPoolFor(int instructions); 1334 void BlockConstPoolFor(int instructions);
1330 1335
1331 // Check if is time to emit a constant pool. 1336 // Check if is time to emit a constant pool.
1332 void CheckConstPool(bool force_emit, bool require_jump); 1337 void CheckConstPool(bool force_emit, bool require_jump);
1333 1338
1334 protected: 1339 protected:
1335 // Relocation for a type-recording IC has the AST id added to it. This 1340 // Relocation for a type-recording IC has the AST id added to it. This
(...skipping 19 matching lines...) Expand all
1355 next_buffer_check_ = kMaxInt; 1360 next_buffer_check_ = kMaxInt;
1356 } 1361 }
1357 } 1362 }
1358 1363
1359 // Resume constant pool emission. Need to be called as many time as 1364 // Resume constant pool emission. Need to be called as many time as
1360 // StartBlockConstPool to have an effect. 1365 // StartBlockConstPool to have an effect.
1361 void EndBlockConstPool() { 1366 void EndBlockConstPool() {
1362 if (--const_pool_blocked_nesting_ == 0) { 1367 if (--const_pool_blocked_nesting_ == 0) {
1363 // Check the constant pool hasn't been blocked for too long. 1368 // Check the constant pool hasn't been blocked for too long.
1364 ASSERT((num_pending_reloc_info_ == 0) || 1369 ASSERT((num_pending_reloc_info_ == 0) ||
1365 (pc_offset() < (first_const_pool_use_ + kMaxDistToPool))); 1370 (pc_offset() < (first_const_pool_use_ + kMaxDistToIntPool)));
1371 ASSERT((num_pending_64_bit_reloc_info_ == 0) ||
1372 (pc_offset() < (first_const_pool_use_ + kMaxDistToFPPool)));
1366 // Two cases: 1373 // Two cases:
1367 // * no_const_pool_before_ >= next_buffer_check_ and the emission is 1374 // * no_const_pool_before_ >= next_buffer_check_ and the emission is
1368 // still blocked 1375 // still blocked
1369 // * no_const_pool_before_ < next_buffer_check_ and the next emit will 1376 // * no_const_pool_before_ < next_buffer_check_ and the next emit will
1370 // trigger a check. 1377 // trigger a check.
1371 next_buffer_check_ = no_const_pool_before_; 1378 next_buffer_check_ = no_const_pool_before_;
1372 } 1379 }
1373 } 1380 }
1374 1381
1375 bool is_const_pool_blocked() const { 1382 bool is_const_pool_blocked() const {
(...skipping 22 matching lines...) Expand all
1398 // if so, a relocation info entry is associated to the constant pool entry. 1405 // if so, a relocation info entry is associated to the constant pool entry.
1399 1406
1400 // Repeated checking whether the constant pool should be emitted is rather 1407 // Repeated checking whether the constant pool should be emitted is rather
1401 // expensive. By default we only check again once a number of instructions 1408 // expensive. By default we only check again once a number of instructions
1402 // has been generated. That also means that the sizing of the buffers is not 1409 // has been generated. That also means that the sizing of the buffers is not
1403 // an exact science, and that we rely on some slop to not overrun buffers. 1410 // an exact science, and that we rely on some slop to not overrun buffers.
1404 static const int kCheckPoolIntervalInst = 32; 1411 static const int kCheckPoolIntervalInst = 32;
1405 static const int kCheckPoolInterval = kCheckPoolIntervalInst * kInstrSize; 1412 static const int kCheckPoolInterval = kCheckPoolIntervalInst * kInstrSize;
1406 1413
1407 1414
1408 // Average distance beetween a constant pool and the first instruction
1409 // accessing the constant pool. Longer distance should result in less I-cache
1410 // pollution.
1411 // In practice the distance will be smaller since constant pool emission is
1412 // forced after function return and sometimes after unconditional branches.
1413 static const int kAvgDistToPool = kMaxDistToPool - kCheckPoolInterval;
1414
1415 // Emission of the constant pool may be blocked in some code sequences. 1415 // Emission of the constant pool may be blocked in some code sequences.
1416 int const_pool_blocked_nesting_; // Block emission if this is not zero. 1416 int const_pool_blocked_nesting_; // Block emission if this is not zero.
1417 int no_const_pool_before_; // Block emission before this pc offset. 1417 int no_const_pool_before_; // Block emission before this pc offset.
1418 1418
1419 // Keep track of the first instruction requiring a constant pool entry 1419 // Keep track of the first instruction requiring a constant pool entry
1420 // since the previous constant pool was emitted. 1420 // since the previous constant pool was emitted.
1421 int first_const_pool_use_; 1421 int first_const_pool_use_;
1422 1422
1423 // Relocation info generation 1423 // Relocation info generation
1424 // Each relocation is encoded as a variable size value 1424 // Each relocation is encoded as a variable size value
1425 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; 1425 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize;
1426 RelocInfoWriter reloc_info_writer; 1426 RelocInfoWriter reloc_info_writer;
1427 1427
1428 // Relocation info records are also used during code generation as temporary 1428 // Relocation info records are also used during code generation as temporary
1429 // containers for constants and code target addresses until they are emitted 1429 // containers for constants and code target addresses until they are emitted
1430 // to the constant pool. These pending relocation info records are temporarily 1430 // to the constant pool. These pending relocation info records are temporarily
1431 // stored in a separate buffer until a constant pool is emitted. 1431 // stored in a separate buffer until a constant pool is emitted.
1432 // If every instruction in a long sequence is accessing the pool, we need one 1432 // If every instruction in a long sequence is accessing the pool, we need one
1433 // pending relocation entry per instruction. 1433 // pending relocation entry per instruction.
1434 1434
1435 // the buffer of pending relocation info 1435 // the buffer of pending relocation info
1436 RelocInfo pending_reloc_info_[kMaxNumPendingRelocInfo]; 1436 RelocInfo pending_reloc_info_[kMaxNumPendingRelocInfo];
1437 // number of pending reloc info entries in the buffer 1437 // number of pending reloc info entries in the buffer
1438 int num_pending_reloc_info_; 1438 int num_pending_reloc_info_;
1439 // Number of pending reloc info entries included above which also happen to
1440 // be 64-bit.
1441 int num_pending_64_bit_reloc_info_;
1439 1442
1440 // The bound position, before this we cannot do instruction elimination. 1443 // The bound position, before this we cannot do instruction elimination.
1441 int last_bound_pos_; 1444 int last_bound_pos_;
1442 1445
1443 // Code emission 1446 // Code emission
1444 inline void CheckBuffer(); 1447 inline void CheckBuffer();
1445 void GrowBuffer(); 1448 void GrowBuffer();
1446 inline void emit(Instr x); 1449 inline void emit(Instr x);
1447 1450
1448 // 32-bit immediate values 1451 // 32-bit immediate values
(...skipping 16 matching lines...) Expand all
1465 void next(Label* L); 1468 void next(Label* L);
1466 1469
1467 enum UseConstantPoolMode { 1470 enum UseConstantPoolMode {
1468 USE_CONSTANT_POOL, 1471 USE_CONSTANT_POOL,
1469 DONT_USE_CONSTANT_POOL 1472 DONT_USE_CONSTANT_POOL
1470 }; 1473 };
1471 1474
1472 // Record reloc info for current pc_ 1475 // Record reloc info for current pc_
1473 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0, 1476 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0,
1474 UseConstantPoolMode mode = USE_CONSTANT_POOL); 1477 UseConstantPoolMode mode = USE_CONSTANT_POOL);
1478 void RecordRelocInfo(double data);
1479 void RecordRelocInfoConstantPoolEntryHelper(const RelocInfo& rinfo);
1475 1480
1476 friend class RegExpMacroAssemblerARM; 1481 friend class RegExpMacroAssemblerARM;
1477 friend class RelocInfo; 1482 friend class RelocInfo;
1478 friend class CodePatcher; 1483 friend class CodePatcher;
1479 friend class BlockConstPoolScope; 1484 friend class BlockConstPoolScope;
1480 1485
1481 PositionsRecorder positions_recorder_; 1486 PositionsRecorder positions_recorder_;
1482 friend class PositionsRecorder; 1487 friend class PositionsRecorder;
1483 friend class EnsureSpace; 1488 friend class EnsureSpace;
1484 }; 1489 };
1485 1490
1486 1491
1487 class EnsureSpace BASE_EMBEDDED { 1492 class EnsureSpace BASE_EMBEDDED {
1488 public: 1493 public:
1489 explicit EnsureSpace(Assembler* assembler) { 1494 explicit EnsureSpace(Assembler* assembler) {
1490 assembler->CheckBuffer(); 1495 assembler->CheckBuffer();
1491 } 1496 }
1492 }; 1497 };
1493 1498
1494 1499
1495 } } // namespace v8::internal 1500 } } // namespace v8::internal
1496 1501
1497 #endif // V8_ARM_ASSEMBLER_ARM_H_ 1502 #endif // V8_ARM_ASSEMBLER_ARM_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm/assembler-arm.cc » ('j') | src/arm/assembler-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698