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