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

Side by Side Diff: src/mips/stub-cache-mips.cc

Issue 8106002: MIPS: port Merge experimental/gc branch to the bleeding_edge. (Closed)
Patch Set: Rebased on r9598, greatly simplified. Created 9 years, 2 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/mips/macro-assembler-mips.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 if (index < 0) { 425 if (index < 0) {
426 // Set the property straight into the object. 426 // Set the property straight into the object.
427 int offset = object->map()->instance_size() + (index * kPointerSize); 427 int offset = object->map()->instance_size() + (index * kPointerSize);
428 __ sw(a0, FieldMemOperand(receiver_reg, offset)); 428 __ sw(a0, FieldMemOperand(receiver_reg, offset));
429 429
430 // Skip updating write barrier if storing a smi. 430 // Skip updating write barrier if storing a smi.
431 __ JumpIfSmi(a0, &exit, scratch); 431 __ JumpIfSmi(a0, &exit, scratch);
432 432
433 // Update the write barrier for the array address. 433 // Update the write barrier for the array address.
434 // Pass the now unused name_reg as a scratch register. 434 // Pass the now unused name_reg as a scratch register.
435 __ RecordWrite(receiver_reg, Operand(offset), name_reg, scratch); 435 __ mov(name_reg, a0);
436 __ RecordWriteField(receiver_reg,
437 offset,
438 name_reg,
439 scratch,
440 kRAHasNotBeenSaved,
441 kDontSaveFPRegs);
436 } else { 442 } else {
437 // Write to the properties array. 443 // Write to the properties array.
438 int offset = index * kPointerSize + FixedArray::kHeaderSize; 444 int offset = index * kPointerSize + FixedArray::kHeaderSize;
439 // Get the properties array. 445 // Get the properties array.
440 __ lw(scratch, FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); 446 __ lw(scratch, FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
441 __ sw(a0, FieldMemOperand(scratch, offset)); 447 __ sw(a0, FieldMemOperand(scratch, offset));
442 448
443 // Skip updating write barrier if storing a smi. 449 // Skip updating write barrier if storing a smi.
444 __ JumpIfSmi(a0, &exit); 450 __ JumpIfSmi(a0, &exit);
445 451
446 // Update the write barrier for the array address. 452 // Update the write barrier for the array address.
447 // Ok to clobber receiver_reg and name_reg, since we return. 453 // Ok to clobber receiver_reg and name_reg, since we return.
448 __ RecordWrite(scratch, Operand(offset), name_reg, receiver_reg); 454 __ mov(name_reg, a0);
455 __ RecordWriteField(scratch,
456 offset,
457 name_reg,
458 receiver_reg,
459 kRAHasNotBeenSaved,
460 kDontSaveFPRegs);
449 } 461 }
450 462
451 // Return the value (register v0). 463 // Return the value (register v0).
452 __ bind(&exit); 464 __ bind(&exit);
453 __ mov(v0, a0); 465 __ mov(v0, a0);
454 __ Ret(); 466 __ Ret();
455 } 467 }
456 468
457 469
458 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { 470 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) {
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 __ lw(elements, FieldMemOperand(receiver, JSArray::kElementsOffset)); 1594 __ lw(elements, FieldMemOperand(receiver, JSArray::kElementsOffset));
1583 1595
1584 // Check that the elements are in fast mode and writable. 1596 // Check that the elements are in fast mode and writable.
1585 __ CheckMap(elements, 1597 __ CheckMap(elements,
1586 v0, 1598 v0,
1587 Heap::kFixedArrayMapRootIndex, 1599 Heap::kFixedArrayMapRootIndex,
1588 &call_builtin, 1600 &call_builtin,
1589 DONT_DO_SMI_CHECK); 1601 DONT_DO_SMI_CHECK);
1590 1602
1591 if (argc == 1) { // Otherwise fall through to call the builtin. 1603 if (argc == 1) { // Otherwise fall through to call the builtin.
1592 Label exit, with_write_barrier, attempt_to_grow_elements; 1604 Label exit, attempt_to_grow_elements;
1593 1605
1594 // Get the array's length into v0 and calculate new length. 1606 // Get the array's length into v0 and calculate new length.
1595 __ lw(v0, FieldMemOperand(receiver, JSArray::kLengthOffset)); 1607 __ lw(v0, FieldMemOperand(receiver, JSArray::kLengthOffset));
1596 STATIC_ASSERT(kSmiTagSize == 1); 1608 STATIC_ASSERT(kSmiTagSize == 1);
1597 STATIC_ASSERT(kSmiTag == 0); 1609 STATIC_ASSERT(kSmiTag == 0);
1598 __ Addu(v0, v0, Operand(Smi::FromInt(argc))); 1610 __ Addu(v0, v0, Operand(Smi::FromInt(argc)));
1599 1611
1600 // Get the element's length. 1612 // Get the element's length.
1601 __ lw(t0, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1613 __ lw(t0, FieldMemOperand(elements, FixedArray::kLengthOffset));
1602 1614
1603 // Check if we could survive without allocation. 1615 // Check if we could survive without allocation.
1604 __ Branch(&attempt_to_grow_elements, gt, v0, Operand(t0)); 1616 __ Branch(&attempt_to_grow_elements, gt, v0, Operand(t0));
1605 1617
1606 // Save new length. 1618 // Save new length.
1607 __ sw(v0, FieldMemOperand(receiver, JSArray::kLengthOffset)); 1619 __ sw(v0, FieldMemOperand(receiver, JSArray::kLengthOffset));
1608 1620
1609 // Push the element. 1621 // Push the element.
1610 __ lw(t0, MemOperand(sp, (argc - 1) * kPointerSize)); 1622 __ lw(t0, MemOperand(sp, (argc - 1) * kPointerSize));
1611 // We may need a register containing the address end_elements below, 1623 // We may need a register containing the address end_elements below,
1612 // so write back the value in end_elements. 1624 // so write back the value in end_elements.
1613 __ sll(end_elements, v0, kPointerSizeLog2 - kSmiTagSize); 1625 __ sll(end_elements, v0, kPointerSizeLog2 - kSmiTagSize);
1614 __ Addu(end_elements, elements, end_elements); 1626 __ Addu(end_elements, elements, end_elements);
1615 const int kEndElementsOffset = 1627 const int kEndElementsOffset =
1616 FixedArray::kHeaderSize - kHeapObjectTag - argc * kPointerSize; 1628 FixedArray::kHeaderSize - kHeapObjectTag - argc * kPointerSize;
1617 __ Addu(end_elements, end_elements, kEndElementsOffset); 1629 __ Addu(end_elements, end_elements, kEndElementsOffset);
1618 __ sw(t0, MemOperand(end_elements)); 1630 __ sw(t0, MemOperand(end_elements));
1619 1631
1620 // Check for a smi. 1632 // Check for a smi.
1633 Label with_write_barrier;
1621 __ JumpIfNotSmi(t0, &with_write_barrier); 1634 __ JumpIfNotSmi(t0, &with_write_barrier);
1622 __ bind(&exit); 1635 __ bind(&exit);
1623 __ Drop(argc + 1); 1636 __ Drop(argc + 1);
1624 __ Ret(); 1637 __ Ret();
1625 1638
1626 __ bind(&with_write_barrier); 1639 __ bind(&with_write_barrier);
1627 __ InNewSpace(elements, t0, eq, &exit); 1640 __ RecordWrite(elements,
1628 __ RecordWriteHelper(elements, end_elements, t0); 1641 end_elements,
1642 t0,
1643 kRAHasNotBeenSaved,
1644 kDontSaveFPRegs,
1645 EMIT_REMEMBERED_SET,
1646 OMIT_SMI_CHECK);
1629 __ Drop(argc + 1); 1647 __ Drop(argc + 1);
1630 __ Ret(); 1648 __ Ret();
1631 1649
1632 __ bind(&attempt_to_grow_elements); 1650 __ bind(&attempt_to_grow_elements);
1633 // v0: array's length + 1. 1651 // v0: array's length + 1.
1634 // t0: elements' length. 1652 // t0: elements' length.
1635 1653
1636 if (!FLAG_inline_new) { 1654 if (!FLAG_inline_new) {
1637 __ Branch(&call_builtin); 1655 __ Branch(&call_builtin);
1638 } 1656 }
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
2725 // to update the property details in the property dictionary of the 2743 // to update the property details in the property dictionary of the
2726 // global object. We bail out to the runtime system to do that. 2744 // global object. We bail out to the runtime system to do that.
2727 __ li(t0, Operand(Handle<JSGlobalPropertyCell>(cell))); 2745 __ li(t0, Operand(Handle<JSGlobalPropertyCell>(cell)));
2728 __ LoadRoot(t1, Heap::kTheHoleValueRootIndex); 2746 __ LoadRoot(t1, Heap::kTheHoleValueRootIndex);
2729 __ lw(t2, FieldMemOperand(t0, JSGlobalPropertyCell::kValueOffset)); 2747 __ lw(t2, FieldMemOperand(t0, JSGlobalPropertyCell::kValueOffset));
2730 __ Branch(&miss, eq, t1, Operand(t2)); 2748 __ Branch(&miss, eq, t1, Operand(t2));
2731 2749
2732 // Store the value in the cell. 2750 // Store the value in the cell.
2733 __ sw(a0, FieldMemOperand(t0, JSGlobalPropertyCell::kValueOffset)); 2751 __ sw(a0, FieldMemOperand(t0, JSGlobalPropertyCell::kValueOffset));
2734 __ mov(v0, a0); // Stored value must be returned in v0. 2752 __ mov(v0, a0); // Stored value must be returned in v0.
2753
2754 // This trashes a0 but the value is returned in v0 anyway.
2755 __ RecordWriteField(t0,
2756 JSGlobalPropertyCell::kValueOffset,
2757 a0,
2758 a2,
2759 kRAHasNotBeenSaved,
2760 kDontSaveFPRegs,
2761 OMIT_REMEMBERED_SET);
2762
2735 Counters* counters = masm()->isolate()->counters(); 2763 Counters* counters = masm()->isolate()->counters();
2736 __ IncrementCounter(counters->named_store_global_inline(), 1, a1, a3); 2764 __ IncrementCounter(counters->named_store_global_inline(), 1, a1, a3);
2737 __ Ret(); 2765 __ Ret();
2738 2766
2739 // Handle store cache miss. 2767 // Handle store cache miss.
2740 __ bind(&miss); 2768 __ bind(&miss);
2741 __ IncrementCounter(counters->named_store_global_inline_miss(), 1, a1, a3); 2769 __ IncrementCounter(counters->named_store_global_inline_miss(), 1, a1, a3);
2742 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); 2770 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss();
2743 __ Jump(ic, RelocInfo::CODE_TARGET); 2771 __ Jump(ic, RelocInfo::CODE_TARGET);
2744 2772
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
4353 } else { 4381 } else {
4354 __ lw(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); 4382 __ lw(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
4355 } 4383 }
4356 // Compare smis. 4384 // Compare smis.
4357 __ Branch(&miss_force_generic, hs, key_reg, Operand(scratch)); 4385 __ Branch(&miss_force_generic, hs, key_reg, Operand(scratch));
4358 4386
4359 __ Addu(scratch, 4387 __ Addu(scratch,
4360 elements_reg, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 4388 elements_reg, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
4361 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); 4389 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2);
4362 __ sll(scratch2, key_reg, kPointerSizeLog2 - kSmiTagSize); 4390 __ sll(scratch2, key_reg, kPointerSizeLog2 - kSmiTagSize);
4363 __ Addu(scratch3, scratch2, scratch); 4391 __ Addu(scratch, scratch, scratch2);
4364 __ sw(value_reg, MemOperand(scratch3)); 4392 __ sw(value_reg, MemOperand(scratch));
4365 __ RecordWrite(scratch, Operand(scratch2), receiver_reg , elements_reg); 4393 __ mov(receiver_reg, value_reg);
4394 __ RecordWrite(elements_reg, // Object.
4395 scratch, // Address.
4396 receiver_reg, // Value.
4397 kRAHasNotBeenSaved,
4398 kDontSaveFPRegs);
4366 4399
4367 // value_reg (a0) is preserved. 4400 // value_reg (a0) is preserved.
4368 // Done. 4401 // Done.
4369 __ Ret(); 4402 __ Ret();
4370 4403
4371 __ bind(&miss_force_generic); 4404 __ bind(&miss_force_generic);
4372 Handle<Code> ic = 4405 Handle<Code> ic =
4373 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 4406 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
4374 __ Jump(ic, RelocInfo::CODE_TARGET); 4407 __ Jump(ic, RelocInfo::CODE_TARGET);
4375 } 4408 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
4502 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 4535 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
4503 __ Jump(ic, RelocInfo::CODE_TARGET); 4536 __ Jump(ic, RelocInfo::CODE_TARGET);
4504 } 4537 }
4505 4538
4506 4539
4507 #undef __ 4540 #undef __
4508 4541
4509 } } // namespace v8::internal 4542 } } // namespace v8::internal
4510 4543
4511 #endif // V8_TARGET_ARCH_MIPS 4544 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698