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 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 } | 1361 } |
1362 | 1362 |
1363 | 1363 |
1364 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { | 1364 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { |
1365 Register result = ToRegister(instr->result()); | 1365 Register result = ToRegister(instr->result()); |
1366 Register array = ToRegister(instr->InputAt(0)); | 1366 Register array = ToRegister(instr->InputAt(0)); |
1367 __ ldr(result, FieldMemOperand(array, FixedArray::kLengthOffset)); | 1367 __ ldr(result, FieldMemOperand(array, FixedArray::kLengthOffset)); |
1368 } | 1368 } |
1369 | 1369 |
1370 | 1370 |
| 1371 void LCodeGen::DoElementsKind(LElementsKind* instr) { |
| 1372 Register result = ToRegister(instr->result()); |
| 1373 Register input = ToRegister(instr->InputAt(0)); |
| 1374 |
| 1375 // Load map into |result|. |
| 1376 __ ldr(result, FieldMemOperand(input, HeapObject::kMapOffset)); |
| 1377 // Load the map's "bit field 2" into |result|. We only need the first byte, |
| 1378 // but the following bit field extraction takes care of that anyway. |
| 1379 __ ldr(result, FieldMemOperand(result, Map::kBitField2Offset)); |
| 1380 // Retrieve elements_kind from bit field 2. |
| 1381 __ ubfx(result, result, Map::kElementsKindShift, Map::kElementsKindBitCount); |
| 1382 } |
| 1383 |
| 1384 |
1371 void LCodeGen::DoValueOf(LValueOf* instr) { | 1385 void LCodeGen::DoValueOf(LValueOf* instr) { |
1372 Register input = ToRegister(instr->InputAt(0)); | 1386 Register input = ToRegister(instr->InputAt(0)); |
1373 Register result = ToRegister(instr->result()); | 1387 Register result = ToRegister(instr->result()); |
1374 Register map = ToRegister(instr->TempAt(0)); | 1388 Register map = ToRegister(instr->TempAt(0)); |
1375 ASSERT(input.is(result)); | 1389 ASSERT(input.is(result)); |
1376 Label done; | 1390 Label done; |
1377 | 1391 |
1378 // If the object is a smi return the object. | 1392 // If the object is a smi return the object. |
1379 __ tst(input, Operand(kSmiTagMask)); | 1393 __ tst(input, Operand(kSmiTagMask)); |
1380 __ b(eq, &done); | 1394 __ b(eq, &done); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 Register left = ToRegister(instr->InputAt(0)); | 1751 Register left = ToRegister(instr->InputAt(0)); |
1738 Register right = ToRegister(instr->InputAt(1)); | 1752 Register right = ToRegister(instr->InputAt(1)); |
1739 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1753 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1740 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1754 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1741 | 1755 |
1742 __ cmp(left, Operand(right)); | 1756 __ cmp(left, Operand(right)); |
1743 EmitBranch(true_block, false_block, eq); | 1757 EmitBranch(true_block, false_block, eq); |
1744 } | 1758 } |
1745 | 1759 |
1746 | 1760 |
| 1761 void LCodeGen::DoCmpConstantEq(LCmpConstantEq* instr) { |
| 1762 Register left = ToRegister(instr->InputAt(0)); |
| 1763 Register result = ToRegister(instr->result()); |
| 1764 |
| 1765 Label done; |
| 1766 __ cmp(left, Operand(instr->hydrogen()->right())); |
| 1767 __ LoadRoot(result, Heap::kTrueValueRootIndex, eq); |
| 1768 __ LoadRoot(result, Heap::kFalseValueRootIndex, ne); |
| 1769 } |
| 1770 |
| 1771 |
| 1772 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) { |
| 1773 Register left = ToRegister(instr->InputAt(0)); |
| 1774 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1775 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1776 |
| 1777 __ cmp(left, Operand(instr->hydrogen()->right())); |
| 1778 EmitBranch(true_block, false_block, eq); |
| 1779 } |
| 1780 |
| 1781 |
1747 void LCodeGen::DoIsNull(LIsNull* instr) { | 1782 void LCodeGen::DoIsNull(LIsNull* instr) { |
1748 Register reg = ToRegister(instr->InputAt(0)); | 1783 Register reg = ToRegister(instr->InputAt(0)); |
1749 Register result = ToRegister(instr->result()); | 1784 Register result = ToRegister(instr->result()); |
1750 | 1785 |
1751 __ LoadRoot(ip, Heap::kNullValueRootIndex); | 1786 __ LoadRoot(ip, Heap::kNullValueRootIndex); |
1752 __ cmp(reg, ip); | 1787 __ cmp(reg, ip); |
1753 if (instr->is_strict()) { | 1788 if (instr->is_strict()) { |
1754 __ LoadRoot(result, Heap::kTrueValueRootIndex, eq); | 1789 __ LoadRoot(result, Heap::kTrueValueRootIndex, eq); |
1755 __ LoadRoot(result, Heap::kFalseValueRootIndex, ne); | 1790 __ LoadRoot(result, Heap::kFalseValueRootIndex, ne); |
1756 } else { | 1791 } else { |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2535 } | 2570 } |
2536 | 2571 |
2537 | 2572 |
2538 void LCodeGen::DoLoadElements(LLoadElements* instr) { | 2573 void LCodeGen::DoLoadElements(LLoadElements* instr) { |
2539 Register result = ToRegister(instr->result()); | 2574 Register result = ToRegister(instr->result()); |
2540 Register input = ToRegister(instr->InputAt(0)); | 2575 Register input = ToRegister(instr->InputAt(0)); |
2541 Register scratch = scratch0(); | 2576 Register scratch = scratch0(); |
2542 | 2577 |
2543 __ ldr(result, FieldMemOperand(input, JSObject::kElementsOffset)); | 2578 __ ldr(result, FieldMemOperand(input, JSObject::kElementsOffset)); |
2544 if (FLAG_debug_code) { | 2579 if (FLAG_debug_code) { |
2545 Label done; | 2580 Label done, fail; |
2546 __ ldr(scratch, FieldMemOperand(result, HeapObject::kMapOffset)); | 2581 __ ldr(scratch, FieldMemOperand(result, HeapObject::kMapOffset)); |
2547 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 2582 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); |
2548 __ cmp(scratch, ip); | 2583 __ cmp(scratch, ip); |
2549 __ b(eq, &done); | 2584 __ b(eq, &done); |
2550 __ LoadRoot(ip, Heap::kFixedCOWArrayMapRootIndex); | 2585 __ LoadRoot(ip, Heap::kFixedCOWArrayMapRootIndex); |
2551 __ cmp(scratch, ip); | 2586 __ cmp(scratch, ip); |
2552 __ b(eq, &done); | 2587 __ b(eq, &done); |
2553 __ ldr(scratch, FieldMemOperand(result, HeapObject::kMapOffset)); | 2588 // |scratch| still contains |input|'s map. |
2554 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 2589 __ ldr(scratch, FieldMemOperand(scratch, Map::kBitField2Offset)); |
2555 __ sub(scratch, scratch, Operand(FIRST_EXTERNAL_ARRAY_TYPE)); | 2590 __ ubfx(scratch, scratch, Map::kElementsKindShift, |
2556 __ cmp(scratch, Operand(kExternalArrayTypeCount)); | 2591 Map::kElementsKindBitCount); |
2557 __ Check(cc, "Check for fast elements failed."); | 2592 __ cmp(scratch, Operand(JSObject::FAST_ELEMENTS)); |
| 2593 __ b(eq, &done); |
| 2594 __ cmp(scratch, Operand(JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND)); |
| 2595 __ b(lt, &fail); |
| 2596 __ cmp(scratch, Operand(JSObject::LAST_EXTERNAL_ARRAY_ELEMENTS_KIND)); |
| 2597 __ b(le, &done); |
| 2598 __ bind(&fail); |
| 2599 __ Abort("Check for fast or external elements failed."); |
2558 __ bind(&done); | 2600 __ bind(&done); |
2559 } | 2601 } |
2560 } | 2602 } |
2561 | 2603 |
2562 | 2604 |
2563 void LCodeGen::DoLoadExternalArrayPointer( | 2605 void LCodeGen::DoLoadExternalArrayPointer( |
2564 LLoadExternalArrayPointer* instr) { | 2606 LLoadExternalArrayPointer* instr) { |
2565 Register to_reg = ToRegister(instr->result()); | 2607 Register to_reg = ToRegister(instr->result()); |
2566 Register from_reg = ToRegister(instr->InputAt(0)); | 2608 Register from_reg = ToRegister(instr->InputAt(0)); |
2567 __ ldr(to_reg, FieldMemOperand(from_reg, | 2609 __ ldr(to_reg, FieldMemOperand(from_reg, |
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4586 ASSERT(osr_pc_offset_ == -1); | 4628 ASSERT(osr_pc_offset_ == -1); |
4587 osr_pc_offset_ = masm()->pc_offset(); | 4629 osr_pc_offset_ = masm()->pc_offset(); |
4588 } | 4630 } |
4589 | 4631 |
4590 | 4632 |
4591 | 4633 |
4592 | 4634 |
4593 #undef __ | 4635 #undef __ |
4594 | 4636 |
4595 } } // namespace v8::internal | 4637 } } // namespace v8::internal |
OLD | NEW |