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/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 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2657 // by the vector above. | 2657 // by the vector above. |
2658 CallIC(ic); | 2658 CallIC(ic); |
2659 OperandStackDepthDecrement(arg_count + 1); | 2659 OperandStackDepthDecrement(arg_count + 1); |
2660 | 2660 |
2661 RecordJSReturnSite(expr); | 2661 RecordJSReturnSite(expr); |
2662 // Restore context register. | 2662 // Restore context register. |
2663 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2663 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2664 context()->DropAndPlug(1, r3); | 2664 context()->DropAndPlug(1, r3); |
2665 } | 2665 } |
2666 | 2666 |
2667 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) { | 2667 |
2668 int arg_count = expr->arguments()->length(); | 2668 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
2669 // r7: copy of the first argument or undefined if it doesn't exist. | 2669 // r7: copy of the first argument or undefined if it doesn't exist. |
2670 if (arg_count > 0) { | 2670 if (arg_count > 0) { |
2671 __ LoadP(r7, MemOperand(sp, arg_count * kPointerSize), r0); | 2671 __ LoadP(r7, MemOperand(sp, arg_count * kPointerSize), r0); |
2672 } else { | 2672 } else { |
2673 __ LoadRoot(r7, Heap::kUndefinedValueRootIndex); | 2673 __ LoadRoot(r7, Heap::kUndefinedValueRootIndex); |
2674 } | 2674 } |
2675 | 2675 |
2676 // r6: the receiver of the enclosing function. | 2676 // r6: the receiver of the enclosing function. |
2677 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2677 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
2678 | 2678 |
2679 // r5: language mode. | 2679 // r5: language mode. |
2680 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode())); | 2680 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode())); |
2681 | 2681 |
2682 // r4: the source position of the eval call. | 2682 // r4: the start position of the scope the calls resides in. |
2683 __ LoadSmiLiteral(r4, Smi::FromInt(expr->position())); | 2683 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position())); |
2684 | 2684 |
2685 // Do the runtime call. | 2685 // Do the runtime call. |
2686 __ Push(r7, r6, r5, r4); | 2686 __ Push(r7, r6, r5, r4); |
2687 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); | 2687 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); |
2688 } | 2688 } |
2689 | 2689 |
2690 | 2690 |
2691 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 2691 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
2692 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 2692 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
2693 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 2693 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
(...skipping 30 matching lines...) Expand all Loading... |
2724 } else { | 2724 } else { |
2725 VisitForStackValue(callee); | 2725 VisitForStackValue(callee); |
2726 // refEnv.WithBaseObject() | 2726 // refEnv.WithBaseObject() |
2727 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); | 2727 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
2728 PushOperand(r5); // Reserved receiver slot. | 2728 PushOperand(r5); // Reserved receiver slot. |
2729 } | 2729 } |
2730 } | 2730 } |
2731 | 2731 |
2732 | 2732 |
2733 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { | 2733 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { |
2734 // In a call to eval, we first call Runtime_ResolvePossiblyDirectEval | 2734 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
2735 // to resolve the function we need to call. Then we call the resolved | 2735 // to resolve the function we need to call. Then we call the resolved |
2736 // function using the given arguments. | 2736 // function using the given arguments. |
2737 ZoneList<Expression*>* args = expr->arguments(); | 2737 ZoneList<Expression*>* args = expr->arguments(); |
2738 int arg_count = args->length(); | 2738 int arg_count = args->length(); |
2739 | 2739 |
2740 PushCalleeAndWithBaseObject(expr); | 2740 PushCalleeAndWithBaseObject(expr); |
2741 | 2741 |
2742 // Push the arguments. | 2742 // Push the arguments. |
2743 for (int i = 0; i < arg_count; i++) { | 2743 for (int i = 0; i < arg_count; i++) { |
2744 VisitForStackValue(args->at(i)); | 2744 VisitForStackValue(args->at(i)); |
2745 } | 2745 } |
2746 | 2746 |
2747 // Push a copy of the function (found below the arguments) and | 2747 // Push a copy of the function (found below the arguments) and |
2748 // resolve eval. | 2748 // resolve eval. |
2749 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2749 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2750 __ push(r4); | 2750 __ push(r4); |
2751 EmitResolvePossiblyDirectEval(expr); | 2751 EmitResolvePossiblyDirectEval(arg_count); |
2752 | 2752 |
2753 // Touch up the stack with the resolved function. | 2753 // Touch up the stack with the resolved function. |
2754 __ StoreP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2754 __ StoreP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2755 | 2755 |
2756 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2756 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
2757 | 2757 |
2758 // Record source position for debugger. | 2758 // Record source position for debugger. |
2759 SetCallPosition(expr); | 2759 SetCallPosition(expr); |
2760 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2760 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2761 __ mov(r3, Operand(arg_count)); | 2761 __ mov(r3, Operand(arg_count)); |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4072 | 4072 |
4073 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); | 4073 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); |
4074 | 4074 |
4075 DCHECK(interrupt_address == | 4075 DCHECK(interrupt_address == |
4076 isolate->builtins()->OnStackReplacement()->entry()); | 4076 isolate->builtins()->OnStackReplacement()->entry()); |
4077 return ON_STACK_REPLACEMENT; | 4077 return ON_STACK_REPLACEMENT; |
4078 } | 4078 } |
4079 } // namespace internal | 4079 } // namespace internal |
4080 } // namespace v8 | 4080 } // namespace v8 |
4081 #endif // V8_TARGET_ARCH_PPC | 4081 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |