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/08/02 03:06:15
There is no 'issue' here when using reversed load.
| |
1238 MemOperand(current_input_offset(), end_of_input_address(), | 1238 if (characters == 4) { |
1239 cp_offset * char_size())); | 1239 #if V8_TARGET_LITTLE_ENDIAN |
1240 __ LoadlW(current_character(), | |
1241 MemOperand(current_input_offset(), end_of_input_address(), | |
1242 cp_offset * char_size())); | |
1243 #else | |
1244 __ LoadLogicalReversedWordP(current_character(), | |
1245 MemOperand(current_input_offset(), end_of_input_address(), | |
1246 cp_offset * char_size())); | |
1247 #endif | |
1248 } else if (characters == 2) { | |
1249 #if V8_TARGET_LITTLE_ENDIAN | |
1250 __ LoadLogicalHalfWordP(current_character(), | |
1251 MemOperand(current_input_offset(), end_of_input_address(), | |
1252 cp_offset * char_size())); | |
1253 #else | |
1254 __ LoadLogicalReversedHalfWordP(current_character(), | |
1255 MemOperand(current_input_offset(), end_of_input_address(), | |
1256 cp_offset * char_size())); | |
1257 #endif | |
1258 } else { | |
1259 DCHECK(characters == 1); | |
1260 __ LoadlB(current_character(), | |
1261 MemOperand(current_input_offset(), end_of_input_address(), | |
1262 cp_offset * char_size())); | |
1263 } | |
1240 } else { | 1264 } else { |
1241 DCHECK(mode_ == UC16); | 1265 DCHECK(mode_ == UC16); |
1242 __ LoadLogicalHalfWordP( | 1266 if (characters == 2) { |
1243 current_character(), | 1267 __ LoadlW(current_character(), |
1244 MemOperand(current_input_offset(), end_of_input_address(), | 1268 MemOperand(current_input_offset(), end_of_input_address(), |
1245 cp_offset * char_size())); | 1269 cp_offset * char_size())); |
1270 #if !V8_TARGET_LITTLE_ENDIAN | |
1271 // need to swap the order of the characters for endian issue | |
john.yan
2016/08/02 03:06:15
same here.
| |
1272 __ rll(current_character(), current_character(), Operand(16)); | |
1273 #endif | |
1274 } else { | |
1275 DCHECK(characters == 1); | |
1276 __ LoadLogicalHalfWordP( | |
1277 current_character(), | |
1278 MemOperand(current_input_offset(), end_of_input_address(), | |
1279 cp_offset * char_size())); | |
1280 } | |
1246 } | 1281 } |
1247 } | 1282 } |
1248 | 1283 |
1249 #undef __ | 1284 #undef __ |
1250 | 1285 |
1251 #endif // V8_INTERPRETED_REGEXP | 1286 #endif // V8_INTERPRETED_REGEXP |
1252 } // namespace internal | 1287 } // namespace internal |
1253 } // namespace v8 | 1288 } // namespace v8 |
1254 | 1289 |
1255 #endif // V8_TARGET_ARCH_S390 | 1290 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |