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