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

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

Issue 9190001: Backport @10366 to 3.6 Base URL: http://v8.googlecode.com/svn/branches/3.6/
Patch Set: '' 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 | Annotate | Revision Log
OLDNEW
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
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);
Erik Corry 2012/01/19 15:35:00 This looks like a missing merge, but no big deal.
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, SeededNumberDictionary::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.
1396 mov(t2, t0); 1408 mov(t2, t0);
1397 // Compute the masked index: (hash + i + i * i) & mask. 1409 // Compute the masked index: (hash + i + i * i) & mask.
1398 if (i > 0) { 1410 if (i > 0) {
1399 add(t2, t2, Operand(NumberDictionary::GetProbeOffset(i))); 1411 add(t2, t2, Operand(SeededNumberDictionary::GetProbeOffset(i)));
1400 } 1412 }
1401 and_(t2, t2, Operand(t1)); 1413 and_(t2, t2, Operand(t1));
1402 1414
1403 // Scale the index by multiplying by the element size. 1415 // Scale the index by multiplying by the element size.
1404 ASSERT(NumberDictionary::kEntrySize == 3); 1416 ASSERT(SeededNumberDictionary::kEntrySize == 3);
1405 add(t2, t2, Operand(t2, LSL, 1)); // t2 = t2 * 3 1417 add(t2, t2, Operand(t2, LSL, 1)); // t2 = t2 * 3
1406 1418
1407 // Check if the key is identical to the name. 1419 // Check if the key is identical to the name.
1408 add(t2, elements, Operand(t2, LSL, kPointerSizeLog2)); 1420 add(t2, elements, Operand(t2, LSL, kPointerSizeLog2));
1409 ldr(ip, FieldMemOperand(t2, NumberDictionary::kElementsStartOffset)); 1421 ldr(ip, FieldMemOperand(t2, SeededNumberDictionary::kElementsStartOffset));
1410 cmp(key, Operand(ip)); 1422 cmp(key, Operand(ip));
1411 if (i != kProbes - 1) { 1423 if (i != kProbes - 1) {
1412 b(eq, &done); 1424 b(eq, &done);
1413 } else { 1425 } else {
1414 b(ne, miss); 1426 b(ne, miss);
1415 } 1427 }
1416 } 1428 }
1417 1429
1418 bind(&done); 1430 bind(&done);
1419 // Check that the value is a normal property. 1431 // Check that the value is a normal property.
1420 // t2: elements + (index * kPointerSize) 1432 // t2: elements + (index * kPointerSize)
1421 const int kDetailsOffset = 1433 const int kDetailsOffset =
1422 NumberDictionary::kElementsStartOffset + 2 * kPointerSize; 1434 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize;
1423 ldr(t1, FieldMemOperand(t2, kDetailsOffset)); 1435 ldr(t1, FieldMemOperand(t2, kDetailsOffset));
1424 tst(t1, Operand(Smi::FromInt(PropertyDetails::TypeField::kMask))); 1436 tst(t1, Operand(Smi::FromInt(PropertyDetails::TypeField::kMask)));
1425 b(ne, miss); 1437 b(ne, miss);
1426 1438
1427 // Get the value at the masked, scaled index and return. 1439 // Get the value at the masked, scaled index and return.
1428 const int kValueOffset = 1440 const int kValueOffset =
1429 NumberDictionary::kElementsStartOffset + kPointerSize; 1441 SeededNumberDictionary::kElementsStartOffset + kPointerSize;
1430 ldr(result, FieldMemOperand(t2, kValueOffset)); 1442 ldr(result, FieldMemOperand(t2, kValueOffset));
1431 } 1443 }
1432 1444
1433 1445
1434 void MacroAssembler::AllocateInNewSpace(int object_size, 1446 void MacroAssembler::AllocateInNewSpace(int object_size,
1435 Register result, 1447 Register result,
1436 Register scratch1, 1448 Register scratch1,
1437 Register scratch2, 1449 Register scratch2,
1438 Label* gc_required, 1450 Label* gc_required,
1439 AllocationFlags flags) { 1451 AllocationFlags flags) {
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/code-stubs.cc » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698