| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 static bool CanEncodeBranchOffset(int32_t offset) { | 46 static bool CanEncodeBranchOffset(int32_t offset) { |
| 47 ASSERT(Utils::IsAligned(offset, 4)); | 47 ASSERT(Utils::IsAligned(offset, 4)); |
| 48 return Utils::IsInt(18, offset); | 48 return Utils::IsInt(18, offset); |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t instr) { | 52 int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t instr) { |
| 53 if (!CanEncodeBranchOffset(offset)) { | 53 if (!CanEncodeBranchOffset(offset)) { |
| 54 ASSERT(!use_far_branches()); | 54 ASSERT(!use_far_branches()); |
| 55 const Error& error = Error::Handle(LanguageError::New( | 55 Isolate::Current()->long_jump_base()->Jump( |
| 56 String::Handle(String::New("Branch offset overflow")))); | 56 1, Object::branch_offset_error()); |
| 57 Isolate::Current()->long_jump_base()->Jump(1, error); | |
| 58 } | 57 } |
| 59 | 58 |
| 60 // Properly preserve only the bits supported in the instruction. | 59 // Properly preserve only the bits supported in the instruction. |
| 61 offset >>= 2; | 60 offset >>= 2; |
| 62 offset &= kBranchOffsetMask; | 61 offset &= kBranchOffsetMask; |
| 63 return (instr & ~kBranchOffsetMask) | offset; | 62 return (instr & ~kBranchOffsetMask) | offset; |
| 64 } | 63 } |
| 65 | 64 |
| 66 | 65 |
| 67 static int DecodeBranchOffset(int32_t instr) { | 66 static int DecodeBranchOffset(int32_t instr) { |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 Bind(&msg); | 977 Bind(&msg); |
| 979 break_(Instr::kMsgMessageCode); | 978 break_(Instr::kMsgMessageCode); |
| 980 } | 979 } |
| 981 #endif | 980 #endif |
| 982 } | 981 } |
| 983 | 982 |
| 984 } // namespace dart | 983 } // namespace dart |
| 985 | 984 |
| 986 #endif // defined TARGET_ARCH_MIPS | 985 #endif // defined TARGET_ARCH_MIPS |
| 987 | 986 |
| OLD | NEW |