| 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 20 matching lines...) Expand all Loading... |
| 31 // The original source code covered by the above license above has been | 31 // The original source code covered by the above license above has been |
| 32 // modified significantly by Google Inc. | 32 // modified significantly by Google Inc. |
| 33 // Copyright 2012 the V8 project authors. All rights reserved. | 33 // Copyright 2012 the V8 project authors. All rights reserved. |
| 34 | 34 |
| 35 | 35 |
| 36 #ifndef V8_MIPS_ASSEMBLER_MIPS_H_ | 36 #ifndef V8_MIPS_ASSEMBLER_MIPS_H_ |
| 37 #define V8_MIPS_ASSEMBLER_MIPS_H_ | 37 #define V8_MIPS_ASSEMBLER_MIPS_H_ |
| 38 | 38 |
| 39 #include <stdio.h> | 39 #include <stdio.h> |
| 40 | 40 |
| 41 #include <tr1/unordered_set> | |
| 42 | |
| 43 #include "src/assembler.h" | 41 #include "src/assembler.h" |
| 44 #include "src/mips/constants-mips.h" | 42 #include "src/mips/constants-mips.h" |
| 45 #include "src/serialize.h" | 43 #include "src/serialize.h" |
| 46 | 44 |
| 47 namespace v8 { | 45 namespace v8 { |
| 48 namespace internal { | 46 namespace internal { |
| 49 | 47 |
| 50 // CPU Registers. | 48 // CPU Registers. |
| 51 // | 49 // |
| 52 // 1) We would prefer to use an enum, but enum values are assignment- | 50 // 1) We would prefer to use an enum, but enum values are assignment- |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 | 1014 |
| 1017 // Record a comment relocation entry that can be used by a disassembler. | 1015 // Record a comment relocation entry that can be used by a disassembler. |
| 1018 // Use --code-comments to enable. | 1016 // Use --code-comments to enable. |
| 1019 void RecordComment(const char* msg); | 1017 void RecordComment(const char* msg); |
| 1020 | 1018 |
| 1021 // Record a deoptimization reason that can be used by a log or cpu profiler. | 1019 // Record a deoptimization reason that can be used by a log or cpu profiler. |
| 1022 // Use --trace-deopt to enable. | 1020 // Use --trace-deopt to enable. |
| 1023 void RecordDeoptReason(const int reason, const int raw_position); | 1021 void RecordDeoptReason(const int reason, const int raw_position); |
| 1024 | 1022 |
| 1025 | 1023 |
| 1026 static int RelocateInternalReference(RelocInfo::Mode rmode, byte* pc, | 1024 static int RelocateInternalReference(byte* pc, intptr_t pc_delta); |
| 1027 intptr_t pc_delta); | |
| 1028 | 1025 |
| 1029 // Writes a single byte or word of data in the code stream. Used for | 1026 // Writes a single byte or word of data in the code stream. Used for |
| 1030 // inline tables, e.g., jump-tables. | 1027 // inline tables, e.g., jump-tables. |
| 1031 void db(uint8_t data); | 1028 void db(uint8_t data); |
| 1032 void dd(uint32_t data); | 1029 void dd(uint32_t data); |
| 1033 void dd(Label* label); | 1030 void dd(Label* label); |
| 1034 | 1031 |
| 1035 // Emits the address of the code stub's first instruction. | 1032 // Emits the address of the code stub's first instruction. |
| 1036 void emit_code_stub_address(Code* stub); | 1033 void emit_code_stub_address(Code* stub); |
| 1037 | 1034 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 | 1119 |
| 1123 protected: | 1120 protected: |
| 1124 // Relocation for a type-recording IC has the AST id added to it. This | 1121 // Relocation for a type-recording IC has the AST id added to it. This |
| 1125 // member variable is a way to pass the information from the call site to | 1122 // member variable is a way to pass the information from the call site to |
| 1126 // the relocation info. | 1123 // the relocation info. |
| 1127 TypeFeedbackId recorded_ast_id_; | 1124 TypeFeedbackId recorded_ast_id_; |
| 1128 | 1125 |
| 1129 int32_t buffer_space() const { return reloc_info_writer.pos() - pc_; } | 1126 int32_t buffer_space() const { return reloc_info_writer.pos() - pc_; } |
| 1130 | 1127 |
| 1131 // Decode branch instruction at pos and return branch target pos. | 1128 // Decode branch instruction at pos and return branch target pos. |
| 1132 int target_at(int32_t pos, bool is_internal); | 1129 int target_at(int32_t pos); |
| 1133 | 1130 |
| 1134 // Patch branch instruction at pos to branch to given branch target pos. | 1131 // Patch branch instruction at pos to branch to given branch target pos. |
| 1135 void target_at_put(int32_t pos, int32_t target_pos, bool is_internal); | 1132 void target_at_put(int32_t pos, int32_t target_pos); |
| 1136 | 1133 |
| 1137 // Say if we need to relocate with this mode. | 1134 // Say if we need to relocate with this mode. |
| 1138 bool MustUseReg(RelocInfo::Mode rmode); | 1135 bool MustUseReg(RelocInfo::Mode rmode); |
| 1139 | 1136 |
| 1140 // Record reloc info for current pc_. | 1137 // Record reloc info for current pc_. |
| 1141 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); | 1138 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
| 1142 | 1139 |
| 1143 // Block the emission of the trampoline pool before pc_offset. | 1140 // Block the emission of the trampoline pool before pc_offset. |
| 1144 void BlockTrampolinePoolBefore(int pc_offset) { | 1141 void BlockTrampolinePoolBefore(int pc_offset) { |
| 1145 if (no_trampoline_pool_before_ < pc_offset) | 1142 if (no_trampoline_pool_before_ < pc_offset) |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 | 1291 |
| 1295 void GenInstrJump(Opcode opcode, | 1292 void GenInstrJump(Opcode opcode, |
| 1296 uint32_t address); | 1293 uint32_t address); |
| 1297 | 1294 |
| 1298 // Helpers. | 1295 // Helpers. |
| 1299 void LoadRegPlusOffsetToAt(const MemOperand& src); | 1296 void LoadRegPlusOffsetToAt(const MemOperand& src); |
| 1300 | 1297 |
| 1301 // Labels. | 1298 // Labels. |
| 1302 void print(Label* L); | 1299 void print(Label* L); |
| 1303 void bind_to(Label* L, int pos); | 1300 void bind_to(Label* L, int pos); |
| 1304 void next(Label* L, bool is_internal); | 1301 void next(Label* L); |
| 1305 | 1302 |
| 1306 // One trampoline consists of: | 1303 // One trampoline consists of: |
| 1307 // - space for trampoline slots, | 1304 // - space for trampoline slots, |
| 1308 // - space for labels. | 1305 // - space for labels. |
| 1309 // | 1306 // |
| 1310 // Space for trampoline slots is equal to slot_count * 2 * kInstrSize. | 1307 // Space for trampoline slots is equal to slot_count * 2 * kInstrSize. |
| 1311 // Space for trampoline slots preceeds space for labels. Each label is of one | 1308 // Space for trampoline slots preceeds space for labels. Each label is of one |
| 1312 // instruction size, so total amount for labels is equal to | 1309 // instruction size, so total amount for labels is equal to |
| 1313 // label_count * kInstrSize. | 1310 // label_count * kInstrSize. |
| 1314 class Trampoline { | 1311 class Trampoline { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 // If trampoline is emitted, generated code is becoming large. As this is | 1356 // If trampoline is emitted, generated code is becoming large. As this is |
| 1360 // already a slow case which can possibly break our code generation for the | 1357 // already a slow case which can possibly break our code generation for the |
| 1361 // extreme case, we use this information to trigger different mode of | 1358 // extreme case, we use this information to trigger different mode of |
| 1362 // branch instruction generation, where we use jump instructions rather | 1359 // branch instruction generation, where we use jump instructions rather |
| 1363 // than regular branch instructions. | 1360 // than regular branch instructions. |
| 1364 bool trampoline_emitted_; | 1361 bool trampoline_emitted_; |
| 1365 static const int kTrampolineSlotsSize = 4 * kInstrSize; | 1362 static const int kTrampolineSlotsSize = 4 * kInstrSize; |
| 1366 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; | 1363 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; |
| 1367 static const int kInvalidSlotPos = -1; | 1364 static const int kInvalidSlotPos = -1; |
| 1368 | 1365 |
| 1369 // Internal reference positions, required for unbounded internal reference | |
| 1370 // labels. | |
| 1371 std::tr1::unordered_set<int> internal_reference_positions_; | |
| 1372 | |
| 1373 Trampoline trampoline_; | 1366 Trampoline trampoline_; |
| 1374 bool internal_trampoline_exception_; | 1367 bool internal_trampoline_exception_; |
| 1375 | 1368 |
| 1376 friend class RegExpMacroAssemblerMIPS; | 1369 friend class RegExpMacroAssemblerMIPS; |
| 1377 friend class RelocInfo; | 1370 friend class RelocInfo; |
| 1378 friend class CodePatcher; | 1371 friend class CodePatcher; |
| 1379 friend class BlockTrampolinePoolScope; | 1372 friend class BlockTrampolinePoolScope; |
| 1380 | 1373 |
| 1381 PositionsRecorder positions_recorder_; | 1374 PositionsRecorder positions_recorder_; |
| 1382 friend class PositionsRecorder; | 1375 friend class PositionsRecorder; |
| 1383 friend class EnsureSpace; | 1376 friend class EnsureSpace; |
| 1384 }; | 1377 }; |
| 1385 | 1378 |
| 1386 | 1379 |
| 1387 class EnsureSpace BASE_EMBEDDED { | 1380 class EnsureSpace BASE_EMBEDDED { |
| 1388 public: | 1381 public: |
| 1389 explicit EnsureSpace(Assembler* assembler) { | 1382 explicit EnsureSpace(Assembler* assembler) { |
| 1390 assembler->CheckBuffer(); | 1383 assembler->CheckBuffer(); |
| 1391 } | 1384 } |
| 1392 }; | 1385 }; |
| 1393 | 1386 |
| 1394 } } // namespace v8::internal | 1387 } } // namespace v8::internal |
| 1395 | 1388 |
| 1396 #endif // V8_ARM_ASSEMBLER_MIPS_H_ | 1389 #endif // V8_ARM_ASSEMBLER_MIPS_H_ |
| OLD | NEW |