OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
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 3416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3427 // Call the target. | 3427 // Call the target. |
3428 __ Mov(x0, argc); | 3428 __ Mov(x0, argc); |
3429 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3429 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
3430 // Restore context register. | 3430 // Restore context register. |
3431 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3431 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3432 // Discard the function left on TOS. | 3432 // Discard the function left on TOS. |
3433 context()->DropAndPlug(1, x0); | 3433 context()->DropAndPlug(1, x0); |
3434 } | 3434 } |
3435 | 3435 |
3436 | 3436 |
3437 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | |
3438 ZoneList<Expression*>* args = expr->arguments(); | |
3439 DCHECK(args->length() == 2); | |
3440 | |
3441 // Evaluate new.target and super constructor. | |
3442 VisitForStackValue(args->at(0)); | |
3443 VisitForStackValue(args->at(1)); | |
3444 | |
3445 // Call the construct call builtin that handles allocation and | |
3446 // constructor invocation. | |
3447 SetConstructCallPosition(expr); | |
3448 | |
3449 // Load new target into x3. | |
3450 __ Peek(x3, 1 * kPointerSize); | |
3451 | |
3452 // Check if the calling frame is an arguments adaptor frame. | |
3453 Label adaptor_frame, args_set_up, runtime; | |
3454 __ Ldr(x11, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | |
3455 __ Ldr(x12, MemOperand(x11, StandardFrameConstants::kContextOffset)); | |
3456 __ Cmp(x12, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | |
3457 __ B(eq, &adaptor_frame); | |
3458 // default constructor has no arguments, so no adaptor frame means no args. | |
3459 __ Mov(x0, Operand(0)); | |
3460 __ B(&args_set_up); | |
3461 | |
3462 // Copy arguments from adaptor frame. | |
3463 { | |
3464 __ bind(&adaptor_frame); | |
3465 __ Ldr(x1, MemOperand(x11, ArgumentsAdaptorFrameConstants::kLengthOffset)); | |
3466 __ SmiUntag(x1, x1); | |
3467 | |
3468 __ Mov(x0, x1); | |
3469 | |
3470 // Get arguments pointer in x11. | |
3471 __ Add(x11, x11, Operand(x1, LSL, kPointerSizeLog2)); | |
3472 __ Add(x11, x11, StandardFrameConstants::kCallerSPOffset); | |
3473 Label loop; | |
3474 __ bind(&loop); | |
3475 // Pre-decrement x11 with kPointerSize on each iteration. | |
3476 // Pre-decrement in order to skip receiver. | |
3477 __ Ldr(x10, MemOperand(x11, -kPointerSize, PreIndex)); | |
3478 __ Push(x10); | |
3479 __ Sub(x1, x1, Operand(1)); | |
3480 __ Cbnz(x1, &loop); | |
3481 } | |
3482 | |
3483 __ bind(&args_set_up); | |
3484 __ Peek(x1, Operand(x0, LSL, kPointerSizeLog2)); | |
3485 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | |
3486 | |
3487 // Restore context register. | |
3488 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
3489 | |
3490 context()->DropAndPlug(1, x0); | |
3491 } | |
3492 | |
3493 | |
3494 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 3437 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
3495 ZoneList<Expression*>* args = expr->arguments(); | 3438 ZoneList<Expression*>* args = expr->arguments(); |
3496 VisitForAccumulatorValue(args->at(0)); | 3439 VisitForAccumulatorValue(args->at(0)); |
3497 | 3440 |
3498 Label materialize_true, materialize_false; | 3441 Label materialize_true, materialize_false; |
3499 Label* if_true = NULL; | 3442 Label* if_true = NULL; |
3500 Label* if_false = NULL; | 3443 Label* if_false = NULL; |
3501 Label* fall_through = NULL; | 3444 Label* fall_through = NULL; |
3502 context()->PrepareTest(&materialize_true, &materialize_false, | 3445 context()->PrepareTest(&materialize_true, &materialize_false, |
3503 &if_true, &if_false, &fall_through); | 3446 &if_true, &if_false, &fall_through); |
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4934 } | 4877 } |
4935 | 4878 |
4936 return INTERRUPT; | 4879 return INTERRUPT; |
4937 } | 4880 } |
4938 | 4881 |
4939 | 4882 |
4940 } // namespace internal | 4883 } // namespace internal |
4941 } // namespace v8 | 4884 } // namespace v8 |
4942 | 4885 |
4943 #endif // V8_TARGET_ARCH_ARM64 | 4886 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |