| 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 2893 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2904   __ jmp(&done); | 2904   __ jmp(&done); | 
| 2905 | 2905 | 
| 2906   NopRuntimeCallHelper call_helper; | 2906   NopRuntimeCallHelper call_helper; | 
| 2907   generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | 2907   generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | 
| 2908 | 2908 | 
| 2909   __ bind(&done); | 2909   __ bind(&done); | 
| 2910   context()->Plug(result); | 2910   context()->Plug(result); | 
| 2911 } | 2911 } | 
| 2912 | 2912 | 
| 2913 | 2913 | 
| 2914 void FullCodeGenerator::EmitStringCharAt(CallRuntime* expr) { |  | 
| 2915   ZoneList<Expression*>* args = expr->arguments(); |  | 
| 2916   DCHECK(args->length() == 2); |  | 
| 2917 |  | 
| 2918   VisitForStackValue(args->at(0)); |  | 
| 2919   VisitForAccumulatorValue(args->at(1)); |  | 
| 2920 |  | 
| 2921   Register object = rbx; |  | 
| 2922   Register index = rax; |  | 
| 2923   Register scratch = rdx; |  | 
| 2924   Register result = rax; |  | 
| 2925 |  | 
| 2926   PopOperand(object); |  | 
| 2927 |  | 
| 2928   Label need_conversion; |  | 
| 2929   Label index_out_of_range; |  | 
| 2930   Label done; |  | 
| 2931   StringCharAtGenerator generator(object, |  | 
| 2932                                   index, |  | 
| 2933                                   scratch, |  | 
| 2934                                   result, |  | 
| 2935                                   &need_conversion, |  | 
| 2936                                   &need_conversion, |  | 
| 2937                                   &index_out_of_range, |  | 
| 2938                                   STRING_INDEX_IS_NUMBER); |  | 
| 2939   generator.GenerateFast(masm_); |  | 
| 2940   __ jmp(&done); |  | 
| 2941 |  | 
| 2942   __ bind(&index_out_of_range); |  | 
| 2943   // When the index is out of range, the spec requires us to return |  | 
| 2944   // the empty string. |  | 
| 2945   __ LoadRoot(result, Heap::kempty_stringRootIndex); |  | 
| 2946   __ jmp(&done); |  | 
| 2947 |  | 
| 2948   __ bind(&need_conversion); |  | 
| 2949   // Move smi zero into the result register, which will trigger |  | 
| 2950   // conversion. |  | 
| 2951   __ Move(result, Smi::FromInt(0)); |  | 
| 2952   __ jmp(&done); |  | 
| 2953 |  | 
| 2954   NopRuntimeCallHelper call_helper; |  | 
| 2955   generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); |  | 
| 2956 |  | 
| 2957   __ bind(&done); |  | 
| 2958   context()->Plug(result); |  | 
| 2959 } |  | 
| 2960 |  | 
| 2961 |  | 
| 2962 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 2914 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 
| 2963   ZoneList<Expression*>* args = expr->arguments(); | 2915   ZoneList<Expression*>* args = expr->arguments(); | 
| 2964   DCHECK_LE(2, args->length()); | 2916   DCHECK_LE(2, args->length()); | 
| 2965   // Push target, receiver and arguments onto the stack. | 2917   // Push target, receiver and arguments onto the stack. | 
| 2966   for (Expression* const arg : *args) { | 2918   for (Expression* const arg : *args) { | 
| 2967     VisitForStackValue(arg); | 2919     VisitForStackValue(arg); | 
| 2968   } | 2920   } | 
| 2969   PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); | 2921   PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); | 
| 2970   // Move target to rdi. | 2922   // Move target to rdi. | 
| 2971   int const argc = args->length() - 2; | 2923   int const argc = args->length() - 2; | 
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3822   DCHECK_EQ( | 3774   DCHECK_EQ( | 
| 3823       isolate->builtins()->OnStackReplacement()->entry(), | 3775       isolate->builtins()->OnStackReplacement()->entry(), | 
| 3824       Assembler::target_address_at(call_target_address, unoptimized_code)); | 3776       Assembler::target_address_at(call_target_address, unoptimized_code)); | 
| 3825   return ON_STACK_REPLACEMENT; | 3777   return ON_STACK_REPLACEMENT; | 
| 3826 } | 3778 } | 
| 3827 | 3779 | 
| 3828 }  // namespace internal | 3780 }  // namespace internal | 
| 3829 }  // namespace v8 | 3781 }  // namespace v8 | 
| 3830 | 3782 | 
| 3831 #endif  // V8_TARGET_ARCH_X64 | 3783 #endif  // V8_TARGET_ARCH_X64 | 
| OLD | NEW | 
|---|