| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 6 | 6 |
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2776 // If the object is not a value type, return the object. | 2776 // If the object is not a value type, return the object. |
| 2777 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); | 2777 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); |
| 2778 __ j(not_equal, &done, Label::kNear); | 2778 __ j(not_equal, &done, Label::kNear); |
| 2779 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); | 2779 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); |
| 2780 | 2780 |
| 2781 __ bind(&done); | 2781 __ bind(&done); |
| 2782 context()->Plug(eax); | 2782 context()->Plug(eax); |
| 2783 } | 2783 } |
| 2784 | 2784 |
| 2785 | 2785 |
| 2786 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | |
| 2787 ZoneList<Expression*>* args = expr->arguments(); | |
| 2788 DCHECK_EQ(3, args->length()); | |
| 2789 | |
| 2790 Register string = eax; | |
| 2791 Register index = ebx; | |
| 2792 Register value = ecx; | |
| 2793 | |
| 2794 VisitForStackValue(args->at(0)); // index | |
| 2795 VisitForStackValue(args->at(1)); // value | |
| 2796 VisitForAccumulatorValue(args->at(2)); // string | |
| 2797 | |
| 2798 PopOperand(value); | |
| 2799 PopOperand(index); | |
| 2800 | |
| 2801 if (FLAG_debug_code) { | |
| 2802 __ test(value, Immediate(kSmiTagMask)); | |
| 2803 __ Check(zero, kNonSmiValue); | |
| 2804 __ test(index, Immediate(kSmiTagMask)); | |
| 2805 __ Check(zero, kNonSmiValue); | |
| 2806 } | |
| 2807 | |
| 2808 __ SmiUntag(value); | |
| 2809 __ SmiUntag(index); | |
| 2810 | |
| 2811 if (FLAG_debug_code) { | |
| 2812 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | |
| 2813 __ EmitSeqStringSetCharCheck(string, index, value, one_byte_seq_type); | |
| 2814 } | |
| 2815 | |
| 2816 __ mov_b(FieldOperand(string, index, times_1, SeqOneByteString::kHeaderSize), | |
| 2817 value); | |
| 2818 context()->Plug(string); | |
| 2819 } | |
| 2820 | |
| 2821 | |
| 2822 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { | |
| 2823 ZoneList<Expression*>* args = expr->arguments(); | |
| 2824 DCHECK_EQ(3, args->length()); | |
| 2825 | |
| 2826 Register string = eax; | |
| 2827 Register index = ebx; | |
| 2828 Register value = ecx; | |
| 2829 | |
| 2830 VisitForStackValue(args->at(0)); // index | |
| 2831 VisitForStackValue(args->at(1)); // value | |
| 2832 VisitForAccumulatorValue(args->at(2)); // string | |
| 2833 PopOperand(value); | |
| 2834 PopOperand(index); | |
| 2835 | |
| 2836 if (FLAG_debug_code) { | |
| 2837 __ test(value, Immediate(kSmiTagMask)); | |
| 2838 __ Check(zero, kNonSmiValue); | |
| 2839 __ test(index, Immediate(kSmiTagMask)); | |
| 2840 __ Check(zero, kNonSmiValue); | |
| 2841 __ SmiUntag(index); | |
| 2842 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | |
| 2843 __ EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type); | |
| 2844 __ SmiTag(index); | |
| 2845 } | |
| 2846 | |
| 2847 __ SmiUntag(value); | |
| 2848 // No need to untag a smi for two-byte addressing. | |
| 2849 __ mov_w(FieldOperand(string, index, times_1, SeqTwoByteString::kHeaderSize), | |
| 2850 value); | |
| 2851 context()->Plug(string); | |
| 2852 } | |
| 2853 | |
| 2854 | |
| 2855 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 2786 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
| 2856 ZoneList<Expression*>* args = expr->arguments(); | 2787 ZoneList<Expression*>* args = expr->arguments(); |
| 2857 DCHECK(args->length() == 1); | 2788 DCHECK(args->length() == 1); |
| 2858 | 2789 |
| 2859 VisitForAccumulatorValue(args->at(0)); | 2790 VisitForAccumulatorValue(args->at(0)); |
| 2860 | 2791 |
| 2861 Label done; | 2792 Label done; |
| 2862 StringCharFromCodeGenerator generator(eax, ebx); | 2793 StringCharFromCodeGenerator generator(eax, ebx); |
| 2863 generator.GenerateFast(masm_); | 2794 generator.GenerateFast(masm_); |
| 2864 __ jmp(&done); | 2795 __ jmp(&done); |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3831 isolate->builtins()->OnStackReplacement()->entry(), | 3762 isolate->builtins()->OnStackReplacement()->entry(), |
| 3832 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3763 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3833 return ON_STACK_REPLACEMENT; | 3764 return ON_STACK_REPLACEMENT; |
| 3834 } | 3765 } |
| 3835 | 3766 |
| 3836 | 3767 |
| 3837 } // namespace internal | 3768 } // namespace internal |
| 3838 } // namespace v8 | 3769 } // namespace v8 |
| 3839 | 3770 |
| 3840 #endif // V8_TARGET_ARCH_X87 | 3771 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |