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