| 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 3015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3026 } | 3026 } |
| 3027 } else { | 3027 } else { |
| 3028 VisitForStackValue(callee); | 3028 VisitForStackValue(callee); |
| 3029 // refEnv.WithBaseObject() | 3029 // refEnv.WithBaseObject() |
| 3030 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); | 3030 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
| 3031 __ push(r5); // Reserved receiver slot. | 3031 __ push(r5); // Reserved receiver slot. |
| 3032 } | 3032 } |
| 3033 } | 3033 } |
| 3034 | 3034 |
| 3035 | 3035 |
| 3036 void FullCodeGenerator::VisitCall(Call* expr) { | 3036 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { |
| 3037 #ifdef DEBUG | 3037 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
| 3038 // We want to verify that RecordJSReturnSite gets called on all paths | 3038 // to resolve the function we need to call. Then we call the resolved |
| 3039 // through this function. Avoid early returns. | 3039 // function using the given arguments. |
| 3040 expr->return_is_recorded_ = false; | 3040 ZoneList<Expression*>* args = expr->arguments(); |
| 3041 #endif | 3041 int arg_count = args->length(); |
| 3042 | 3042 |
| 3043 Comment cmnt(masm_, "[ Call"); | 3043 PushCalleeAndWithBaseObject(expr); |
| 3044 Expression* callee = expr->expression(); | |
| 3045 Call::CallType call_type = expr->GetCallType(isolate()); | |
| 3046 | 3044 |
| 3047 if (call_type == Call::POSSIBLY_EVAL_CALL) { | 3045 // Push the arguments. |
| 3048 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval | 3046 for (int i = 0; i < arg_count; i++) { |
| 3049 // to resolve the function we need to call. Then we call the resolved | 3047 VisitForStackValue(args->at(i)); |
| 3050 // function using the given arguments. | |
| 3051 ZoneList<Expression*>* args = expr->arguments(); | |
| 3052 int arg_count = args->length(); | |
| 3053 | |
| 3054 PushCalleeAndWithBaseObject(expr); | |
| 3055 | |
| 3056 // Push the arguments. | |
| 3057 for (int i = 0; i < arg_count; i++) { | |
| 3058 VisitForStackValue(args->at(i)); | |
| 3059 } | |
| 3060 | |
| 3061 // Push a copy of the function (found below the arguments) and | |
| 3062 // resolve eval. | |
| 3063 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | |
| 3064 __ push(r4); | |
| 3065 EmitResolvePossiblyDirectEval(arg_count); | |
| 3066 | |
| 3067 // Touch up the stack with the resolved function. | |
| 3068 __ StoreP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | |
| 3069 | |
| 3070 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | |
| 3071 | |
| 3072 // Record source position for debugger. | |
| 3073 SetCallPosition(expr, arg_count); | |
| 3074 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | |
| 3075 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | |
| 3076 __ CallStub(&stub); | |
| 3077 RecordJSReturnSite(expr); | |
| 3078 // Restore context register. | |
| 3079 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
| 3080 context()->DropAndPlug(1, r3); | |
| 3081 } else if (call_type == Call::GLOBAL_CALL) { | |
| 3082 EmitCallWithLoadIC(expr); | |
| 3083 | |
| 3084 } else if (call_type == Call::LOOKUP_SLOT_CALL) { | |
| 3085 // Call to a lookup slot (dynamically introduced variable). | |
| 3086 PushCalleeAndWithBaseObject(expr); | |
| 3087 EmitCall(expr); | |
| 3088 } else if (call_type == Call::NAMED_PROPERTY_CALL) { | |
| 3089 Property* property = callee->AsProperty(); | |
| 3090 VisitForStackValue(property->obj()); | |
| 3091 EmitCallWithLoadIC(expr); | |
| 3092 } else if (call_type == Call::KEYED_PROPERTY_CALL) { | |
| 3093 Property* property = callee->AsProperty(); | |
| 3094 VisitForStackValue(property->obj()); | |
| 3095 EmitKeyedCallWithLoadIC(expr, property->key()); | |
| 3096 } else if (call_type == Call::NAMED_SUPER_PROPERTY_CALL) { | |
| 3097 EmitSuperCallWithLoadIC(expr); | |
| 3098 } else if (call_type == Call::KEYED_SUPER_PROPERTY_CALL) { | |
| 3099 EmitKeyedSuperCallWithLoadIC(expr); | |
| 3100 } else if (call_type == Call::SUPER_CALL) { | |
| 3101 EmitSuperConstructorCall(expr); | |
| 3102 } else { | |
| 3103 DCHECK(call_type == Call::OTHER_CALL); | |
| 3104 // Call to an arbitrary expression not handled specially above. | |
| 3105 VisitForStackValue(callee); | |
| 3106 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); | |
| 3107 __ push(r4); | |
| 3108 // Emit function call. | |
| 3109 EmitCall(expr); | |
| 3110 } | 3048 } |
| 3111 | 3049 |
| 3112 #ifdef DEBUG | 3050 // Push a copy of the function (found below the arguments) and |
| 3113 // RecordJSReturnSite should have been called. | 3051 // resolve eval. |
| 3114 DCHECK(expr->return_is_recorded_); | 3052 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
| 3115 #endif | 3053 __ push(r4); |
| 3054 EmitResolvePossiblyDirectEval(arg_count); |
| 3055 |
| 3056 // Touch up the stack with the resolved function. |
| 3057 __ StoreP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
| 3058 |
| 3059 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
| 3060 |
| 3061 // Record source position for debugger. |
| 3062 SetCallPosition(expr, arg_count); |
| 3063 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
| 3064 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
| 3065 __ CallStub(&stub); |
| 3066 RecordJSReturnSite(expr); |
| 3067 // Restore context register. |
| 3068 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 3069 context()->DropAndPlug(1, r3); |
| 3116 } | 3070 } |
| 3117 | 3071 |
| 3118 | 3072 |
| 3119 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 3073 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
| 3120 Comment cmnt(masm_, "[ CallNew"); | 3074 Comment cmnt(masm_, "[ CallNew"); |
| 3121 // According to ECMA-262, section 11.2.2, page 44, the function | 3075 // According to ECMA-262, section 11.2.2, page 44, the function |
| 3122 // expression in new calls must be evaluated before the | 3076 // expression in new calls must be evaluated before the |
| 3123 // arguments. | 3077 // arguments. |
| 3124 | 3078 |
| 3125 // Push constructor on the stack. If it's not a function it's used as | 3079 // Push constructor on the stack. If it's not a function it's used as |
| (...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5141 return ON_STACK_REPLACEMENT; | 5095 return ON_STACK_REPLACEMENT; |
| 5142 } | 5096 } |
| 5143 | 5097 |
| 5144 DCHECK(interrupt_address == | 5098 DCHECK(interrupt_address == |
| 5145 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5099 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5146 return OSR_AFTER_STACK_CHECK; | 5100 return OSR_AFTER_STACK_CHECK; |
| 5147 } | 5101 } |
| 5148 } // namespace internal | 5102 } // namespace internal |
| 5149 } // namespace v8 | 5103 } // namespace v8 |
| 5150 #endif // V8_TARGET_ARCH_PPC | 5104 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |