OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 | 1330 |
1331 ldr(scratch, FieldMemOperand(scratch, token_offset)); | 1331 ldr(scratch, FieldMemOperand(scratch, token_offset)); |
1332 ldr(ip, FieldMemOperand(ip, token_offset)); | 1332 ldr(ip, FieldMemOperand(ip, token_offset)); |
1333 cmp(scratch, Operand(ip)); | 1333 cmp(scratch, Operand(ip)); |
1334 b(ne, miss); | 1334 b(ne, miss); |
1335 | 1335 |
1336 bind(&same_contexts); | 1336 bind(&same_contexts); |
1337 } | 1337 } |
1338 | 1338 |
1339 | 1339 |
| 1340 void MacroAssembler::GetNumberHash(Register t0, Register scratch) { |
| 1341 // First of all we assign the hash seed to scratch. |
| 1342 LoadRoot(scratch, Heap::kHashSeedRootIndex); |
| 1343 SmiUntag(scratch); |
| 1344 |
| 1345 // Xor original key with a seed. |
| 1346 eor(t0, t0, Operand(scratch)); |
| 1347 |
| 1348 // Compute the hash code from the untagged key. This must be kept in sync |
| 1349 // with ComputeIntegerHash in utils.h. |
| 1350 // |
| 1351 // hash = ~hash + (hash << 15); |
| 1352 mvn(scratch, Operand(t0)); |
| 1353 add(t0, scratch, Operand(t0, LSL, 15)); |
| 1354 // hash = hash ^ (hash >> 12); |
| 1355 eor(t0, t0, Operand(t0, LSR, 12)); |
| 1356 // hash = hash + (hash << 2); |
| 1357 add(t0, t0, Operand(t0, LSL, 2)); |
| 1358 // hash = hash ^ (hash >> 4); |
| 1359 eor(t0, t0, Operand(t0, LSR, 4)); |
| 1360 // hash = hash * 2057; |
| 1361 mov(scratch, Operand(2057)); |
| 1362 mul(t0, t0, scratch); |
| 1363 // hash = hash ^ (hash >> 16); |
| 1364 eor(t0, t0, Operand(t0, LSR, 16)); |
| 1365 } |
| 1366 |
| 1367 |
1340 void MacroAssembler::LoadFromNumberDictionary(Label* miss, | 1368 void MacroAssembler::LoadFromNumberDictionary(Label* miss, |
1341 Register elements, | 1369 Register elements, |
1342 Register key, | 1370 Register key, |
1343 Register result, | 1371 Register result, |
1344 Register t0, | 1372 Register t0, |
1345 Register t1, | 1373 Register t1, |
1346 Register t2) { | 1374 Register t2) { |
1347 // Register use: | 1375 // Register use: |
1348 // | 1376 // |
1349 // elements - holds the slow-case elements of the receiver on entry. | 1377 // elements - holds the slow-case elements of the receiver on entry. |
1350 // Unchanged unless 'result' is the same register. | 1378 // Unchanged unless 'result' is the same register. |
1351 // | 1379 // |
1352 // key - holds the smi key on entry. | 1380 // key - holds the smi key on entry. |
1353 // Unchanged unless 'result' is the same register. | 1381 // Unchanged unless 'result' is the same register. |
1354 // | 1382 // |
1355 // result - holds the result on exit if the load succeeded. | 1383 // result - holds the result on exit if the load succeeded. |
1356 // Allowed to be the same as 'key' or 'result'. | 1384 // Allowed to be the same as 'key' or 'result'. |
1357 // Unchanged on bailout so 'key' or 'result' can be used | 1385 // Unchanged on bailout so 'key' or 'result' can be used |
1358 // in further computation. | 1386 // in further computation. |
1359 // | 1387 // |
1360 // Scratch registers: | 1388 // Scratch registers: |
1361 // | 1389 // |
1362 // t0 - holds the untagged key on entry and holds the hash once computed. | 1390 // t0 - holds the untagged key on entry and holds the hash once computed. |
1363 // | 1391 // |
1364 // t1 - used to hold the capacity mask of the dictionary | 1392 // t1 - used to hold the capacity mask of the dictionary |
1365 // | 1393 // |
1366 // t2 - used for the index into the dictionary. | 1394 // t2 - used for the index into the dictionary. |
1367 Label done; | 1395 Label done; |
1368 | 1396 |
1369 // Compute the hash code from the untagged key. This must be kept in sync | 1397 GetNumberHash(t0, t1); |
1370 // with ComputeIntegerHash in utils.h. | |
1371 // | |
1372 // hash = ~hash + (hash << 15); | |
1373 mvn(t1, Operand(t0)); | |
1374 add(t0, t1, Operand(t0, LSL, 15)); | |
1375 // hash = hash ^ (hash >> 12); | |
1376 eor(t0, t0, Operand(t0, LSR, 12)); | |
1377 // hash = hash + (hash << 2); | |
1378 add(t0, t0, Operand(t0, LSL, 2)); | |
1379 // hash = hash ^ (hash >> 4); | |
1380 eor(t0, t0, Operand(t0, LSR, 4)); | |
1381 // hash = hash * 2057; | |
1382 mov(t1, Operand(2057)); | |
1383 mul(t0, t0, t1); | |
1384 // hash = hash ^ (hash >> 16); | |
1385 eor(t0, t0, Operand(t0, LSR, 16)); | |
1386 | 1398 |
1387 // Compute the capacity mask. | 1399 // Compute the capacity mask. |
1388 ldr(t1, FieldMemOperand(elements, NumberDictionary::kCapacityOffset)); | 1400 ldr(t1, FieldMemOperand(elements, NumberDictionary::kCapacityOffset)); |
1389 mov(t1, Operand(t1, ASR, kSmiTagSize)); // convert smi to int | 1401 mov(t1, Operand(t1, ASR, kSmiTagSize)); // convert smi to int |
1390 sub(t1, t1, Operand(1)); | 1402 sub(t1, t1, Operand(1)); |
1391 | 1403 |
1392 // Generate an unrolled loop that performs a few probes before giving up. | 1404 // Generate an unrolled loop that performs a few probes before giving up. |
1393 static const int kProbes = 4; | 1405 static const int kProbes = 4; |
1394 for (int i = 0; i < kProbes; i++) { | 1406 for (int i = 0; i < kProbes; i++) { |
1395 // Use t2 for index calculations and keep the hash intact in t0. | 1407 // Use t2 for index calculations and keep the hash intact in t0. |
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3269 void CodePatcher::EmitCondition(Condition cond) { | 3281 void CodePatcher::EmitCondition(Condition cond) { |
3270 Instr instr = Assembler::instr_at(masm_.pc_); | 3282 Instr instr = Assembler::instr_at(masm_.pc_); |
3271 instr = (instr & ~kCondMask) | cond; | 3283 instr = (instr & ~kCondMask) | cond; |
3272 masm_.emit(instr); | 3284 masm_.emit(instr); |
3273 } | 3285 } |
3274 | 3286 |
3275 | 3287 |
3276 } } // namespace v8::internal | 3288 } } // namespace v8::internal |
3277 | 3289 |
3278 #endif // V8_TARGET_ARCH_ARM | 3290 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |