 Chromium Code Reviews
 Chromium Code Reviews Issue 2039233005:
  Consider reloc info mode when merging constant pool entries 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 2039233005:
  Consider reloc info mode when merging constant pool entries 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| OLD | NEW | 
|---|---|
| 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 are | 5 // modification, are permitted provided that the following conditions are | 
| 6 // met: | 6 // 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 DEOPT_ID, // Deoptimization inlining id. | 419 DEOPT_ID, // Deoptimization inlining id. | 
| 420 | 420 | 
| 421 // This is not an actual reloc mode, but used to encode a long pc jump that | 421 // This is not an actual reloc mode, but used to encode a long pc jump that | 
| 422 // cannot be encoded as part of another record. | 422 // cannot be encoded as part of another record. | 
| 423 PC_JUMP, | 423 PC_JUMP, | 
| 424 | 424 | 
| 425 // Pseudo-types | 425 // Pseudo-types | 
| 426 NUMBER_OF_MODES, | 426 NUMBER_OF_MODES, | 
| 427 NONE32, // never recorded 32-bit value | 427 NONE32, // never recorded 32-bit value | 
| 428 NONE64, // never recorded 64-bit value | 428 NONE64, // never recorded 64-bit value | 
| 429 NONEINTPTR, // never recorded intptr value | |
| 
bradnelson
2016/06/08 00:58:32
Maybe highlight in the commit message that you're
 
Mircea Trofin
2016/06/08 03:32:16
Done.
 | |
| 429 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by | 430 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by | 
| 430 // code aging. | 431 // code aging. | 
| 431 | 432 | 
| 432 FIRST_REAL_RELOC_MODE = CODE_TARGET, | 433 FIRST_REAL_RELOC_MODE = CODE_TARGET, | 
| 433 LAST_REAL_RELOC_MODE = VENEER_POOL, | 434 LAST_REAL_RELOC_MODE = VENEER_POOL, | 
| 434 LAST_CODE_ENUM = DEBUGGER_STATEMENT, | 435 LAST_CODE_ENUM = DEBUGGER_STATEMENT, | 
| 435 LAST_GCED_ENUM = WASM_MEMORY_SIZE_REFERENCE, | 436 LAST_GCED_ENUM = WASM_MEMORY_SIZE_REFERENCE, | 
| 436 FIRST_SHAREABLE_RELOC_MODE = CELL, | 437 FIRST_SHAREABLE_RELOC_MODE = CELL, | 
| 437 }; | 438 }; | 
| 438 | 439 | 
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 static inline bool IsDebugBreakSlotAtCall(Mode mode) { | 509 static inline bool IsDebugBreakSlotAtCall(Mode mode) { | 
| 509 return mode == DEBUG_BREAK_SLOT_AT_CALL; | 510 return mode == DEBUG_BREAK_SLOT_AT_CALL; | 
| 510 } | 511 } | 
| 511 static inline bool IsDebugBreakSlotAtTailCall(Mode mode) { | 512 static inline bool IsDebugBreakSlotAtTailCall(Mode mode) { | 
| 512 return mode == DEBUG_BREAK_SLOT_AT_TAIL_CALL; | 513 return mode == DEBUG_BREAK_SLOT_AT_TAIL_CALL; | 
| 513 } | 514 } | 
| 514 static inline bool IsDebuggerStatement(Mode mode) { | 515 static inline bool IsDebuggerStatement(Mode mode) { | 
| 515 return mode == DEBUGGER_STATEMENT; | 516 return mode == DEBUGGER_STATEMENT; | 
| 516 } | 517 } | 
| 517 static inline bool IsNone(Mode mode) { | 518 static inline bool IsNone(Mode mode) { | 
| 518 return mode == NONE32 || mode == NONE64; | 519 return mode == NONE32 || mode == NONE64 || mode == NONEINTPTR; | 
| 519 } | 520 } | 
| 520 static inline bool IsCodeAgeSequence(Mode mode) { | 521 static inline bool IsCodeAgeSequence(Mode mode) { | 
| 521 return mode == CODE_AGE_SEQUENCE; | 522 return mode == CODE_AGE_SEQUENCE; | 
| 522 } | 523 } | 
| 523 static inline bool IsGeneratorContinuation(Mode mode) { | 524 static inline bool IsGeneratorContinuation(Mode mode) { | 
| 524 return mode == GENERATOR_CONTINUATION; | 525 return mode == GENERATOR_CONTINUATION; | 
| 525 } | 526 } | 
| 526 static inline bool IsWasmMemoryReference(Mode mode) { | 527 static inline bool IsWasmMemoryReference(Mode mode) { | 
| 527 return mode == WASM_MEMORY_REFERENCE; | 528 return mode == WASM_MEMORY_REFERENCE; | 
| 528 } | 529 } | 
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1222 virtual bool NeedsDebugStepCheck() const { return true; } | 1223 virtual bool NeedsDebugStepCheck() const { return true; } | 
| 1223 }; | 1224 }; | 
| 1224 | 1225 | 
| 1225 | 1226 | 
| 1226 // ----------------------------------------------------------------------------- | 1227 // ----------------------------------------------------------------------------- | 
| 1227 // Constant pool support | 1228 // Constant pool support | 
| 1228 | 1229 | 
| 1229 class ConstantPoolEntry { | 1230 class ConstantPoolEntry { | 
| 1230 public: | 1231 public: | 
| 1231 ConstantPoolEntry() {} | 1232 ConstantPoolEntry() {} | 
| 1232 ConstantPoolEntry(int position, intptr_t value, bool sharing_ok) | 1233 ConstantPoolEntry(int position, intptr_t value, bool sharing_ok, | 
| 1234 RelocInfo::Mode rmode) | |
| 1233 : position_(position), | 1235 : position_(position), | 
| 1234 merged_index_(sharing_ok ? SHARING_ALLOWED : SHARING_PROHIBITED), | 1236 merged_index_(sharing_ok ? SHARING_ALLOWED : SHARING_PROHIBITED), | 
| 1237 rmode_(rmode), | |
| 1235 value_(value) {} | 1238 value_(value) {} | 
| 1236 ConstantPoolEntry(int position, double value) | 1239 ConstantPoolEntry(int position, double value) | 
| 1237 : position_(position), merged_index_(SHARING_ALLOWED), value64_(value) {} | 1240 : position_(position), | 
| 1241 merged_index_(SHARING_ALLOWED), | |
| 1242 rmode_(RelocInfo::NONE64), | |
| 1243 value64_(value) {} | |
| 1238 | 1244 | 
| 1239 int position() const { return position_; } | 1245 int position() const { return position_; } | 
| 1240 bool sharing_ok() const { return merged_index_ != SHARING_PROHIBITED; } | 1246 bool sharing_ok() const { return merged_index_ != SHARING_PROHIBITED; } | 
| 1241 bool is_merged() const { return merged_index_ >= 0; } | 1247 bool is_merged() const { return merged_index_ >= 0; } | 
| 1242 int merged_index(void) const { | 1248 int merged_index(void) const { | 
| 1243 DCHECK(is_merged()); | 1249 DCHECK(is_merged()); | 
| 1244 return merged_index_; | 1250 return merged_index_; | 
| 1245 } | 1251 } | 
| 1246 void set_merged_index(int index) { | 1252 void set_merged_index(int index) { | 
| 1247 merged_index_ = index; | 1253 merged_index_ = index; | 
| 1248 DCHECK(is_merged()); | 1254 DCHECK(is_merged()); | 
| 1249 } | 1255 } | 
| 1250 int offset(void) const { | 1256 int offset(void) const { | 
| 1251 DCHECK(merged_index_ >= 0); | 1257 DCHECK(merged_index_ >= 0); | 
| 1252 return merged_index_; | 1258 return merged_index_; | 
| 1253 } | 1259 } | 
| 1254 void set_offset(int offset) { | 1260 void set_offset(int offset) { | 
| 1255 DCHECK(offset >= 0); | 1261 DCHECK(offset >= 0); | 
| 1256 merged_index_ = offset; | 1262 merged_index_ = offset; | 
| 1257 } | 1263 } | 
| 1258 intptr_t value() const { return value_; } | 1264 intptr_t value() const { return value_; } | 
| 1259 uint64_t value64() const { return bit_cast<uint64_t>(value64_); } | 1265 uint64_t value64() const { return bit_cast<uint64_t>(value64_); } | 
| 1266 bool IntValueMayBeMergedWith(ConstantPoolEntry& other) const { | |
| 1267 return rmode_ == other.rmode_ && value() == other.value(); | |
| 
bradnelson
2016/06/08 00:58:32
Why not have this handle checking both the 32/64 c
 
Mircea Trofin
2016/06/08 03:32:16
See my previous comment about the scope of this ch
 | |
| 1268 } | |
| 1260 | 1269 | 
| 1261 enum Type { INTPTR, DOUBLE, NUMBER_OF_TYPES }; | 1270 enum Type { INTPTR, DOUBLE, NUMBER_OF_TYPES }; | 
| 1262 | 1271 | 
| 1263 static int size(Type type) { | 1272 static int size(Type type) { | 
| 1264 return (type == INTPTR) ? kPointerSize : kDoubleSize; | 1273 return (type == INTPTR) ? kPointerSize : kDoubleSize; | 
| 1265 } | 1274 } | 
| 1266 | 1275 | 
| 1267 enum Access { REGULAR, OVERFLOWED }; | 1276 enum Access { REGULAR, OVERFLOWED }; | 
| 1268 | 1277 | 
| 1269 private: | 1278 private: | 
| 1270 int position_; | 1279 int position_; | 
| 1271 int merged_index_; | 1280 int merged_index_; | 
| 1281 RelocInfo::Mode rmode_; | |
| 1272 union { | 1282 union { | 
| 1273 intptr_t value_; | 1283 intptr_t value_; | 
| 1274 double value64_; | 1284 double value64_; | 
| 1275 }; | 1285 }; | 
| 1276 enum { SHARING_PROHIBITED = -2, SHARING_ALLOWED = -1 }; | 1286 enum { SHARING_PROHIBITED = -2, SHARING_ALLOWED = -1 }; | 
| 1277 }; | 1287 }; | 
| 1278 | 1288 | 
| 1279 | 1289 | 
| 1280 // ----------------------------------------------------------------------------- | 1290 // ----------------------------------------------------------------------------- | 
| 1281 // Embedded constant pool support | 1291 // Embedded constant pool support | 
| 1282 | 1292 | 
| 1283 class ConstantPoolBuilder BASE_EMBEDDED { | 1293 class ConstantPoolBuilder BASE_EMBEDDED { | 
| 1284 public: | 1294 public: | 
| 1285 ConstantPoolBuilder(int ptr_reach_bits, int double_reach_bits); | 1295 ConstantPoolBuilder(int ptr_reach_bits, int double_reach_bits); | 
| 1286 | 1296 | 
| 1287 // Add pointer-sized constant to the embedded constant pool | 1297 // Add pointer-sized constant to the embedded constant pool | 
| 1288 ConstantPoolEntry::Access AddEntry(int position, intptr_t value, | 1298 ConstantPoolEntry::Access AddEntry( | 
| 1289 bool sharing_ok) { | 1299 int position, intptr_t value, bool sharing_ok, | 
| 1290 ConstantPoolEntry entry(position, value, sharing_ok); | 1300 RelocInfo::Mode rmode = RelocInfo::NONEINTPTR) { | 
| 1301 ConstantPoolEntry entry(position, value, sharing_ok, rmode); | |
| 1291 return AddEntry(entry, ConstantPoolEntry::INTPTR); | 1302 return AddEntry(entry, ConstantPoolEntry::INTPTR); | 
| 1292 } | 1303 } | 
| 1293 | 1304 | 
| 1294 // Add double constant to the embedded constant pool | 1305 // Add double constant to the embedded constant pool | 
| 1295 ConstantPoolEntry::Access AddEntry(int position, double value) { | 1306 ConstantPoolEntry::Access AddEntry(int position, double value) { | 
| 1296 ConstantPoolEntry entry(position, value); | 1307 ConstantPoolEntry entry(position, value); | 
| 1297 return AddEntry(entry, ConstantPoolEntry::DOUBLE); | 1308 return AddEntry(entry, ConstantPoolEntry::DOUBLE); | 
| 1298 } | 1309 } | 
| 1299 | 1310 | 
| 1300 // Previews the access type required for the next new entry to be added. | 1311 // Previews the access type required for the next new entry to be added. | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1338 std::vector<ConstantPoolEntry> shared_entries; | 1349 std::vector<ConstantPoolEntry> shared_entries; | 
| 1339 }; | 1350 }; | 
| 1340 | 1351 | 
| 1341 Label emitted_label_; // Records pc_offset of emitted pool | 1352 Label emitted_label_; // Records pc_offset of emitted pool | 
| 1342 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; | 1353 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; | 
| 1343 }; | 1354 }; | 
| 1344 | 1355 | 
| 1345 } // namespace internal | 1356 } // namespace internal | 
| 1346 } // namespace v8 | 1357 } // namespace v8 | 
| 1347 #endif // V8_ASSEMBLER_H_ | 1358 #endif // V8_ASSEMBLER_H_ | 
| OLD | NEW |