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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 // result = receiver[f](arg); | 2229 // result = receiver[f](arg); |
2230 __ bind(&l_call); | 2230 __ bind(&l_call); |
2231 __ LoadP(load_receiver, MemOperand(sp, kPointerSize)); | 2231 __ LoadP(load_receiver, MemOperand(sp, kPointerSize)); |
2232 __ LoadP(load_name, MemOperand(sp, 2 * kPointerSize)); | 2232 __ LoadP(load_name, MemOperand(sp, 2 * kPointerSize)); |
2233 __ mov(LoadDescriptor::SlotRegister(), | 2233 __ mov(LoadDescriptor::SlotRegister(), |
2234 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2234 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2235 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 2235 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
2236 CallIC(ic, TypeFeedbackId::None()); | 2236 CallIC(ic, TypeFeedbackId::None()); |
2237 __ mr(r4, r3); | 2237 __ mr(r4, r3); |
2238 __ StoreP(r4, MemOperand(sp, 2 * kPointerSize)); | 2238 __ StoreP(r4, MemOperand(sp, 2 * kPointerSize)); |
| 2239 SetCallPosition(expr, 1); |
2239 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2240 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2240 __ CallStub(&stub); | 2241 __ CallStub(&stub); |
2241 | 2242 |
2242 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2243 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2243 __ Drop(1); // The function is still on the stack; drop it. | 2244 __ Drop(1); // The function is still on the stack; drop it. |
2244 | 2245 |
2245 // if (!result.done) goto l_try; | 2246 // if (!result.done) goto l_try; |
2246 __ Move(load_receiver, r3); | 2247 __ Move(load_receiver, r3); |
2247 | 2248 |
2248 __ push(load_receiver); // save result | 2249 __ push(load_receiver); // save result |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3094 | 3095 |
3095 | 3096 |
3096 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 3097 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
3097 // Load the arguments. | 3098 // Load the arguments. |
3098 ZoneList<Expression*>* args = expr->arguments(); | 3099 ZoneList<Expression*>* args = expr->arguments(); |
3099 int arg_count = args->length(); | 3100 int arg_count = args->length(); |
3100 for (int i = 0; i < arg_count; i++) { | 3101 for (int i = 0; i < arg_count; i++) { |
3101 VisitForStackValue(args->at(i)); | 3102 VisitForStackValue(args->at(i)); |
3102 } | 3103 } |
3103 | 3104 |
3104 SetExpressionPosition(expr); | 3105 SetCallPosition(expr, arg_count); |
3105 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 3106 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
3106 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackICSlot())); | 3107 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackICSlot())); |
3107 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 3108 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
3108 // Don't assign a type feedback id to the IC, since type feedback is provided | 3109 // Don't assign a type feedback id to the IC, since type feedback is provided |
3109 // by the vector above. | 3110 // by the vector above. |
3110 CallIC(ic); | 3111 CallIC(ic); |
3111 | 3112 |
3112 RecordJSReturnSite(expr); | 3113 RecordJSReturnSite(expr); |
3113 // Restore context register. | 3114 // Restore context register. |
3114 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3115 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3229 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 3230 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
3230 __ push(r4); | 3231 __ push(r4); |
3231 EmitResolvePossiblyDirectEval(arg_count); | 3232 EmitResolvePossiblyDirectEval(arg_count); |
3232 | 3233 |
3233 // Touch up the stack with the resolved function. | 3234 // Touch up the stack with the resolved function. |
3234 __ StoreP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 3235 __ StoreP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
3235 | 3236 |
3236 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 3237 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
3237 | 3238 |
3238 // Record source position for debugger. | 3239 // Record source position for debugger. |
3239 SetExpressionPosition(expr); | 3240 SetCallPosition(expr, arg_count); |
3240 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 3241 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
3241 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 3242 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
3242 __ CallStub(&stub); | 3243 __ CallStub(&stub); |
3243 RecordJSReturnSite(expr); | 3244 RecordJSReturnSite(expr); |
3244 // Restore context register. | 3245 // Restore context register. |
3245 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3246 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3246 context()->DropAndPlug(1, r3); | 3247 context()->DropAndPlug(1, r3); |
3247 } else if (call_type == Call::GLOBAL_CALL) { | 3248 } else if (call_type == Call::GLOBAL_CALL) { |
3248 EmitCallWithLoadIC(expr); | 3249 EmitCallWithLoadIC(expr); |
3249 | 3250 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3301 | 3302 |
3302 // Push the arguments ("left-to-right") on the stack. | 3303 // Push the arguments ("left-to-right") on the stack. |
3303 ZoneList<Expression*>* args = expr->arguments(); | 3304 ZoneList<Expression*>* args = expr->arguments(); |
3304 int arg_count = args->length(); | 3305 int arg_count = args->length(); |
3305 for (int i = 0; i < arg_count; i++) { | 3306 for (int i = 0; i < arg_count; i++) { |
3306 VisitForStackValue(args->at(i)); | 3307 VisitForStackValue(args->at(i)); |
3307 } | 3308 } |
3308 | 3309 |
3309 // Call the construct call builtin that handles allocation and | 3310 // Call the construct call builtin that handles allocation and |
3310 // constructor invocation. | 3311 // constructor invocation. |
3311 SetExpressionPosition(expr); | 3312 SetConstructCallPosition(expr); |
3312 | 3313 |
3313 // Load function and argument count into r4 and r3. | 3314 // Load function and argument count into r4 and r3. |
3314 __ mov(r3, Operand(arg_count)); | 3315 __ mov(r3, Operand(arg_count)); |
3315 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize), r0); | 3316 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize), r0); |
3316 | 3317 |
3317 // Record call targets in unoptimized code. | 3318 // Record call targets in unoptimized code. |
3318 if (FLAG_pretenuring_call_new) { | 3319 if (FLAG_pretenuring_call_new) { |
3319 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3320 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
3320 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | 3321 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
3321 expr->CallNewFeedbackSlot().ToInt() + 1); | 3322 expr->CallNewFeedbackSlot().ToInt() + 1); |
(...skipping 22 matching lines...) Expand all Loading... |
3344 | 3345 |
3345 // Push the arguments ("left-to-right") on the stack. | 3346 // Push the arguments ("left-to-right") on the stack. |
3346 ZoneList<Expression*>* args = expr->arguments(); | 3347 ZoneList<Expression*>* args = expr->arguments(); |
3347 int arg_count = args->length(); | 3348 int arg_count = args->length(); |
3348 for (int i = 0; i < arg_count; i++) { | 3349 for (int i = 0; i < arg_count; i++) { |
3349 VisitForStackValue(args->at(i)); | 3350 VisitForStackValue(args->at(i)); |
3350 } | 3351 } |
3351 | 3352 |
3352 // Call the construct call builtin that handles allocation and | 3353 // Call the construct call builtin that handles allocation and |
3353 // constructor invocation. | 3354 // constructor invocation. |
3354 SetExpressionPosition(expr); | 3355 SetConstructCallPosition(expr); |
3355 | 3356 |
3356 // Load function and argument count into r1 and r0. | 3357 // Load function and argument count into r1 and r0. |
3357 __ mov(r3, Operand(arg_count)); | 3358 __ mov(r3, Operand(arg_count)); |
3358 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize)); | 3359 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize)); |
3359 | 3360 |
3360 // Record call targets in unoptimized code. | 3361 // Record call targets in unoptimized code. |
3361 if (FLAG_pretenuring_call_new) { | 3362 if (FLAG_pretenuring_call_new) { |
3362 UNREACHABLE(); | 3363 UNREACHABLE(); |
3363 /* TODO(dslomov): support pretenuring. | 3364 /* TODO(dslomov): support pretenuring. |
3364 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3365 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4753 __ mov(LoadDescriptor::SlotRegister(), | 4754 __ mov(LoadDescriptor::SlotRegister(), |
4754 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4755 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4755 CallLoadIC(NOT_CONTEXTUAL); | 4756 CallLoadIC(NOT_CONTEXTUAL); |
4756 } | 4757 } |
4757 | 4758 |
4758 | 4759 |
4759 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4760 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4760 ZoneList<Expression*>* args = expr->arguments(); | 4761 ZoneList<Expression*>* args = expr->arguments(); |
4761 int arg_count = args->length(); | 4762 int arg_count = args->length(); |
4762 | 4763 |
4763 SetExpressionPosition(expr); | 4764 SetCallPosition(expr, arg_count); |
4764 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4765 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
4765 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 4766 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
4766 __ CallStub(&stub); | 4767 __ CallStub(&stub); |
4767 } | 4768 } |
4768 | 4769 |
4769 | 4770 |
4770 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4771 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4771 ZoneList<Expression*>* args = expr->arguments(); | 4772 ZoneList<Expression*>* args = expr->arguments(); |
4772 int arg_count = args->length(); | 4773 int arg_count = args->length(); |
4773 | 4774 |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5547 return ON_STACK_REPLACEMENT; | 5548 return ON_STACK_REPLACEMENT; |
5548 } | 5549 } |
5549 | 5550 |
5550 DCHECK(interrupt_address == | 5551 DCHECK(interrupt_address == |
5551 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5552 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5552 return OSR_AFTER_STACK_CHECK; | 5553 return OSR_AFTER_STACK_CHECK; |
5553 } | 5554 } |
5554 } // namespace internal | 5555 } // namespace internal |
5555 } // namespace v8 | 5556 } // namespace v8 |
5556 #endif // V8_TARGET_ARCH_PPC | 5557 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |