OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 // by the vector above. | 2592 // by the vector above. |
2593 CallIC(ic); | 2593 CallIC(ic); |
2594 OperandStackDepthDecrement(arg_count + 1); | 2594 OperandStackDepthDecrement(arg_count + 1); |
2595 | 2595 |
2596 RecordJSReturnSite(expr); | 2596 RecordJSReturnSite(expr); |
2597 // Restore context register. | 2597 // Restore context register. |
2598 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2598 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2599 context()->DropAndPlug(1, r2); | 2599 context()->DropAndPlug(1, r2); |
2600 } | 2600 } |
2601 | 2601 |
2602 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) { | 2602 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
2603 int arg_count = expr->arguments()->length(); | |
2604 // r6: copy of the first argument or undefined if it doesn't exist. | 2603 // r6: copy of the first argument or undefined if it doesn't exist. |
2605 if (arg_count > 0) { | 2604 if (arg_count > 0) { |
2606 __ LoadP(r6, MemOperand(sp, arg_count * kPointerSize), r0); | 2605 __ LoadP(r6, MemOperand(sp, arg_count * kPointerSize), r0); |
2607 } else { | 2606 } else { |
2608 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); | 2607 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); |
2609 } | 2608 } |
2610 | 2609 |
2611 // r5: the receiver of the enclosing function. | 2610 // r5: the receiver of the enclosing function. |
2612 __ LoadP(r5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2611 __ LoadP(r5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
2613 | 2612 |
2614 // r4: language mode. | 2613 // r4: language mode. |
2615 __ LoadSmiLiteral(r4, Smi::FromInt(language_mode())); | 2614 __ LoadSmiLiteral(r4, Smi::FromInt(language_mode())); |
2616 | 2615 |
2617 // r3: the source position of the eval call. | 2616 // r3: the start position of the scope the calls resides in. |
2618 __ LoadSmiLiteral(r3, Smi::FromInt(expr->position())); | 2617 __ LoadSmiLiteral(r3, Smi::FromInt(scope()->start_position())); |
2619 | 2618 |
2620 // Do the runtime call. | 2619 // Do the runtime call. |
2621 __ Push(r6, r5, r4, r3); | 2620 __ Push(r6, r5, r4, r3); |
2622 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); | 2621 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); |
2623 } | 2622 } |
2624 | 2623 |
2625 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 2624 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
2626 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 2625 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
2627 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 2626 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
2628 if (callee->var()->IsLookupSlot()) { | 2627 if (callee->var()->IsLookupSlot()) { |
(...skipping 28 matching lines...) Expand all Loading... |
2657 } | 2656 } |
2658 } else { | 2657 } else { |
2659 VisitForStackValue(callee); | 2658 VisitForStackValue(callee); |
2660 // refEnv.WithBaseObject() | 2659 // refEnv.WithBaseObject() |
2661 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); | 2660 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); |
2662 PushOperand(r4); // Reserved receiver slot. | 2661 PushOperand(r4); // Reserved receiver slot. |
2663 } | 2662 } |
2664 } | 2663 } |
2665 | 2664 |
2666 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { | 2665 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { |
2667 // In a call to eval, we first call Runtime_ResolvePossiblyDirectEval | 2666 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
2668 // to resolve the function we need to call. Then we call the resolved | 2667 // to resolve the function we need to call. Then we call the resolved |
2669 // function using the given arguments. | 2668 // function using the given arguments. |
2670 ZoneList<Expression*>* args = expr->arguments(); | 2669 ZoneList<Expression*>* args = expr->arguments(); |
2671 int arg_count = args->length(); | 2670 int arg_count = args->length(); |
2672 | 2671 |
2673 PushCalleeAndWithBaseObject(expr); | 2672 PushCalleeAndWithBaseObject(expr); |
2674 | 2673 |
2675 // Push the arguments. | 2674 // Push the arguments. |
2676 for (int i = 0; i < arg_count; i++) { | 2675 for (int i = 0; i < arg_count; i++) { |
2677 VisitForStackValue(args->at(i)); | 2676 VisitForStackValue(args->at(i)); |
2678 } | 2677 } |
2679 | 2678 |
2680 // Push a copy of the function (found below the arguments) and | 2679 // Push a copy of the function (found below the arguments) and |
2681 // resolve eval. | 2680 // resolve eval. |
2682 __ LoadP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2681 __ LoadP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2683 __ push(r3); | 2682 __ push(r3); |
2684 EmitResolvePossiblyDirectEval(expr); | 2683 EmitResolvePossiblyDirectEval(arg_count); |
2685 | 2684 |
2686 // Touch up the stack with the resolved function. | 2685 // Touch up the stack with the resolved function. |
2687 __ StoreP(r2, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2686 __ StoreP(r2, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2688 | 2687 |
2689 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2688 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
2690 | 2689 |
2691 // Record source position for debugger. | 2690 // Record source position for debugger. |
2692 SetCallPosition(expr); | 2691 SetCallPosition(expr); |
2693 __ LoadP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2692 __ LoadP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2694 __ mov(r2, Operand(arg_count)); | 2693 __ mov(r2, Operand(arg_count)); |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3972 DCHECK(kOSRBranchInstruction == br_instr); | 3971 DCHECK(kOSRBranchInstruction == br_instr); |
3973 | 3972 |
3974 DCHECK(interrupt_address == | 3973 DCHECK(interrupt_address == |
3975 isolate->builtins()->OnStackReplacement()->entry()); | 3974 isolate->builtins()->OnStackReplacement()->entry()); |
3976 return ON_STACK_REPLACEMENT; | 3975 return ON_STACK_REPLACEMENT; |
3977 } | 3976 } |
3978 | 3977 |
3979 } // namespace internal | 3978 } // namespace internal |
3980 } // namespace v8 | 3979 } // namespace v8 |
3981 #endif // V8_TARGET_ARCH_S390 | 3980 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |