| 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 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 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2773 // If the object is not a value type, return the object. | 2773 // If the object is not a value type, return the object. |
| 2774 __ CmpObjectType(rax, JS_VALUE_TYPE, rbx); | 2774 __ CmpObjectType(rax, JS_VALUE_TYPE, rbx); |
| 2775 __ j(not_equal, &done); | 2775 __ j(not_equal, &done); |
| 2776 __ movp(rax, FieldOperand(rax, JSValue::kValueOffset)); | 2776 __ movp(rax, FieldOperand(rax, JSValue::kValueOffset)); |
| 2777 | 2777 |
| 2778 __ bind(&done); | 2778 __ bind(&done); |
| 2779 context()->Plug(rax); | 2779 context()->Plug(rax); |
| 2780 } | 2780 } |
| 2781 | 2781 |
| 2782 | 2782 |
| 2783 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | |
| 2784 ZoneList<Expression*>* args = expr->arguments(); | |
| 2785 DCHECK_EQ(3, args->length()); | |
| 2786 | |
| 2787 Register string = rax; | |
| 2788 Register index = rbx; | |
| 2789 Register value = rcx; | |
| 2790 | |
| 2791 VisitForStackValue(args->at(0)); // index | |
| 2792 VisitForStackValue(args->at(1)); // value | |
| 2793 VisitForAccumulatorValue(args->at(2)); // string | |
| 2794 PopOperand(value); | |
| 2795 PopOperand(index); | |
| 2796 | |
| 2797 if (FLAG_debug_code) { | |
| 2798 __ Check(__ CheckSmi(value), kNonSmiValue); | |
| 2799 __ Check(__ CheckSmi(index), kNonSmiValue); | |
| 2800 } | |
| 2801 | |
| 2802 __ SmiToInteger32(value, value); | |
| 2803 __ SmiToInteger32(index, index); | |
| 2804 | |
| 2805 if (FLAG_debug_code) { | |
| 2806 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | |
| 2807 __ EmitSeqStringSetCharCheck(string, index, value, one_byte_seq_type); | |
| 2808 } | |
| 2809 | |
| 2810 __ movb(FieldOperand(string, index, times_1, SeqOneByteString::kHeaderSize), | |
| 2811 value); | |
| 2812 context()->Plug(string); | |
| 2813 } | |
| 2814 | |
| 2815 | |
| 2816 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { | |
| 2817 ZoneList<Expression*>* args = expr->arguments(); | |
| 2818 DCHECK_EQ(3, args->length()); | |
| 2819 | |
| 2820 Register string = rax; | |
| 2821 Register index = rbx; | |
| 2822 Register value = rcx; | |
| 2823 | |
| 2824 VisitForStackValue(args->at(0)); // index | |
| 2825 VisitForStackValue(args->at(1)); // value | |
| 2826 VisitForAccumulatorValue(args->at(2)); // string | |
| 2827 PopOperand(value); | |
| 2828 PopOperand(index); | |
| 2829 | |
| 2830 if (FLAG_debug_code) { | |
| 2831 __ Check(__ CheckSmi(value), kNonSmiValue); | |
| 2832 __ Check(__ CheckSmi(index), kNonSmiValue); | |
| 2833 } | |
| 2834 | |
| 2835 __ SmiToInteger32(value, value); | |
| 2836 __ SmiToInteger32(index, index); | |
| 2837 | |
| 2838 if (FLAG_debug_code) { | |
| 2839 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | |
| 2840 __ EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type); | |
| 2841 } | |
| 2842 | |
| 2843 __ movw(FieldOperand(string, index, times_2, SeqTwoByteString::kHeaderSize), | |
| 2844 value); | |
| 2845 context()->Plug(rax); | |
| 2846 } | |
| 2847 | |
| 2848 | |
| 2849 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 2783 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
| 2850 ZoneList<Expression*>* args = expr->arguments(); | 2784 ZoneList<Expression*>* args = expr->arguments(); |
| 2851 DCHECK(args->length() == 1); | 2785 DCHECK(args->length() == 1); |
| 2852 | 2786 |
| 2853 VisitForAccumulatorValue(args->at(0)); | 2787 VisitForAccumulatorValue(args->at(0)); |
| 2854 | 2788 |
| 2855 Label done; | 2789 Label done; |
| 2856 StringCharFromCodeGenerator generator(rax, rbx); | 2790 StringCharFromCodeGenerator generator(rax, rbx); |
| 2857 generator.GenerateFast(masm_); | 2791 generator.GenerateFast(masm_); |
| 2858 __ jmp(&done); | 2792 __ jmp(&done); |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3822 DCHECK_EQ( | 3756 DCHECK_EQ( |
| 3823 isolate->builtins()->OnStackReplacement()->entry(), | 3757 isolate->builtins()->OnStackReplacement()->entry(), |
| 3824 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3758 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3825 return ON_STACK_REPLACEMENT; | 3759 return ON_STACK_REPLACEMENT; |
| 3826 } | 3760 } |
| 3827 | 3761 |
| 3828 } // namespace internal | 3762 } // namespace internal |
| 3829 } // namespace v8 | 3763 } // namespace v8 |
| 3830 | 3764 |
| 3831 #endif // V8_TARGET_ARCH_X64 | 3765 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |