Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 9148006: [objects] seed NumberDictionary (only ia32 now) Base URL: gh:v8/v8@master
Patch Set: fixed linter issues, use pseudo-random function in test Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/debug.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 1407
1408 ldr(scratch, FieldMemOperand(scratch, token_offset)); 1408 ldr(scratch, FieldMemOperand(scratch, token_offset));
1409 ldr(ip, FieldMemOperand(ip, token_offset)); 1409 ldr(ip, FieldMemOperand(ip, token_offset));
1410 cmp(scratch, Operand(ip)); 1410 cmp(scratch, Operand(ip));
1411 b(ne, miss); 1411 b(ne, miss);
1412 1412
1413 bind(&same_contexts); 1413 bind(&same_contexts);
1414 } 1414 }
1415 1415
1416 1416
1417 void MacroAssembler::GetNumberHash(Register t0, Register scratch) {
1418 // First of all we assign the hash seed to scratch.
1419 LoadRoot(scratch, Heap::kStringHashSeedRootIndex);
1420 SmiUntag(scratch);
1421
1422 // Xor original key with a seed.
1423 eor(t0, t0, Operand(scratch));
1424
1425 // Compute the hash code from the untagged key. This must be kept in sync
1426 // with ComputeIntegerHash in utils.h.
1427 //
1428 // hash = ~hash + (hash << 15);
1429 mvn(scratch, Operand(t0));
1430 add(t0, scratch, Operand(t0, LSL, 15));
1431 // hash = hash ^ (hash >> 12);
1432 eor(t0, t0, Operand(t0, LSR, 12));
1433 // hash = hash + (hash << 2);
1434 add(t0, t0, Operand(t0, LSL, 2));
1435 // hash = hash ^ (hash >> 4);
1436 eor(t0, t0, Operand(t0, LSR, 4));
1437 // hash = hash * 2057;
1438 mov(scratch, Operand(t0, LSL, 11));
1439 add(t0, t0, Operand(t0, LSL, 3));
1440 add(t0, t0, scratch);
1441 // hash = hash ^ (hash >> 16);
1442 eor(t0, t0, Operand(t0, LSR, 16));
1443 }
1444
1445
1417 void MacroAssembler::LoadFromNumberDictionary(Label* miss, 1446 void MacroAssembler::LoadFromNumberDictionary(Label* miss,
1418 Register elements, 1447 Register elements,
1419 Register key, 1448 Register key,
1420 Register result, 1449 Register result,
1421 Register t0, 1450 Register t0,
1422 Register t1, 1451 Register t1,
1423 Register t2) { 1452 Register t2) {
1424 // Register use: 1453 // Register use:
1425 // 1454 //
1426 // elements - holds the slow-case elements of the receiver on entry. 1455 // elements - holds the slow-case elements of the receiver on entry.
1427 // Unchanged unless 'result' is the same register. 1456 // Unchanged unless 'result' is the same register.
1428 // 1457 //
1429 // key - holds the smi key on entry. 1458 // key - holds the smi key on entry.
1430 // Unchanged unless 'result' is the same register. 1459 // Unchanged unless 'result' is the same register.
1431 // 1460 //
1432 // result - holds the result on exit if the load succeeded. 1461 // result - holds the result on exit if the load succeeded.
1433 // Allowed to be the same as 'key' or 'result'. 1462 // Allowed to be the same as 'key' or 'result'.
1434 // Unchanged on bailout so 'key' or 'result' can be used 1463 // Unchanged on bailout so 'key' or 'result' can be used
1435 // in further computation. 1464 // in further computation.
1436 // 1465 //
1437 // Scratch registers: 1466 // Scratch registers:
1438 // 1467 //
1439 // t0 - holds the untagged key on entry and holds the hash once computed. 1468 // t0 - holds the untagged key on entry and holds the hash once computed.
1440 // 1469 //
1441 // t1 - used to hold the capacity mask of the dictionary 1470 // t1 - used to hold the capacity mask of the dictionary
1442 // 1471 //
1443 // t2 - used for the index into the dictionary. 1472 // t2 - used for the index into the dictionary.
1444 Label done; 1473 Label done;
1445 1474
1446 // Compute the hash code from the untagged key. This must be kept in sync 1475 GetNumberHash(t0, t1);
1447 // with ComputeIntegerHash in utils.h.
1448 //
1449 // hash = ~hash + (hash << 15);
1450 mvn(t1, Operand(t0));
1451 add(t0, t1, Operand(t0, LSL, 15));
1452 // hash = hash ^ (hash >> 12);
1453 eor(t0, t0, Operand(t0, LSR, 12));
1454 // hash = hash + (hash << 2);
1455 add(t0, t0, Operand(t0, LSL, 2));
1456 // hash = hash ^ (hash >> 4);
1457 eor(t0, t0, Operand(t0, LSR, 4));
1458 // hash = hash * 2057;
1459 mov(t1, Operand(t0, LSL, 11));
1460 add(t0, t0, Operand(t0, LSL, 3));
1461 add(t0, t0, t1);
1462 // hash = hash ^ (hash >> 16);
1463 eor(t0, t0, Operand(t0, LSR, 16));
1464 1476
1465 // Compute the capacity mask. 1477 // Compute the capacity mask.
1466 ldr(t1, FieldMemOperand(elements, NumberDictionary::kCapacityOffset)); 1478 ldr(t1, FieldMemOperand(elements, NumberDictionary::kCapacityOffset));
1467 mov(t1, Operand(t1, ASR, kSmiTagSize)); // convert smi to int 1479 mov(t1, Operand(t1, ASR, kSmiTagSize)); // convert smi to int
1468 sub(t1, t1, Operand(1)); 1480 sub(t1, t1, Operand(1));
1469 1481
1470 // Generate an unrolled loop that performs a few probes before giving up. 1482 // Generate an unrolled loop that performs a few probes before giving up.
1471 static const int kProbes = 4; 1483 static const int kProbes = 4;
1472 for (int i = 0; i < kProbes; i++) { 1484 for (int i = 0; i < kProbes; i++) {
1473 // Use t2 for index calculations and keep the hash intact in t0. 1485 // Use t2 for index calculations and keep the hash intact in t0.
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after
3657 void CodePatcher::EmitCondition(Condition cond) { 3669 void CodePatcher::EmitCondition(Condition cond) {
3658 Instr instr = Assembler::instr_at(masm_.pc_); 3670 Instr instr = Assembler::instr_at(masm_.pc_);
3659 instr = (instr & ~kCondMask) | cond; 3671 instr = (instr & ~kCondMask) | cond;
3660 masm_.emit(instr); 3672 masm_.emit(instr);
3661 } 3673 }
3662 3674
3663 3675
3664 } } // namespace v8::internal 3676 } } // namespace v8::internal
3665 3677
3666 #endif // V8_TARGET_ARCH_ARM 3678 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698