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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 Representation representation = details.representation(); | 487 Representation representation = details.representation(); |
488 ASSERT(!representation.IsNone()); | 488 ASSERT(!representation.IsNone()); |
489 | 489 |
490 if (details.type() == CONSTANT) { | 490 if (details.type() == CONSTANT) { |
491 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); | 491 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); |
492 __ Cmp(value_reg, constant); | 492 __ Cmp(value_reg, constant); |
493 __ j(not_equal, miss_label); | 493 __ j(not_equal, miss_label); |
494 } else if (representation.IsSmi()) { | 494 } else if (representation.IsSmi()) { |
495 __ JumpIfNotSmi(value_reg, miss_label); | 495 __ JumpIfNotSmi(value_reg, miss_label); |
496 } else if (representation.IsHeapObject()) { | 496 } else if (representation.IsHeapObject()) { |
| 497 __ JumpIfSmi(value_reg, miss_label); |
497 HeapType* field_type = descriptors->GetFieldType(descriptor); | 498 HeapType* field_type = descriptors->GetFieldType(descriptor); |
498 if (field_type->IsClass()) { | 499 HeapType::Iterator<Map> it = field_type->Classes(); |
499 __ CheckMap(value_reg, field_type->AsClass()->Map(), | 500 if (!it.Done()) { |
500 miss_label, DO_SMI_CHECK); | 501 Label do_store; |
501 } else { | 502 while (true) { |
502 ASSERT(HeapType::Any()->Is(field_type)); | 503 __ CompareMap(value_reg, it.Current()); |
503 __ JumpIfSmi(value_reg, miss_label); | 504 it.Advance(); |
| 505 if (it.Done()) { |
| 506 __ j(not_equal, miss_label); |
| 507 break; |
| 508 } |
| 509 __ j(equal, &do_store, Label::kNear); |
| 510 } |
| 511 __ bind(&do_store); |
504 } | 512 } |
505 } else if (representation.IsDouble()) { | 513 } else if (representation.IsDouble()) { |
506 Label do_store, heap_number; | 514 Label do_store, heap_number; |
507 __ AllocateHeapNumber(storage_reg, scratch1, slow); | 515 __ AllocateHeapNumber(storage_reg, scratch1, slow); |
508 | 516 |
509 __ JumpIfNotSmi(value_reg, &heap_number); | 517 __ JumpIfNotSmi(value_reg, &heap_number); |
510 __ SmiToInteger32(scratch1, value_reg); | 518 __ SmiToInteger32(scratch1, value_reg); |
511 __ Cvtlsi2sd(xmm0, scratch1); | 519 __ Cvtlsi2sd(xmm0, scratch1); |
512 __ jmp(&do_store); | 520 __ jmp(&do_store); |
513 | 521 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 // Adjust for the number of properties stored in the object. Even in the | 646 // Adjust for the number of properties stored in the object. Even in the |
639 // face of a transition we can use the old map here because the size of the | 647 // face of a transition we can use the old map here because the size of the |
640 // object and the number of in-object properties is not going to change. | 648 // object and the number of in-object properties is not going to change. |
641 index -= object->map()->inobject_properties(); | 649 index -= object->map()->inobject_properties(); |
642 | 650 |
643 Representation representation = lookup->representation(); | 651 Representation representation = lookup->representation(); |
644 ASSERT(!representation.IsNone()); | 652 ASSERT(!representation.IsNone()); |
645 if (representation.IsSmi()) { | 653 if (representation.IsSmi()) { |
646 __ JumpIfNotSmi(value_reg, miss_label); | 654 __ JumpIfNotSmi(value_reg, miss_label); |
647 } else if (representation.IsHeapObject()) { | 655 } else if (representation.IsHeapObject()) { |
| 656 __ JumpIfSmi(value_reg, miss_label); |
648 HeapType* field_type = lookup->GetFieldType(); | 657 HeapType* field_type = lookup->GetFieldType(); |
649 if (field_type->IsClass()) { | 658 HeapType::Iterator<Map> it = field_type->Classes(); |
650 __ CheckMap(value_reg, field_type->AsClass()->Map(), | 659 if (!it.Done()) { |
651 miss_label, DO_SMI_CHECK); | 660 Label do_store; |
652 } else { | 661 while (true) { |
653 ASSERT(HeapType::Any()->Is(field_type)); | 662 __ CompareMap(value_reg, it.Current()); |
654 __ JumpIfSmi(value_reg, miss_label); | 663 it.Advance(); |
| 664 if (it.Done()) { |
| 665 __ j(not_equal, miss_label); |
| 666 break; |
| 667 } |
| 668 __ j(equal, &do_store, Label::kNear); |
| 669 } |
| 670 __ bind(&do_store); |
655 } | 671 } |
656 } else if (representation.IsDouble()) { | 672 } else if (representation.IsDouble()) { |
657 // Load the double storage. | 673 // Load the double storage. |
658 if (index < 0) { | 674 if (index < 0) { |
659 int offset = object->map()->instance_size() + (index * kPointerSize); | 675 int offset = object->map()->instance_size() + (index * kPointerSize); |
660 __ movp(scratch1, FieldOperand(receiver_reg, offset)); | 676 __ movp(scratch1, FieldOperand(receiver_reg, offset)); |
661 } else { | 677 } else { |
662 __ movp(scratch1, | 678 __ movp(scratch1, |
663 FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | 679 FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
664 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 680 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 // ----------------------------------- | 1474 // ----------------------------------- |
1459 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1475 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1460 } | 1476 } |
1461 | 1477 |
1462 | 1478 |
1463 #undef __ | 1479 #undef __ |
1464 | 1480 |
1465 } } // namespace v8::internal | 1481 } } // namespace v8::internal |
1466 | 1482 |
1467 #endif // V8_TARGET_ARCH_X64 | 1483 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |