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 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2635 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); | 2635 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
2636 __ j(not_zero, if_true); | 2636 __ j(not_zero, if_true); |
2637 | 2637 |
2638 // Check for fast case object. Generate false result for slow case object. | 2638 // Check for fast case object. Generate false result for slow case object. |
2639 __ movq(rcx, FieldOperand(rax, JSObject::kPropertiesOffset)); | 2639 __ movq(rcx, FieldOperand(rax, JSObject::kPropertiesOffset)); |
2640 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset)); | 2640 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset)); |
2641 __ CompareRoot(rcx, Heap::kHashTableMapRootIndex); | 2641 __ CompareRoot(rcx, Heap::kHashTableMapRootIndex); |
2642 __ j(equal, if_false); | 2642 __ j(equal, if_false); |
2643 | 2643 |
2644 // Look for valueOf symbol in the descriptor array, and indicate false if | 2644 // Look for valueOf symbol in the descriptor array, and indicate false if |
2645 // found. Since we omit an enumeration index check, if it is added via a | 2645 // found. The type is not checked, so if it is a transition it is a false |
2646 // transition that shares its descriptor array, this is a false positive. | 2646 // negative. |
2647 Label entry, loop, done; | |
2648 | |
2649 // Skip loop if no descriptors are valid. | |
2650 __ NumberOfOwnDescriptors(rcx, rbx); | |
2651 __ cmpq(rcx, Immediate(0)); | |
2652 __ j(equal, &done); | |
2653 | |
2654 __ LoadInstanceDescriptors(rbx, rbx); | 2647 __ LoadInstanceDescriptors(rbx, rbx); |
2655 // rbx: descriptor array. | 2648 __ movq(rcx, FieldOperand(rbx, FixedArray::kLengthOffset)); |
2656 // rcx: valid entries in the descriptor array. | 2649 // rbx: descriptor array |
| 2650 // rcx: length of descriptor array |
2657 // Calculate the end of the descriptor array. | 2651 // Calculate the end of the descriptor array. |
2658 __ imul(rcx, rcx, Immediate(DescriptorArray::kDescriptorSize)); | |
2659 SmiIndex index = masm_->SmiToIndex(rdx, rcx, kPointerSizeLog2); | 2652 SmiIndex index = masm_->SmiToIndex(rdx, rcx, kPointerSizeLog2); |
2660 __ lea(rcx, | 2653 __ lea(rcx, |
2661 Operand( | 2654 Operand( |
2662 rbx, index.reg, index.scale, DescriptorArray::kFirstOffset)); | 2655 rbx, index.reg, index.scale, FixedArray::kHeaderSize)); |
2663 // Calculate location of the first key name. | 2656 // Calculate location of the first key name. |
2664 __ addq(rbx, Immediate(DescriptorArray::kFirstOffset)); | 2657 __ addq(rbx, Immediate(DescriptorArray::kFirstOffset)); |
2665 // Loop through all the keys in the descriptor array. If one of these is the | 2658 // Loop through all the keys in the descriptor array. If one of these is the |
2666 // symbol valueOf the result is false. | 2659 // symbol valueOf the result is false. |
| 2660 Label entry, loop; |
2667 __ jmp(&entry); | 2661 __ jmp(&entry); |
2668 __ bind(&loop); | 2662 __ bind(&loop); |
2669 __ movq(rdx, FieldOperand(rbx, 0)); | 2663 __ movq(rdx, FieldOperand(rbx, 0)); |
2670 __ Cmp(rdx, FACTORY->value_of_symbol()); | 2664 __ Cmp(rdx, FACTORY->value_of_symbol()); |
2671 __ j(equal, if_false); | 2665 __ j(equal, if_false); |
2672 __ addq(rbx, Immediate(DescriptorArray::kDescriptorSize * kPointerSize)); | 2666 __ addq(rbx, Immediate(DescriptorArray::kDescriptorSize * kPointerSize)); |
2673 __ bind(&entry); | 2667 __ bind(&entry); |
2674 __ cmpq(rbx, rcx); | 2668 __ cmpq(rbx, rcx); |
2675 __ j(not_equal, &loop); | 2669 __ j(not_equal, &loop); |
2676 | 2670 |
2677 __ bind(&done); | |
2678 // Reload map as register rbx was used as temporary above. | 2671 // Reload map as register rbx was used as temporary above. |
2679 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); | 2672 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); |
2680 | 2673 |
2681 // If a valueOf property is not found on the object check that its | 2674 // If a valueOf property is not found on the object check that it's |
2682 // prototype is the un-modified String prototype. If not result is false. | 2675 // prototype is the un-modified String prototype. If not result is false. |
2683 __ movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 2676 __ movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
2684 __ testq(rcx, Immediate(kSmiTagMask)); | 2677 __ testq(rcx, Immediate(kSmiTagMask)); |
2685 __ j(zero, if_false); | 2678 __ j(zero, if_false); |
2686 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset)); | 2679 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset)); |
2687 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2680 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2688 __ movq(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset)); | 2681 __ movq(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset)); |
2689 __ cmpq(rcx, | 2682 __ cmpq(rcx, |
2690 ContextOperand(rdx, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); | 2683 ContextOperand(rdx, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); |
2691 __ j(not_equal, if_false); | 2684 __ j(not_equal, if_false); |
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4560 *context_length = 0; | 4553 *context_length = 0; |
4561 return previous_; | 4554 return previous_; |
4562 } | 4555 } |
4563 | 4556 |
4564 | 4557 |
4565 #undef __ | 4558 #undef __ |
4566 | 4559 |
4567 } } // namespace v8::internal | 4560 } } // namespace v8::internal |
4568 | 4561 |
4569 #endif // V8_TARGET_ARCH_X64 | 4562 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |