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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 | 1336 |
1337 ldr(scratch, FieldMemOperand(scratch, token_offset)); | 1337 ldr(scratch, FieldMemOperand(scratch, token_offset)); |
1338 ldr(ip, FieldMemOperand(ip, token_offset)); | 1338 ldr(ip, FieldMemOperand(ip, token_offset)); |
1339 cmp(scratch, Operand(ip)); | 1339 cmp(scratch, Operand(ip)); |
1340 b(ne, miss); | 1340 b(ne, miss); |
1341 | 1341 |
1342 bind(&same_contexts); | 1342 bind(&same_contexts); |
1343 } | 1343 } |
1344 | 1344 |
1345 | 1345 |
| 1346 void MacroAssembler::LoadFromNumberDictionary(Label* miss, |
| 1347 Register elements, |
| 1348 Register key, |
| 1349 Register result, |
| 1350 Register t0, |
| 1351 Register t1, |
| 1352 Register t2) { |
| 1353 // Register use: |
| 1354 // |
| 1355 // elements - holds the slow-case elements of the receiver on entry. |
| 1356 // Unchanged unless 'result' is the same register. |
| 1357 // |
| 1358 // key - holds the smi key on entry. |
| 1359 // Unchanged unless 'result' is the same register. |
| 1360 // |
| 1361 // result - holds the result on exit if the load succeeded. |
| 1362 // Allowed to be the same as 'key' or 'result'. |
| 1363 // Unchanged on bailout so 'key' or 'result' can be used |
| 1364 // in further computation. |
| 1365 // |
| 1366 // Scratch registers: |
| 1367 // |
| 1368 // t0 - holds the untagged key on entry and holds the hash once computed. |
| 1369 // |
| 1370 // t1 - used to hold the capacity mask of the dictionary |
| 1371 // |
| 1372 // t2 - used for the index into the dictionary. |
| 1373 Label done; |
| 1374 |
| 1375 // Compute the hash code from the untagged key. This must be kept in sync |
| 1376 // with ComputeIntegerHash in utils.h. |
| 1377 // |
| 1378 // hash = ~hash + (hash << 15); |
| 1379 mvn(t1, Operand(t0)); |
| 1380 add(t0, t1, Operand(t0, LSL, 15)); |
| 1381 // hash = hash ^ (hash >> 12); |
| 1382 eor(t0, t0, Operand(t0, LSR, 12)); |
| 1383 // hash = hash + (hash << 2); |
| 1384 add(t0, t0, Operand(t0, LSL, 2)); |
| 1385 // hash = hash ^ (hash >> 4); |
| 1386 eor(t0, t0, Operand(t0, LSR, 4)); |
| 1387 // hash = hash * 2057; |
| 1388 mov(t1, Operand(2057)); |
| 1389 mul(t0, t0, t1); |
| 1390 // hash = hash ^ (hash >> 16); |
| 1391 eor(t0, t0, Operand(t0, LSR, 16)); |
| 1392 |
| 1393 // Compute the capacity mask. |
| 1394 ldr(t1, FieldMemOperand(elements, NumberDictionary::kCapacityOffset)); |
| 1395 mov(t1, Operand(t1, ASR, kSmiTagSize)); // convert smi to int |
| 1396 sub(t1, t1, Operand(1)); |
| 1397 |
| 1398 // Generate an unrolled loop that performs a few probes before giving up. |
| 1399 static const int kProbes = 4; |
| 1400 for (int i = 0; i < kProbes; i++) { |
| 1401 // Use t2 for index calculations and keep the hash intact in t0. |
| 1402 mov(t2, t0); |
| 1403 // Compute the masked index: (hash + i + i * i) & mask. |
| 1404 if (i > 0) { |
| 1405 add(t2, t2, Operand(NumberDictionary::GetProbeOffset(i))); |
| 1406 } |
| 1407 and_(t2, t2, Operand(t1)); |
| 1408 |
| 1409 // Scale the index by multiplying by the element size. |
| 1410 ASSERT(NumberDictionary::kEntrySize == 3); |
| 1411 add(t2, t2, Operand(t2, LSL, 1)); // t2 = t2 * 3 |
| 1412 |
| 1413 // Check if the key is identical to the name. |
| 1414 add(t2, elements, Operand(t2, LSL, kPointerSizeLog2)); |
| 1415 ldr(ip, FieldMemOperand(t2, NumberDictionary::kElementsStartOffset)); |
| 1416 cmp(key, Operand(ip)); |
| 1417 if (i != kProbes - 1) { |
| 1418 b(eq, &done); |
| 1419 } else { |
| 1420 b(ne, miss); |
| 1421 } |
| 1422 } |
| 1423 |
| 1424 bind(&done); |
| 1425 // Check that the value is a normal property. |
| 1426 // t2: elements + (index * kPointerSize) |
| 1427 const int kDetailsOffset = |
| 1428 NumberDictionary::kElementsStartOffset + 2 * kPointerSize; |
| 1429 ldr(t1, FieldMemOperand(t2, kDetailsOffset)); |
| 1430 tst(t1, Operand(Smi::FromInt(PropertyDetails::TypeField::mask()))); |
| 1431 b(ne, miss); |
| 1432 |
| 1433 // Get the value at the masked, scaled index and return. |
| 1434 const int kValueOffset = |
| 1435 NumberDictionary::kElementsStartOffset + kPointerSize; |
| 1436 ldr(result, FieldMemOperand(t2, kValueOffset)); |
| 1437 } |
| 1438 |
| 1439 |
1346 void MacroAssembler::AllocateInNewSpace(int object_size, | 1440 void MacroAssembler::AllocateInNewSpace(int object_size, |
1347 Register result, | 1441 Register result, |
1348 Register scratch1, | 1442 Register scratch1, |
1349 Register scratch2, | 1443 Register scratch2, |
1350 Label* gc_required, | 1444 Label* gc_required, |
1351 AllocationFlags flags) { | 1445 AllocationFlags flags) { |
1352 if (!FLAG_inline_new) { | 1446 if (!FLAG_inline_new) { |
1353 if (emit_debug_code()) { | 1447 if (emit_debug_code()) { |
1354 // Trash the registers to simulate an allocation failure. | 1448 // Trash the registers to simulate an allocation failure. |
1355 mov(result, Operand(0x7091)); | 1449 mov(result, Operand(0x7091)); |
(...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3137 void CodePatcher::EmitCondition(Condition cond) { | 3231 void CodePatcher::EmitCondition(Condition cond) { |
3138 Instr instr = Assembler::instr_at(masm_.pc_); | 3232 Instr instr = Assembler::instr_at(masm_.pc_); |
3139 instr = (instr & ~kCondMask) | cond; | 3233 instr = (instr & ~kCondMask) | cond; |
3140 masm_.emit(instr); | 3234 masm_.emit(instr); |
3141 } | 3235 } |
3142 | 3236 |
3143 | 3237 |
3144 } } // namespace v8::internal | 3238 } } // namespace v8::internal |
3145 | 3239 |
3146 #endif // V8_TARGET_ARCH_ARM | 3240 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |