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 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3377 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3377 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
3378 context()->Plug(r3); | 3378 context()->Plug(r3); |
3379 } | 3379 } |
3380 | 3380 |
3381 | 3381 |
3382 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 3382 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
3383 SuperCallReference* super_call_ref = | 3383 SuperCallReference* super_call_ref = |
3384 expr->expression()->AsSuperCallReference(); | 3384 expr->expression()->AsSuperCallReference(); |
3385 DCHECK_NOT_NULL(super_call_ref); | 3385 DCHECK_NOT_NULL(super_call_ref); |
3386 | 3386 |
3387 VariableProxy* new_target_proxy = super_call_ref->new_target_var(); | |
3388 VisitForStackValue(new_target_proxy); | |
3389 | |
3390 EmitLoadSuperConstructor(super_call_ref); | 3387 EmitLoadSuperConstructor(super_call_ref); |
3391 __ push(result_register()); | 3388 __ push(result_register()); |
3392 | 3389 |
3393 // Push the arguments ("left-to-right") on the stack. | 3390 // Push the arguments ("left-to-right") on the stack. |
3394 ZoneList<Expression*>* args = expr->arguments(); | 3391 ZoneList<Expression*>* args = expr->arguments(); |
3395 int arg_count = args->length(); | 3392 int arg_count = args->length(); |
3396 for (int i = 0; i < arg_count; i++) { | 3393 for (int i = 0; i < arg_count; i++) { |
3397 VisitForStackValue(args->at(i)); | 3394 VisitForStackValue(args->at(i)); |
3398 } | 3395 } |
3399 | 3396 |
3400 // Call the construct call builtin that handles allocation and | 3397 // Call the construct call builtin that handles allocation and |
3401 // constructor invocation. | 3398 // constructor invocation. |
3402 SetConstructCallPosition(expr); | 3399 SetConstructCallPosition(expr); |
3403 | 3400 |
| 3401 // Load original constructor into r7. |
| 3402 VisitForAccumulatorValue(super_call_ref->new_target_var()); |
| 3403 __ mr(r7, result_register()); |
| 3404 |
3404 // Load function and argument count into r1 and r0. | 3405 // Load function and argument count into r1 and r0. |
3405 __ mov(r3, Operand(arg_count)); | 3406 __ mov(r3, Operand(arg_count)); |
3406 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize)); | 3407 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize)); |
3407 | 3408 |
3408 // Record call targets in unoptimized code. | 3409 // Record call targets in unoptimized code. |
3409 if (FLAG_pretenuring_call_new) { | 3410 if (FLAG_pretenuring_call_new) { |
3410 UNREACHABLE(); | 3411 UNREACHABLE(); |
3411 /* TODO(dslomov): support pretenuring. | 3412 /* TODO(dslomov): support pretenuring. |
3412 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3413 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
3413 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | 3414 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
3414 expr->CallNewFeedbackSlot().ToInt() + 1); | 3415 expr->CallNewFeedbackSlot().ToInt() + 1); |
3415 */ | 3416 */ |
3416 } | 3417 } |
3417 | 3418 |
3418 __ Move(r5, FeedbackVector()); | 3419 __ Move(r5, FeedbackVector()); |
3419 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackSlot())); | 3420 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackSlot())); |
3420 | 3421 |
3421 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); | 3422 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); |
3422 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3423 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3423 | 3424 |
3424 __ Drop(1); | |
3425 | |
3426 RecordJSReturnSite(expr); | 3425 RecordJSReturnSite(expr); |
3427 | 3426 |
3428 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); | 3427 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); |
3429 context()->Plug(r3); | 3428 context()->Plug(r3); |
3430 } | 3429 } |
3431 | 3430 |
3432 | 3431 |
3433 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3432 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
3434 ZoneList<Expression*>* args = expr->arguments(); | 3433 ZoneList<Expression*>* args = expr->arguments(); |
3435 DCHECK(args->length() == 1); | 3434 DCHECK(args->length() == 1); |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4336 | 4335 |
4337 // new.target | 4336 // new.target |
4338 VisitForStackValue(args->at(0)); | 4337 VisitForStackValue(args->at(0)); |
4339 | 4338 |
4340 // .this_function | 4339 // .this_function |
4341 VisitForStackValue(args->at(1)); | 4340 VisitForStackValue(args->at(1)); |
4342 __ CallRuntime(Runtime::kGetPrototype, 1); | 4341 __ CallRuntime(Runtime::kGetPrototype, 1); |
4343 __ mr(r4, result_register()); | 4342 __ mr(r4, result_register()); |
4344 __ Push(r4); | 4343 __ Push(r4); |
4345 | 4344 |
| 4345 // Load original constructor into r7. |
| 4346 __ LoadP(r7, MemOperand(sp, 1 * kPointerSize)); |
| 4347 |
4346 // Check if the calling frame is an arguments adaptor frame. | 4348 // Check if the calling frame is an arguments adaptor frame. |
4347 Label adaptor_frame, args_set_up, runtime; | 4349 Label adaptor_frame, args_set_up, runtime; |
4348 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 4350 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
4349 __ LoadP(r6, MemOperand(r5, StandardFrameConstants::kContextOffset)); | 4351 __ LoadP(r6, MemOperand(r5, StandardFrameConstants::kContextOffset)); |
4350 __ CmpSmiLiteral(r6, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 4352 __ CmpSmiLiteral(r6, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
4351 __ beq(&adaptor_frame); | 4353 __ beq(&adaptor_frame); |
4352 | 4354 |
4353 // default constructor has no arguments, so no adaptor frame means no args. | 4355 // default constructor has no arguments, so no adaptor frame means no args. |
4354 __ li(r3, Operand::Zero()); | 4356 __ li(r3, Operand::Zero()); |
4355 __ b(&args_set_up); | 4357 __ b(&args_set_up); |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5599 return ON_STACK_REPLACEMENT; | 5601 return ON_STACK_REPLACEMENT; |
5600 } | 5602 } |
5601 | 5603 |
5602 DCHECK(interrupt_address == | 5604 DCHECK(interrupt_address == |
5603 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5605 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5604 return OSR_AFTER_STACK_CHECK; | 5606 return OSR_AFTER_STACK_CHECK; |
5605 } | 5607 } |
5606 } // namespace internal | 5608 } // namespace internal |
5607 } // namespace v8 | 5609 } // namespace v8 |
5608 #endif // V8_TARGET_ARCH_PPC | 5610 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |