| 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 2729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2740 context()->Plug(if_true, if_false); | 2740 context()->Plug(if_true, if_false); |
| 2741 } | 2741 } |
| 2742 | 2742 |
| 2743 | 2743 |
| 2744 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( | 2744 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( |
| 2745 CallRuntime* expr) { | 2745 CallRuntime* expr) { |
| 2746 ZoneList<Expression*>* args = expr->arguments(); | 2746 ZoneList<Expression*>* args = expr->arguments(); |
| 2747 ASSERT(args->length() == 1); | 2747 ASSERT(args->length() == 1); |
| 2748 VisitForAccumulatorValue(args->at(0)); | 2748 VisitForAccumulatorValue(args->at(0)); |
| 2749 | 2749 |
| 2750 Label materialize_true, materialize_false; | 2750 Label materialize_true, materialize_false, skip_lookup; |
| 2751 Label* if_true = NULL; | 2751 Label* if_true = NULL; |
| 2752 Label* if_false = NULL; | 2752 Label* if_false = NULL; |
| 2753 Label* fall_through = NULL; | 2753 Label* fall_through = NULL; |
| 2754 context()->PrepareTest(&materialize_true, &materialize_false, | 2754 context()->PrepareTest(&materialize_true, &materialize_false, |
| 2755 &if_true, &if_false, &fall_through); | 2755 &if_true, &if_false, &fall_through); |
| 2756 | 2756 |
| 2757 Register object = x0; | 2757 Register object = x0; |
| 2758 __ AssertNotSmi(object); | 2758 __ AssertNotSmi(object); |
| 2759 | 2759 |
| 2760 Register map = x10; | 2760 Register map = x10; |
| 2761 Register bitfield2 = x11; | 2761 Register bitfield2 = x11; |
| 2762 __ Ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 2762 __ Ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 2763 __ Ldrb(bitfield2, FieldMemOperand(map, Map::kBitField2Offset)); | 2763 __ Ldrb(bitfield2, FieldMemOperand(map, Map::kBitField2Offset)); |
| 2764 __ Tbnz(bitfield2, Map::kStringWrapperSafeForDefaultValueOf, if_true); | 2764 __ Tbnz(bitfield2, Map::kStringWrapperSafeForDefaultValueOf, &skip_lookup); |
| 2765 | 2765 |
| 2766 // Check for fast case object. Generate false result for slow case object. | 2766 // Check for fast case object. Generate false result for slow case object. |
| 2767 Register props = x12; | 2767 Register props = x12; |
| 2768 Register props_map = x12; | 2768 Register props_map = x12; |
| 2769 Register hash_table_map = x13; | 2769 Register hash_table_map = x13; |
| 2770 __ Ldr(props, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 2770 __ Ldr(props, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 2771 __ Ldr(props_map, FieldMemOperand(props, HeapObject::kMapOffset)); | 2771 __ Ldr(props_map, FieldMemOperand(props, HeapObject::kMapOffset)); |
| 2772 __ LoadRoot(hash_table_map, Heap::kHashTableMapRootIndex); | 2772 __ LoadRoot(hash_table_map, Heap::kHashTableMapRootIndex); |
| 2773 __ Cmp(props_map, hash_table_map); | 2773 __ Cmp(props_map, hash_table_map); |
| 2774 __ B(eq, if_false); | 2774 __ B(eq, if_false); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2806 __ Bind(&loop); | 2806 __ Bind(&loop); |
| 2807 __ Ldr(x15, MemOperand(descriptors)); | 2807 __ Ldr(x15, MemOperand(descriptors)); |
| 2808 __ Cmp(x15, valueof_string); | 2808 __ Cmp(x15, valueof_string); |
| 2809 __ B(eq, if_false); | 2809 __ B(eq, if_false); |
| 2810 __ Add(descriptors, descriptors, | 2810 __ Add(descriptors, descriptors, |
| 2811 DescriptorArray::kDescriptorSize * kPointerSize); | 2811 DescriptorArray::kDescriptorSize * kPointerSize); |
| 2812 __ Cmp(descriptors, descriptors_end); | 2812 __ Cmp(descriptors, descriptors_end); |
| 2813 __ B(ne, &loop); | 2813 __ B(ne, &loop); |
| 2814 | 2814 |
| 2815 __ Bind(&done); | 2815 __ Bind(&done); |
| 2816 |
| 2817 // Set the bit in the map to indicate that there is no local valueOf field. |
| 2818 __ Ldrb(x2, FieldMemOperand(map, Map::kBitField2Offset)); |
| 2819 __ Orr(x2, x2, 1 << Map::kStringWrapperSafeForDefaultValueOf); |
| 2820 __ Strb(x2, FieldMemOperand(map, Map::kBitField2Offset)); |
| 2821 |
| 2822 __ Bind(&skip_lookup); |
| 2823 |
| 2816 // If a valueOf property is not found on the object check that its prototype | 2824 // If a valueOf property is not found on the object check that its prototype |
| 2817 // is the unmodified String prototype. If not result is false. | 2825 // is the unmodified String prototype. If not result is false. |
| 2818 Register prototype = x1; | 2826 Register prototype = x1; |
| 2819 Register global_idx = x2; | 2827 Register global_idx = x2; |
| 2820 Register native_context = x2; | 2828 Register native_context = x2; |
| 2821 Register string_proto = x3; | 2829 Register string_proto = x3; |
| 2822 Register proto_map = x4; | 2830 Register proto_map = x4; |
| 2823 __ Ldr(prototype, FieldMemOperand(map, Map::kPrototypeOffset)); | 2831 __ Ldr(prototype, FieldMemOperand(map, Map::kPrototypeOffset)); |
| 2824 __ JumpIfSmi(prototype, if_false); | 2832 __ JumpIfSmi(prototype, if_false); |
| 2825 __ Ldr(proto_map, FieldMemOperand(prototype, HeapObject::kMapOffset)); | 2833 __ Ldr(proto_map, FieldMemOperand(prototype, HeapObject::kMapOffset)); |
| 2826 __ Ldr(global_idx, GlobalObjectMemOperand()); | 2834 __ Ldr(global_idx, GlobalObjectMemOperand()); |
| 2827 __ Ldr(native_context, | 2835 __ Ldr(native_context, |
| 2828 FieldMemOperand(global_idx, GlobalObject::kNativeContextOffset)); | 2836 FieldMemOperand(global_idx, GlobalObject::kNativeContextOffset)); |
| 2829 __ Ldr(string_proto, | 2837 __ Ldr(string_proto, |
| 2830 ContextMemOperand(native_context, | 2838 ContextMemOperand(native_context, |
| 2831 Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); | 2839 Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); |
| 2832 __ Cmp(proto_map, string_proto); | 2840 __ Cmp(proto_map, string_proto); |
| 2833 __ B(ne, if_false); | |
| 2834 | |
| 2835 __ B(if_true); | |
| 2836 | 2841 |
| 2837 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 2842 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 2843 Split(eq, if_true, if_false, fall_through); |
| 2844 |
| 2838 context()->Plug(if_true, if_false); | 2845 context()->Plug(if_true, if_false); |
| 2839 } | 2846 } |
| 2840 | 2847 |
| 2841 | 2848 |
| 2842 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { | 2849 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { |
| 2843 ZoneList<Expression*>* args = expr->arguments(); | 2850 ZoneList<Expression*>* args = expr->arguments(); |
| 2844 ASSERT(args->length() == 1); | 2851 ASSERT(args->length() == 1); |
| 2845 | 2852 |
| 2846 VisitForAccumulatorValue(args->at(0)); | 2853 VisitForAccumulatorValue(args->at(0)); |
| 2847 | 2854 |
| (...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4964 return previous_; | 4971 return previous_; |
| 4965 } | 4972 } |
| 4966 | 4973 |
| 4967 | 4974 |
| 4968 #undef __ | 4975 #undef __ |
| 4969 | 4976 |
| 4970 | 4977 |
| 4971 } } // namespace v8::internal | 4978 } } // namespace v8::internal |
| 4972 | 4979 |
| 4973 #endif // V8_TARGET_ARCH_A64 | 4980 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |