OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_S390 | 7 #if V8_TARGET_ARCH_S390 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1225 } | 1225 } |
1226 __ mov(code_pointer(), Operand(masm_->CodeObject())); | 1226 __ mov(code_pointer(), Operand(masm_->CodeObject())); |
1227 } | 1227 } |
1228 | 1228 |
1229 bool RegExpMacroAssemblerS390::CanReadUnaligned() { | 1229 bool RegExpMacroAssemblerS390::CanReadUnaligned() { |
1230 return CpuFeatures::IsSupported(UNALIGNED_ACCESSES) && !slow_safe(); | 1230 return CpuFeatures::IsSupported(UNALIGNED_ACCESSES) && !slow_safe(); |
1231 } | 1231 } |
1232 | 1232 |
1233 void RegExpMacroAssemblerS390::LoadCurrentCharacterUnchecked(int cp_offset, | 1233 void RegExpMacroAssemblerS390::LoadCurrentCharacterUnchecked(int cp_offset, |
1234 int characters) { | 1234 int characters) { |
1235 DCHECK(characters == 1); | 1235 DCHECK(characters == 1 || CanReadUnaligned()); |
1236 if (mode_ == LATIN1) { | 1236 if (mode_ == LATIN1) { |
1237 __ LoadlB(current_character(), | 1237 // using load reverse for endian issue |
john.yan
2016/06/16 20:55:25
These reversed loads are needed to be guard with E
| |
1238 MemOperand(current_input_offset(), end_of_input_address(), | 1238 if (characters == 4) { |
1239 cp_offset * char_size())); | 1239 __ LoadReversedWordP(current_character(), |
1240 MemOperand(current_input_offset(), end_of_input_address(), | |
1241 cp_offset * char_size())); | |
1242 } else if (characters == 2) { | |
1243 __ LoadReversedHalfWordP(current_character(), | |
1244 MemOperand(current_input_offset(), end_of_input_address(), | |
1245 cp_offset * char_size())); | |
1246 } else { | |
1247 DCHECK(characters == 1); | |
1248 __ LoadlB(current_character(), | |
1249 MemOperand(current_input_offset(), end_of_input_address(), | |
1250 cp_offset * char_size())); | |
1251 } | |
1240 } else { | 1252 } else { |
1241 DCHECK(mode_ == UC16); | 1253 DCHECK(mode_ == UC16); |
1242 __ LoadLogicalHalfWordP( | 1254 if (characters == 2) { |
1243 current_character(), | 1255 __ LoadlW(current_character(), |
1244 MemOperand(current_input_offset(), end_of_input_address(), | 1256 MemOperand(current_input_offset(), end_of_input_address(), |
1245 cp_offset * char_size())); | 1257 cp_offset * char_size())); |
1258 // need to swap the order of the characters for endian issue | |
1259 __ rll(current_character(), current_character(), Operand(16)); | |
1260 | |
1261 } else { | |
1262 DCHECK(characters == 1); | |
1263 __ LoadLogicalHalfWordP( | |
1264 current_character(), | |
1265 MemOperand(current_input_offset(), end_of_input_address(), | |
1266 cp_offset * char_size())); | |
1267 } | |
1246 } | 1268 } |
1247 } | 1269 } |
1248 | 1270 |
1249 #undef __ | 1271 #undef __ |
1250 | 1272 |
1251 #endif // V8_INTERPRETED_REGEXP | 1273 #endif // V8_INTERPRETED_REGEXP |
1252 } // namespace internal | 1274 } // namespace internal |
1253 } // namespace v8 | 1275 } // namespace v8 |
1254 | 1276 |
1255 #endif // V8_TARGET_ARCH_S390 | 1277 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |