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