| 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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 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 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2784 // If the object is not a value type, return the object. | 2784 // If the object is not a value type, return the object. |
| 2785 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); | 2785 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); |
| 2786 __ j(not_equal, &done, Label::kNear); | 2786 __ j(not_equal, &done, Label::kNear); |
| 2787 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); | 2787 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); |
| 2788 | 2788 |
| 2789 __ bind(&done); | 2789 __ bind(&done); |
| 2790 context()->Plug(eax); | 2790 context()->Plug(eax); |
| 2791 } | 2791 } |
| 2792 | 2792 |
| 2793 | 2793 |
| 2794 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | |
| 2795 ZoneList<Expression*>* args = expr->arguments(); | |
| 2796 DCHECK_EQ(3, args->length()); | |
| 2797 | |
| 2798 Register string = eax; | |
| 2799 Register index = ebx; | |
| 2800 Register value = ecx; | |
| 2801 | |
| 2802 VisitForStackValue(args->at(0)); // index | |
| 2803 VisitForStackValue(args->at(1)); // value | |
| 2804 VisitForAccumulatorValue(args->at(2)); // string | |
| 2805 | |
| 2806 PopOperand(value); | |
| 2807 PopOperand(index); | |
| 2808 | |
| 2809 if (FLAG_debug_code) { | |
| 2810 __ test(value, Immediate(kSmiTagMask)); | |
| 2811 __ Check(zero, kNonSmiValue); | |
| 2812 __ test(index, Immediate(kSmiTagMask)); | |
| 2813 __ Check(zero, kNonSmiValue); | |
| 2814 } | |
| 2815 | |
| 2816 __ SmiUntag(value); | |
| 2817 __ SmiUntag(index); | |
| 2818 | |
| 2819 if (FLAG_debug_code) { | |
| 2820 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | |
| 2821 __ EmitSeqStringSetCharCheck(string, index, value, one_byte_seq_type); | |
| 2822 } | |
| 2823 | |
| 2824 __ mov_b(FieldOperand(string, index, times_1, SeqOneByteString::kHeaderSize), | |
| 2825 value); | |
| 2826 context()->Plug(string); | |
| 2827 } | |
| 2828 | |
| 2829 | |
| 2830 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { | |
| 2831 ZoneList<Expression*>* args = expr->arguments(); | |
| 2832 DCHECK_EQ(3, args->length()); | |
| 2833 | |
| 2834 Register string = eax; | |
| 2835 Register index = ebx; | |
| 2836 Register value = ecx; | |
| 2837 | |
| 2838 VisitForStackValue(args->at(0)); // index | |
| 2839 VisitForStackValue(args->at(1)); // value | |
| 2840 VisitForAccumulatorValue(args->at(2)); // string | |
| 2841 PopOperand(value); | |
| 2842 PopOperand(index); | |
| 2843 | |
| 2844 if (FLAG_debug_code) { | |
| 2845 __ test(value, Immediate(kSmiTagMask)); | |
| 2846 __ Check(zero, kNonSmiValue); | |
| 2847 __ test(index, Immediate(kSmiTagMask)); | |
| 2848 __ Check(zero, kNonSmiValue); | |
| 2849 __ SmiUntag(index); | |
| 2850 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | |
| 2851 __ EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type); | |
| 2852 __ SmiTag(index); | |
| 2853 } | |
| 2854 | |
| 2855 __ SmiUntag(value); | |
| 2856 // No need to untag a smi for two-byte addressing. | |
| 2857 __ mov_w(FieldOperand(string, index, times_1, SeqTwoByteString::kHeaderSize), | |
| 2858 value); | |
| 2859 context()->Plug(string); | |
| 2860 } | |
| 2861 | |
| 2862 | |
| 2863 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 2794 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
| 2864 ZoneList<Expression*>* args = expr->arguments(); | 2795 ZoneList<Expression*>* args = expr->arguments(); |
| 2865 DCHECK(args->length() == 1); | 2796 DCHECK(args->length() == 1); |
| 2866 | 2797 |
| 2867 VisitForAccumulatorValue(args->at(0)); | 2798 VisitForAccumulatorValue(args->at(0)); |
| 2868 | 2799 |
| 2869 Label done; | 2800 Label done; |
| 2870 StringCharFromCodeGenerator generator(eax, ebx); | 2801 StringCharFromCodeGenerator generator(eax, ebx); |
| 2871 generator.GenerateFast(masm_); | 2802 generator.GenerateFast(masm_); |
| 2872 __ jmp(&done); | 2803 __ jmp(&done); |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3791 isolate->builtins()->OnStackReplacement()->entry(), | 3722 isolate->builtins()->OnStackReplacement()->entry(), |
| 3792 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3723 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3793 return ON_STACK_REPLACEMENT; | 3724 return ON_STACK_REPLACEMENT; |
| 3794 } | 3725 } |
| 3795 | 3726 |
| 3796 | 3727 |
| 3797 } // namespace internal | 3728 } // namespace internal |
| 3798 } // namespace v8 | 3729 } // namespace v8 |
| 3799 | 3730 |
| 3800 #endif // V8_TARGET_ARCH_IA32 | 3731 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |