| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 Context::SECURITY_TOKEN_INDEX * kPointerSize; | 402 Context::SECURITY_TOKEN_INDEX * kPointerSize; |
| 403 | 403 |
| 404 lw(scratch, FieldMemOperand(scratch, token_offset)); | 404 lw(scratch, FieldMemOperand(scratch, token_offset)); |
| 405 lw(at, FieldMemOperand(at, token_offset)); | 405 lw(at, FieldMemOperand(at, token_offset)); |
| 406 Branch(miss, ne, scratch, Operand(at)); | 406 Branch(miss, ne, scratch, Operand(at)); |
| 407 | 407 |
| 408 bind(&same_contexts); | 408 bind(&same_contexts); |
| 409 } | 409 } |
| 410 | 410 |
| 411 | 411 |
| 412 void MacroAssembler::GetNumberHash(Register reg0, Register scratch) { |
| 413 // First of all we assign the hash seed to scratch. |
| 414 LoadRoot(scratch, Heap::kStringHashSeedRootIndex); |
| 415 SmiUntag(scratch); |
| 416 |
| 417 // Xor original key with a seed. |
| 418 xor_(reg0, reg0, scratch); |
| 419 |
| 420 // Compute the hash code from the untagged key. This must be kept in sync |
| 421 // with ComputeIntegerHash in utils.h. |
| 422 // |
| 423 // hash = ~hash + (hash << 15); |
| 424 nor(scratch, reg0, zero_reg); |
| 425 sll(at, reg0, 15); |
| 426 addu(reg0, scratch, at); |
| 427 |
| 428 // hash = hash ^ (hash >> 12); |
| 429 srl(at, reg0, 12); |
| 430 xor_(reg0, reg0, at); |
| 431 |
| 432 // hash = hash + (hash << 2); |
| 433 sll(at, reg0, 2); |
| 434 addu(reg0, reg0, at); |
| 435 |
| 436 // hash = hash ^ (hash >> 4); |
| 437 srl(at, reg0, 4); |
| 438 xor_(reg0, reg0, at); |
| 439 |
| 440 // hash = hash * 2057; |
| 441 li(scratch, Operand(2057)); |
| 442 mul(reg0, reg0, scratch); |
| 443 |
| 444 // hash = hash ^ (hash >> 16); |
| 445 srl(at, reg0, 16); |
| 446 xor_(reg0, reg0, at); |
| 447 } |
| 448 |
| 449 |
| 412 void MacroAssembler::LoadFromNumberDictionary(Label* miss, | 450 void MacroAssembler::LoadFromNumberDictionary(Label* miss, |
| 413 Register elements, | 451 Register elements, |
| 414 Register key, | 452 Register key, |
| 415 Register result, | 453 Register result, |
| 416 Register reg0, | 454 Register reg0, |
| 417 Register reg1, | 455 Register reg1, |
| 418 Register reg2) { | 456 Register reg2) { |
| 419 // Register use: | 457 // Register use: |
| 420 // | 458 // |
| 421 // elements - holds the slow-case elements of the receiver on entry. | 459 // elements - holds the slow-case elements of the receiver on entry. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 433 // Scratch registers: | 471 // Scratch registers: |
| 434 // | 472 // |
| 435 // reg0 - holds the untagged key on entry and holds the hash once computed. | 473 // reg0 - holds the untagged key on entry and holds the hash once computed. |
| 436 // | 474 // |
| 437 // reg1 - Used to hold the capacity mask of the dictionary. | 475 // reg1 - Used to hold the capacity mask of the dictionary. |
| 438 // | 476 // |
| 439 // reg2 - Used for the index into the dictionary. | 477 // reg2 - Used for the index into the dictionary. |
| 440 // at - Temporary (avoid MacroAssembler instructions also using 'at'). | 478 // at - Temporary (avoid MacroAssembler instructions also using 'at'). |
| 441 Label done; | 479 Label done; |
| 442 | 480 |
| 443 // Compute the hash code from the untagged key. This must be kept in sync | 481 GetNumberHash(reg0, reg1); |
| 444 // with ComputeIntegerHash in utils.h. | |
| 445 // | |
| 446 // hash = ~hash + (hash << 15); | |
| 447 nor(reg1, reg0, zero_reg); | |
| 448 sll(at, reg0, 15); | |
| 449 addu(reg0, reg1, at); | |
| 450 | |
| 451 // hash = hash ^ (hash >> 12); | |
| 452 srl(at, reg0, 12); | |
| 453 xor_(reg0, reg0, at); | |
| 454 | |
| 455 // hash = hash + (hash << 2); | |
| 456 sll(at, reg0, 2); | |
| 457 addu(reg0, reg0, at); | |
| 458 | |
| 459 // hash = hash ^ (hash >> 4); | |
| 460 srl(at, reg0, 4); | |
| 461 xor_(reg0, reg0, at); | |
| 462 | |
| 463 // hash = hash * 2057; | |
| 464 li(reg1, Operand(2057)); | |
| 465 mul(reg0, reg0, reg1); | |
| 466 | |
| 467 // hash = hash ^ (hash >> 16); | |
| 468 srl(at, reg0, 16); | |
| 469 xor_(reg0, reg0, at); | |
| 470 | 482 |
| 471 // Compute the capacity mask. | 483 // Compute the capacity mask. |
| 472 lw(reg1, FieldMemOperand(elements, NumberDictionary::kCapacityOffset)); | 484 lw(reg1, FieldMemOperand(elements, NumberDictionary::kCapacityOffset)); |
| 473 sra(reg1, reg1, kSmiTagSize); | 485 sra(reg1, reg1, kSmiTagSize); |
| 474 Subu(reg1, reg1, Operand(1)); | 486 Subu(reg1, reg1, Operand(1)); |
| 475 | 487 |
| 476 // Generate an unrolled loop that performs a few probes before giving up. | 488 // Generate an unrolled loop that performs a few probes before giving up. |
| 477 static const int kProbes = 4; | 489 static const int kProbes = 4; |
| 478 for (int i = 0; i < kProbes; i++) { | 490 for (int i = 0; i < kProbes; i++) { |
| 479 // Use reg2 for index calculations and keep the hash intact in reg0. | 491 // Use reg2 for index calculations and keep the hash intact in reg0. |
| (...skipping 4547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5027 opcode == BGTZL); | 5039 opcode == BGTZL); |
| 5028 opcode = (cond == eq) ? BEQ : BNE; | 5040 opcode = (cond == eq) ? BEQ : BNE; |
| 5029 instr = (instr & ~kOpcodeMask) | opcode; | 5041 instr = (instr & ~kOpcodeMask) | opcode; |
| 5030 masm_.emit(instr); | 5042 masm_.emit(instr); |
| 5031 } | 5043 } |
| 5032 | 5044 |
| 5033 | 5045 |
| 5034 } } // namespace v8::internal | 5046 } } // namespace v8::internal |
| 5035 | 5047 |
| 5036 #endif // V8_TARGET_ARCH_MIPS | 5048 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |