OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 __ Ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); | 266 __ Ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); |
267 } | 267 } |
268 | 268 |
269 | 269 |
270 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, | 270 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, |
271 Register dst, | 271 Register dst, |
272 Register src, | 272 Register src, |
273 bool inobject, | 273 bool inobject, |
274 int index, | 274 int index, |
275 Representation representation) { | 275 Representation representation) { |
276 ASSERT(!FLAG_track_double_fields || !representation.IsDouble()); | 276 ASSERT(!representation.IsDouble()); |
277 USE(representation); | 277 USE(representation); |
278 if (inobject) { | 278 if (inobject) { |
279 int offset = index * kPointerSize; | 279 int offset = index * kPointerSize; |
280 __ Ldr(dst, FieldMemOperand(src, offset)); | 280 __ Ldr(dst, FieldMemOperand(src, offset)); |
281 } else { | 281 } else { |
282 // Calculate the offset into the properties array. | 282 // Calculate the offset into the properties array. |
283 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 283 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
284 __ Ldr(dst, FieldMemOperand(src, JSObject::kPropertiesOffset)); | 284 __ Ldr(dst, FieldMemOperand(src, JSObject::kPropertiesOffset)); |
285 __ Ldr(dst, FieldMemOperand(dst, offset)); | 285 __ Ldr(dst, FieldMemOperand(dst, offset)); |
286 } | 286 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 DescriptorArray* descriptors = transition->instance_descriptors(); | 436 DescriptorArray* descriptors = transition->instance_descriptors(); |
437 PropertyDetails details = descriptors->GetDetails(descriptor); | 437 PropertyDetails details = descriptors->GetDetails(descriptor); |
438 Representation representation = details.representation(); | 438 Representation representation = details.representation(); |
439 ASSERT(!representation.IsNone()); | 439 ASSERT(!representation.IsNone()); |
440 | 440 |
441 if (details.type() == CONSTANT) { | 441 if (details.type() == CONSTANT) { |
442 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); | 442 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); |
443 __ LoadObject(scratch1, constant); | 443 __ LoadObject(scratch1, constant); |
444 __ Cmp(value_reg, scratch1); | 444 __ Cmp(value_reg, scratch1); |
445 __ B(ne, miss_label); | 445 __ B(ne, miss_label); |
446 } else if (FLAG_track_fields && representation.IsSmi()) { | 446 } else if (representation.IsSmi()) { |
447 __ JumpIfNotSmi(value_reg, miss_label); | 447 __ JumpIfNotSmi(value_reg, miss_label); |
448 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 448 } else if (representation.IsHeapObject()) { |
449 __ JumpIfSmi(value_reg, miss_label); | 449 __ JumpIfSmi(value_reg, miss_label); |
450 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 450 } else if (representation.IsDouble()) { |
451 Label do_store, heap_number; | 451 Label do_store, heap_number; |
452 __ AllocateHeapNumber(storage_reg, slow, scratch1, scratch2); | 452 __ AllocateHeapNumber(storage_reg, slow, scratch1, scratch2); |
453 | 453 |
454 // TODO(jbramley): Is fp_scratch the most appropriate FP scratch register? | 454 // TODO(jbramley): Is fp_scratch the most appropriate FP scratch register? |
455 // It's only used in Fcmp, but it's not really safe to use it like this. | 455 // It's only used in Fcmp, but it's not really safe to use it like this. |
456 __ JumpIfNotSmi(value_reg, &heap_number); | 456 __ JumpIfNotSmi(value_reg, &heap_number); |
457 __ SmiUntagToDouble(fp_scratch, value_reg); | 457 __ SmiUntagToDouble(fp_scratch, value_reg); |
458 __ B(&do_store); | 458 __ B(&do_store); |
459 | 459 |
460 __ Bind(&heap_number); | 460 __ Bind(&heap_number); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 index -= object->map()->inobject_properties(); | 513 index -= object->map()->inobject_properties(); |
514 | 514 |
515 // TODO(verwaest): Share this code as a code stub. | 515 // TODO(verwaest): Share this code as a code stub. |
516 SmiCheck smi_check = representation.IsTagged() | 516 SmiCheck smi_check = representation.IsTagged() |
517 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | 517 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; |
518 if (index < 0) { | 518 if (index < 0) { |
519 // Set the property straight into the object. | 519 // Set the property straight into the object. |
520 int offset = object->map()->instance_size() + (index * kPointerSize); | 520 int offset = object->map()->instance_size() + (index * kPointerSize); |
521 // TODO(jbramley): This construct appears in several places in this | 521 // TODO(jbramley): This construct appears in several places in this |
522 // function. Try to clean it up, perhaps using a result_reg. | 522 // function. Try to clean it up, perhaps using a result_reg. |
523 if (FLAG_track_double_fields && representation.IsDouble()) { | 523 if (representation.IsDouble()) { |
524 __ Str(storage_reg, FieldMemOperand(receiver_reg, offset)); | 524 __ Str(storage_reg, FieldMemOperand(receiver_reg, offset)); |
525 } else { | 525 } else { |
526 __ Str(value_reg, FieldMemOperand(receiver_reg, offset)); | 526 __ Str(value_reg, FieldMemOperand(receiver_reg, offset)); |
527 } | 527 } |
528 | 528 |
529 if (!FLAG_track_fields || !representation.IsSmi()) { | 529 if (!representation.IsSmi()) { |
530 // Update the write barrier for the array address. | 530 // Update the write barrier for the array address. |
531 if (!FLAG_track_double_fields || !representation.IsDouble()) { | 531 if (!representation.IsDouble()) { |
532 __ Mov(storage_reg, value_reg); | 532 __ Mov(storage_reg, value_reg); |
533 } | 533 } |
534 __ RecordWriteField(receiver_reg, | 534 __ RecordWriteField(receiver_reg, |
535 offset, | 535 offset, |
536 storage_reg, | 536 storage_reg, |
537 scratch1, | 537 scratch1, |
538 kLRHasNotBeenSaved, | 538 kLRHasNotBeenSaved, |
539 kDontSaveFPRegs, | 539 kDontSaveFPRegs, |
540 EMIT_REMEMBERED_SET, | 540 EMIT_REMEMBERED_SET, |
541 smi_check); | 541 smi_check); |
542 } | 542 } |
543 } else { | 543 } else { |
544 // Write to the properties array. | 544 // Write to the properties array. |
545 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 545 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
546 // Get the properties array | 546 // Get the properties array |
547 __ Ldr(scratch1, | 547 __ Ldr(scratch1, |
548 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | 548 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
549 if (FLAG_track_double_fields && representation.IsDouble()) { | 549 if (representation.IsDouble()) { |
550 __ Str(storage_reg, FieldMemOperand(scratch1, offset)); | 550 __ Str(storage_reg, FieldMemOperand(scratch1, offset)); |
551 } else { | 551 } else { |
552 __ Str(value_reg, FieldMemOperand(scratch1, offset)); | 552 __ Str(value_reg, FieldMemOperand(scratch1, offset)); |
553 } | 553 } |
554 | 554 |
555 if (!FLAG_track_fields || !representation.IsSmi()) { | 555 if (!representation.IsSmi()) { |
556 // Update the write barrier for the array address. | 556 // Update the write barrier for the array address. |
557 if (!FLAG_track_double_fields || !representation.IsDouble()) { | 557 if (!representation.IsDouble()) { |
558 __ Mov(storage_reg, value_reg); | 558 __ Mov(storage_reg, value_reg); |
559 } | 559 } |
560 __ RecordWriteField(scratch1, | 560 __ RecordWriteField(scratch1, |
561 offset, | 561 offset, |
562 storage_reg, | 562 storage_reg, |
563 receiver_reg, | 563 receiver_reg, |
564 kLRHasNotBeenSaved, | 564 kLRHasNotBeenSaved, |
565 kDontSaveFPRegs, | 565 kDontSaveFPRegs, |
566 EMIT_REMEMBERED_SET, | 566 EMIT_REMEMBERED_SET, |
567 smi_check); | 567 smi_check); |
(...skipping 29 matching lines...) Expand all Loading... |
597 | 597 |
598 int index = lookup->GetFieldIndex().field_index(); | 598 int index = lookup->GetFieldIndex().field_index(); |
599 | 599 |
600 // Adjust for the number of properties stored in the object. Even in the | 600 // Adjust for the number of properties stored in the object. Even in the |
601 // face of a transition we can use the old map here because the size of the | 601 // face of a transition we can use the old map here because the size of the |
602 // object and the number of in-object properties is not going to change. | 602 // object and the number of in-object properties is not going to change. |
603 index -= object->map()->inobject_properties(); | 603 index -= object->map()->inobject_properties(); |
604 | 604 |
605 Representation representation = lookup->representation(); | 605 Representation representation = lookup->representation(); |
606 ASSERT(!representation.IsNone()); | 606 ASSERT(!representation.IsNone()); |
607 if (FLAG_track_fields && representation.IsSmi()) { | 607 if (representation.IsSmi()) { |
608 __ JumpIfNotSmi(value_reg, miss_label); | 608 __ JumpIfNotSmi(value_reg, miss_label); |
609 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 609 } else if (representation.IsHeapObject()) { |
610 __ JumpIfSmi(value_reg, miss_label); | 610 __ JumpIfSmi(value_reg, miss_label); |
611 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 611 } else if (representation.IsDouble()) { |
612 // Load the double storage. | 612 // Load the double storage. |
613 if (index < 0) { | 613 if (index < 0) { |
614 int offset = (index * kPointerSize) + object->map()->instance_size(); | 614 int offset = (index * kPointerSize) + object->map()->instance_size(); |
615 __ Ldr(scratch1, FieldMemOperand(receiver_reg, offset)); | 615 __ Ldr(scratch1, FieldMemOperand(receiver_reg, offset)); |
616 } else { | 616 } else { |
617 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; | 617 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; |
618 __ Ldr(scratch1, | 618 __ Ldr(scratch1, |
619 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | 619 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
620 __ Ldr(scratch1, FieldMemOperand(scratch1, offset)); | 620 __ Ldr(scratch1, FieldMemOperand(scratch1, offset)); |
621 } | 621 } |
(...skipping 21 matching lines...) Expand all Loading... |
643 } | 643 } |
644 | 644 |
645 // TODO(verwaest): Share this code as a code stub. | 645 // TODO(verwaest): Share this code as a code stub. |
646 SmiCheck smi_check = representation.IsTagged() | 646 SmiCheck smi_check = representation.IsTagged() |
647 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | 647 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; |
648 if (index < 0) { | 648 if (index < 0) { |
649 // Set the property straight into the object. | 649 // Set the property straight into the object. |
650 int offset = object->map()->instance_size() + (index * kPointerSize); | 650 int offset = object->map()->instance_size() + (index * kPointerSize); |
651 __ Str(value_reg, FieldMemOperand(receiver_reg, offset)); | 651 __ Str(value_reg, FieldMemOperand(receiver_reg, offset)); |
652 | 652 |
653 if (!FLAG_track_fields || !representation.IsSmi()) { | 653 if (!representation.IsSmi()) { |
654 // Skip updating write barrier if storing a smi. | 654 // Skip updating write barrier if storing a smi. |
655 __ JumpIfSmi(value_reg, &exit); | 655 __ JumpIfSmi(value_reg, &exit); |
656 | 656 |
657 // Update the write barrier for the array address. | 657 // Update the write barrier for the array address. |
658 // Pass the now unused name_reg as a scratch register. | 658 // Pass the now unused name_reg as a scratch register. |
659 __ Mov(name_reg, value_reg); | 659 __ Mov(name_reg, value_reg); |
660 __ RecordWriteField(receiver_reg, | 660 __ RecordWriteField(receiver_reg, |
661 offset, | 661 offset, |
662 name_reg, | 662 name_reg, |
663 scratch1, | 663 scratch1, |
664 kLRHasNotBeenSaved, | 664 kLRHasNotBeenSaved, |
665 kDontSaveFPRegs, | 665 kDontSaveFPRegs, |
666 EMIT_REMEMBERED_SET, | 666 EMIT_REMEMBERED_SET, |
667 smi_check); | 667 smi_check); |
668 } | 668 } |
669 } else { | 669 } else { |
670 // Write to the properties array. | 670 // Write to the properties array. |
671 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 671 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
672 // Get the properties array | 672 // Get the properties array |
673 __ Ldr(scratch1, | 673 __ Ldr(scratch1, |
674 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | 674 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
675 __ Str(value_reg, FieldMemOperand(scratch1, offset)); | 675 __ Str(value_reg, FieldMemOperand(scratch1, offset)); |
676 | 676 |
677 if (!FLAG_track_fields || !representation.IsSmi()) { | 677 if (!representation.IsSmi()) { |
678 // Skip updating write barrier if storing a smi. | 678 // Skip updating write barrier if storing a smi. |
679 __ JumpIfSmi(value_reg, &exit); | 679 __ JumpIfSmi(value_reg, &exit); |
680 | 680 |
681 // Update the write barrier for the array address. | 681 // Update the write barrier for the array address. |
682 // Ok to clobber receiver_reg and name_reg, since we return. | 682 // Ok to clobber receiver_reg and name_reg, since we return. |
683 __ Mov(name_reg, value_reg); | 683 __ Mov(name_reg, value_reg); |
684 __ RecordWriteField(scratch1, | 684 __ RecordWriteField(scratch1, |
685 offset, | 685 offset, |
686 name_reg, | 686 name_reg, |
687 receiver_reg, | 687 receiver_reg, |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 | 1538 |
1539 // Miss case, call the runtime. | 1539 // Miss case, call the runtime. |
1540 __ Bind(&miss); | 1540 __ Bind(&miss); |
1541 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1541 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1542 } | 1542 } |
1543 | 1543 |
1544 | 1544 |
1545 } } // namespace v8::internal | 1545 } } // namespace v8::internal |
1546 | 1546 |
1547 #endif // V8_TARGET_ARCH_A64 | 1547 #endif // V8_TARGET_ARCH_A64 |
OLD | NEW |