OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2943 | 2943 |
2944 | 2944 |
2945 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 2945 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
2946 // Load the arguments. | 2946 // Load the arguments. |
2947 ZoneList<Expression*>* args = expr->arguments(); | 2947 ZoneList<Expression*>* args = expr->arguments(); |
2948 int arg_count = args->length(); | 2948 int arg_count = args->length(); |
2949 for (int i = 0; i < arg_count; i++) { | 2949 for (int i = 0; i < arg_count; i++) { |
2950 VisitForStackValue(args->at(i)); | 2950 VisitForStackValue(args->at(i)); |
2951 } | 2951 } |
2952 | 2952 |
| 2953 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
2953 SetCallPosition(expr, arg_count); | 2954 SetCallPosition(expr, arg_count); |
2954 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 2955 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
2955 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackICSlot())); | 2956 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackICSlot())); |
2956 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2957 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2957 // Don't assign a type feedback id to the IC, since type feedback is provided | 2958 // Don't assign a type feedback id to the IC, since type feedback is provided |
2958 // by the vector above. | 2959 // by the vector above. |
2959 CallIC(ic); | 2960 CallIC(ic); |
2960 | 2961 |
2961 RecordJSReturnSite(expr); | 2962 RecordJSReturnSite(expr); |
2962 // Restore context register. | 2963 // Restore context register. |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3892 } | 3893 } |
3893 | 3894 |
3894 | 3895 |
3895 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 3896 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
3896 ZoneList<Expression*>* args = expr->arguments(); | 3897 ZoneList<Expression*>* args = expr->arguments(); |
3897 DCHECK_LE(2, args->length()); | 3898 DCHECK_LE(2, args->length()); |
3898 // Push target, receiver and arguments onto the stack. | 3899 // Push target, receiver and arguments onto the stack. |
3899 for (Expression* const arg : *args) { | 3900 for (Expression* const arg : *args) { |
3900 VisitForStackValue(arg); | 3901 VisitForStackValue(arg); |
3901 } | 3902 } |
| 3903 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
3902 // Move target to r4. | 3904 // Move target to r4. |
3903 int const argc = args->length() - 2; | 3905 int const argc = args->length() - 2; |
3904 __ LoadP(r4, MemOperand(sp, (argc + 1) * kPointerSize)); | 3906 __ LoadP(r4, MemOperand(sp, (argc + 1) * kPointerSize)); |
3905 // Call the target. | 3907 // Call the target. |
3906 __ mov(r3, Operand(argc)); | 3908 __ mov(r3, Operand(argc)); |
3907 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3909 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
3908 // Restore context register. | 3910 // Restore context register. |
3909 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3911 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3910 // Discard the function left on TOS. | 3912 // Discard the function left on TOS. |
3911 context()->DropAndPlug(1, r3); | 3913 context()->DropAndPlug(1, r3); |
3912 } | 3914 } |
3913 | 3915 |
3914 | 3916 |
3915 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | 3917 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
3916 ZoneList<Expression*>* args = expr->arguments(); | 3918 ZoneList<Expression*>* args = expr->arguments(); |
3917 DCHECK(args->length() >= 2); | 3919 DCHECK(args->length() >= 2); |
3918 | 3920 |
3919 int arg_count = args->length() - 2; // 2 ~ receiver and function. | 3921 int arg_count = args->length() - 2; // 2 ~ receiver and function. |
3920 for (int i = 0; i < arg_count + 1; i++) { | 3922 for (int i = 0; i < arg_count + 1; i++) { |
3921 VisitForStackValue(args->at(i)); | 3923 VisitForStackValue(args->at(i)); |
3922 } | 3924 } |
3923 VisitForAccumulatorValue(args->last()); // Function. | 3925 VisitForAccumulatorValue(args->last()); // Function. |
3924 | 3926 |
| 3927 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
3925 Label runtime, done; | 3928 Label runtime, done; |
3926 // Check for non-function argument (including proxy). | 3929 // Check for non-function argument (including proxy). |
3927 __ JumpIfSmi(r3, &runtime); | 3930 __ JumpIfSmi(r3, &runtime); |
3928 __ CompareObjectType(r3, r4, r4, JS_FUNCTION_TYPE); | 3931 __ CompareObjectType(r3, r4, r4, JS_FUNCTION_TYPE); |
3929 __ bne(&runtime); | 3932 __ bne(&runtime); |
3930 | 3933 |
3931 // InvokeFunction requires the function in r4. Move it in there. | 3934 // InvokeFunction requires the function in r4. Move it in there. |
3932 __ mr(r4, result_register()); | 3935 __ mr(r4, result_register()); |
3933 ParameterCount count(arg_count); | 3936 ParameterCount count(arg_count); |
3934 __ InvokeFunction(r4, count, CALL_FUNCTION, NullCallWrapper()); | 3937 __ InvokeFunction(r4, count, CALL_FUNCTION, NullCallWrapper()); |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5138 return ON_STACK_REPLACEMENT; | 5141 return ON_STACK_REPLACEMENT; |
5139 } | 5142 } |
5140 | 5143 |
5141 DCHECK(interrupt_address == | 5144 DCHECK(interrupt_address == |
5142 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5145 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5143 return OSR_AFTER_STACK_CHECK; | 5146 return OSR_AFTER_STACK_CHECK; |
5144 } | 5147 } |
5145 } // namespace internal | 5148 } // namespace internal |
5146 } // namespace v8 | 5149 } // namespace v8 |
5147 #endif // V8_TARGET_ARCH_PPC | 5150 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |