OLD | NEW |
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 3446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3457 } | 3457 } |
3458 bind(&done); | 3458 bind(&done); |
3459 } | 3459 } |
3460 | 3460 |
3461 | 3461 |
3462 void MacroAssembler::CompareMapAndBranch(Register obj, | 3462 void MacroAssembler::CompareMapAndBranch(Register obj, |
3463 Register scratch, | 3463 Register scratch, |
3464 Handle<Map> map, | 3464 Handle<Map> map, |
3465 Label* early_success, | 3465 Label* early_success, |
3466 Condition cond, | 3466 Condition cond, |
3467 Label* branch_to, | 3467 Label* branch_to) { |
3468 CompareMapMode mode) { | |
3469 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); | 3468 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); |
3470 CompareMapAndBranch(scratch, map, early_success, cond, branch_to, mode); | 3469 CompareMapAndBranch(scratch, map, early_success, cond, branch_to); |
3471 } | 3470 } |
3472 | 3471 |
3473 | 3472 |
3474 void MacroAssembler::CompareMapAndBranch(Register obj_map, | 3473 void MacroAssembler::CompareMapAndBranch(Register obj_map, |
3475 Handle<Map> map, | 3474 Handle<Map> map, |
3476 Label* early_success, | 3475 Label* early_success, |
3477 Condition cond, | 3476 Condition cond, |
3478 Label* branch_to, | 3477 Label* branch_to) { |
3479 CompareMapMode mode) { | 3478 Branch(branch_to, cond, obj_map, Operand(map)); |
3480 Operand right = Operand(map); | |
3481 if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) { | |
3482 ElementsKind kind = map->elements_kind(); | |
3483 if (IsFastElementsKind(kind)) { | |
3484 bool packed = IsFastPackedElementsKind(kind); | |
3485 Map* current_map = *map; | |
3486 while (CanTransitionToMoreGeneralFastElementsKind(kind, packed)) { | |
3487 kind = GetNextMoreGeneralFastElementsKind(kind, packed); | |
3488 current_map = current_map->LookupElementsTransitionMap(kind); | |
3489 if (!current_map) break; | |
3490 Branch(early_success, eq, obj_map, right); | |
3491 right = Operand(Handle<Map>(current_map)); | |
3492 } | |
3493 } | |
3494 } | |
3495 | |
3496 Branch(branch_to, cond, obj_map, right); | |
3497 } | 3479 } |
3498 | 3480 |
3499 | 3481 |
3500 void MacroAssembler::CheckMap(Register obj, | 3482 void MacroAssembler::CheckMap(Register obj, |
3501 Register scratch, | 3483 Register scratch, |
3502 Handle<Map> map, | 3484 Handle<Map> map, |
3503 Label* fail, | 3485 Label* fail, |
3504 SmiCheckType smi_check_type, | 3486 SmiCheckType smi_check_type) { |
3505 CompareMapMode mode) { | |
3506 if (smi_check_type == DO_SMI_CHECK) { | 3487 if (smi_check_type == DO_SMI_CHECK) { |
3507 JumpIfSmi(obj, fail); | 3488 JumpIfSmi(obj, fail); |
3508 } | 3489 } |
3509 Label success; | 3490 Label success; |
3510 CompareMapAndBranch(obj, scratch, map, &success, ne, fail, mode); | 3491 CompareMapAndBranch(obj, scratch, map, &success, ne, fail); |
3511 bind(&success); | 3492 bind(&success); |
3512 } | 3493 } |
3513 | 3494 |
3514 | 3495 |
3515 void MacroAssembler::DispatchMap(Register obj, | 3496 void MacroAssembler::DispatchMap(Register obj, |
3516 Register scratch, | 3497 Register scratch, |
3517 Handle<Map> map, | 3498 Handle<Map> map, |
3518 Handle<Code> success, | 3499 Handle<Code> success, |
3519 SmiCheckType smi_check_type) { | 3500 SmiCheckType smi_check_type) { |
3520 Label fail; | 3501 Label fail; |
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5544 opcode == BGTZL); | 5525 opcode == BGTZL); |
5545 opcode = (cond == eq) ? BEQ : BNE; | 5526 opcode = (cond == eq) ? BEQ : BNE; |
5546 instr = (instr & ~kOpcodeMask) | opcode; | 5527 instr = (instr & ~kOpcodeMask) | opcode; |
5547 masm_.emit(instr); | 5528 masm_.emit(instr); |
5548 } | 5529 } |
5549 | 5530 |
5550 | 5531 |
5551 } } // namespace v8::internal | 5532 } } // namespace v8::internal |
5552 | 5533 |
5553 #endif // V8_TARGET_ARCH_MIPS | 5534 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |