OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 <limits.h> | 5 #include <limits.h> |
6 #include <stdarg.h> | 6 #include <stdarg.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 3905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3916 // If needed update pc after the branch delay execution. | 3916 // If needed update pc after the branch delay execution. |
3917 if (next_pc != bad_ra) { | 3917 if (next_pc != bad_ra) { |
3918 set_pc(next_pc); | 3918 set_pc(next_pc); |
3919 } | 3919 } |
3920 } | 3920 } |
3921 | 3921 |
3922 | 3922 |
3923 // Type 3: instructions using a 26 bytes immediate. (e.g. j, jal). | 3923 // Type 3: instructions using a 26 bytes immediate. (e.g. j, jal). |
3924 void Simulator::DecodeTypeJump(Instruction* instr) { | 3924 void Simulator::DecodeTypeJump(Instruction* instr) { |
3925 // Get current pc. | 3925 // Get current pc. |
3926 int32_t current_pc = get_pc(); | 3926 int64_t current_pc = get_pc(); |
3927 // Get unchanged bits of pc. | 3927 // Get unchanged bits of pc. |
3928 int32_t pc_high_bits = current_pc & 0xf0000000; | 3928 int64_t pc_high_bits = current_pc & 0xfffffffff0000000; |
3929 // Next pc. | 3929 // Next pc. |
3930 int32_t next_pc = pc_high_bits | (instr->Imm26Value() << 2); | 3930 int64_t next_pc = pc_high_bits | (instr->Imm26Value() << 2); |
3931 | 3931 |
3932 // Execute branch delay slot. | 3932 // Execute branch delay slot. |
3933 // We don't check for end_sim_pc. First it should not be met as the current pc | 3933 // We don't check for end_sim_pc. First it should not be met as the current pc |
3934 // is valid. Secondly a jump should always execute its branch delay slot. | 3934 // is valid. Secondly a jump should always execute its branch delay slot. |
3935 Instruction* branch_delay_instr = | 3935 Instruction* branch_delay_instr = |
3936 reinterpret_cast<Instruction*>(current_pc + Instruction::kInstrSize); | 3936 reinterpret_cast<Instruction*>(current_pc + Instruction::kInstrSize); |
3937 BranchDelayInstructionDecode(branch_delay_instr); | 3937 BranchDelayInstructionDecode(branch_delay_instr); |
3938 | 3938 |
3939 // Update pc and ra if necessary. | 3939 // Update pc and ra if necessary. |
3940 // Do this after the branch delay execution. | 3940 // Do this after the branch delay execution. |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4180 return address; | 4180 return address; |
4181 } | 4181 } |
4182 | 4182 |
4183 | 4183 |
4184 #undef UNSUPPORTED | 4184 #undef UNSUPPORTED |
4185 } } // namespace v8::internal | 4185 } } // namespace v8::internal |
4186 | 4186 |
4187 #endif // USE_SIMULATOR | 4187 #endif // USE_SIMULATOR |
4188 | 4188 |
4189 #endif // V8_TARGET_ARCH_MIPS64 | 4189 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |