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 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 // by the vector above. | 2555 // by the vector above. |
2556 CallIC(ic); | 2556 CallIC(ic); |
2557 OperandStackDepthDecrement(arg_count + 1); | 2557 OperandStackDepthDecrement(arg_count + 1); |
2558 | 2558 |
2559 RecordJSReturnSite(expr); | 2559 RecordJSReturnSite(expr); |
2560 // Restore context register. | 2560 // Restore context register. |
2561 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2561 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2562 context()->DropAndPlug(1, r0); | 2562 context()->DropAndPlug(1, r0); |
2563 } | 2563 } |
2564 | 2564 |
2565 | 2565 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) { |
2566 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2566 int arg_count = expr->arguments()->length(); |
2567 // r4: copy of the first argument or undefined if it doesn't exist. | 2567 // r4: copy of the first argument or undefined if it doesn't exist. |
2568 if (arg_count > 0) { | 2568 if (arg_count > 0) { |
2569 __ ldr(r4, MemOperand(sp, arg_count * kPointerSize)); | 2569 __ ldr(r4, MemOperand(sp, arg_count * kPointerSize)); |
2570 } else { | 2570 } else { |
2571 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); | 2571 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); |
2572 } | 2572 } |
2573 | 2573 |
2574 // r3: the receiver of the enclosing function. | 2574 // r3: the receiver of the enclosing function. |
2575 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2575 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
2576 | 2576 |
2577 // r2: language mode. | 2577 // r2: language mode. |
2578 __ mov(r2, Operand(Smi::FromInt(language_mode()))); | 2578 __ mov(r2, Operand(Smi::FromInt(language_mode()))); |
2579 | 2579 |
2580 // r1: the start position of the scope the calls resides in. | 2580 // r1: the start position of the scope the calls resides in. |
2581 __ mov(r1, Operand(Smi::FromInt(scope()->start_position()))); | 2581 __ mov(r1, Operand(Smi::FromInt(scope()->start_position()))); |
2582 | 2582 |
| 2583 // r0: the source position of the eval call. |
| 2584 __ mov(r0, Operand(Smi::FromInt(expr->position()))); |
| 2585 |
2583 // Do the runtime call. | 2586 // Do the runtime call. |
2584 __ Push(r4, r3, r2, r1); | 2587 __ Push(r4, r3, r2, r1, r0); |
2585 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); | 2588 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); |
2586 } | 2589 } |
2587 | 2590 |
2588 | 2591 |
2589 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 2592 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
2590 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 2593 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
2591 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 2594 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
2592 if (callee->var()->IsLookupSlot()) { | 2595 if (callee->var()->IsLookupSlot()) { |
2593 Label slow, done; | 2596 Label slow, done; |
2594 SetExpressionPosition(callee); | 2597 SetExpressionPosition(callee); |
(...skipping 28 matching lines...) Expand all Loading... |
2623 VisitForStackValue(callee); | 2626 VisitForStackValue(callee); |
2624 // refEnv.WithBaseObject() | 2627 // refEnv.WithBaseObject() |
2625 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 2628 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
2626 PushOperand(r2); // Reserved receiver slot. | 2629 PushOperand(r2); // Reserved receiver slot. |
2627 } | 2630 } |
2628 } | 2631 } |
2629 | 2632 |
2630 | 2633 |
2631 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { | 2634 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { |
2632 // In a call to eval, we first call | 2635 // In a call to eval, we first call |
2633 // RuntimeHidden_asResolvePossiblyDirectEval to resolve the function we need | 2636 // Runtime_ResolvePossiblyDirectEval to resolve the function we need |
2634 // to call. Then we call the resolved function using the given arguments. | 2637 // to call. Then we call the resolved function using the given arguments. |
2635 ZoneList<Expression*>* args = expr->arguments(); | 2638 ZoneList<Expression*>* args = expr->arguments(); |
2636 int arg_count = args->length(); | 2639 int arg_count = args->length(); |
2637 | 2640 |
2638 PushCalleeAndWithBaseObject(expr); | 2641 PushCalleeAndWithBaseObject(expr); |
2639 | 2642 |
2640 // Push the arguments. | 2643 // Push the arguments. |
2641 for (int i = 0; i < arg_count; i++) { | 2644 for (int i = 0; i < arg_count; i++) { |
2642 VisitForStackValue(args->at(i)); | 2645 VisitForStackValue(args->at(i)); |
2643 } | 2646 } |
2644 | 2647 |
2645 // Push a copy of the function (found below the arguments) and | 2648 // Push a copy of the function (found below the arguments) and |
2646 // resolve eval. | 2649 // resolve eval. |
2647 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2650 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2648 __ push(r1); | 2651 __ push(r1); |
2649 EmitResolvePossiblyDirectEval(arg_count); | 2652 EmitResolvePossiblyDirectEval(expr); |
2650 | 2653 |
2651 // Touch up the stack with the resolved function. | 2654 // Touch up the stack with the resolved function. |
2652 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2655 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2653 | 2656 |
2654 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2657 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
2655 | 2658 |
2656 // Record source position for debugger. | 2659 // Record source position for debugger. |
2657 SetCallPosition(expr); | 2660 SetCallPosition(expr); |
2658 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2661 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2659 __ mov(r0, Operand(arg_count)); | 2662 __ mov(r0, Operand(arg_count)); |
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4055 DCHECK(interrupt_address == | 4058 DCHECK(interrupt_address == |
4056 isolate->builtins()->OnStackReplacement()->entry()); | 4059 isolate->builtins()->OnStackReplacement()->entry()); |
4057 return ON_STACK_REPLACEMENT; | 4060 return ON_STACK_REPLACEMENT; |
4058 } | 4061 } |
4059 | 4062 |
4060 | 4063 |
4061 } // namespace internal | 4064 } // namespace internal |
4062 } // namespace v8 | 4065 } // namespace v8 |
4063 | 4066 |
4064 #endif // V8_TARGET_ARCH_ARM | 4067 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |