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 2537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2548 // by the vector above. | 2548 // by the vector above. |
2549 CallIC(ic); | 2549 CallIC(ic); |
2550 OperandStackDepthDecrement(arg_count + 1); | 2550 OperandStackDepthDecrement(arg_count + 1); |
2551 | 2551 |
2552 RecordJSReturnSite(expr); | 2552 RecordJSReturnSite(expr); |
2553 // Restore context register. | 2553 // Restore context register. |
2554 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2554 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2555 context()->DropAndPlug(1, r3); | 2555 context()->DropAndPlug(1, r3); |
2556 } | 2556 } |
2557 | 2557 |
2558 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) { | 2558 |
2559 int arg_count = expr->arguments()->length(); | 2559 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
2560 // r7: copy of the first argument or undefined if it doesn't exist. | 2560 // r7: copy of the first argument or undefined if it doesn't exist. |
2561 if (arg_count > 0) { | 2561 if (arg_count > 0) { |
2562 __ LoadP(r7, MemOperand(sp, arg_count * kPointerSize), r0); | 2562 __ LoadP(r7, MemOperand(sp, arg_count * kPointerSize), r0); |
2563 } else { | 2563 } else { |
2564 __ LoadRoot(r7, Heap::kUndefinedValueRootIndex); | 2564 __ LoadRoot(r7, Heap::kUndefinedValueRootIndex); |
2565 } | 2565 } |
2566 | 2566 |
2567 // r6: the receiver of the enclosing function. | 2567 // r6: the receiver of the enclosing function. |
2568 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2568 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
2569 | 2569 |
2570 // r5: language mode. | 2570 // r5: language mode. |
2571 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode())); | 2571 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode())); |
2572 | 2572 |
2573 // r4: the source position of the eval call. | 2573 // r4: the start position of the scope the calls resides in. |
2574 __ LoadSmiLiteral(r4, Smi::FromInt(expr->position())); | 2574 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position())); |
2575 | 2575 |
2576 // Do the runtime call. | 2576 // Do the runtime call. |
2577 __ Push(r7, r6, r5, r4); | 2577 __ Push(r7, r6, r5, r4); |
2578 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); | 2578 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); |
2579 } | 2579 } |
2580 | 2580 |
2581 | 2581 |
2582 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 2582 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
2583 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 2583 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
2584 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 2584 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
(...skipping 30 matching lines...) Expand all Loading... |
2615 } else { | 2615 } else { |
2616 VisitForStackValue(callee); | 2616 VisitForStackValue(callee); |
2617 // refEnv.WithBaseObject() | 2617 // refEnv.WithBaseObject() |
2618 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); | 2618 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
2619 PushOperand(r5); // Reserved receiver slot. | 2619 PushOperand(r5); // Reserved receiver slot. |
2620 } | 2620 } |
2621 } | 2621 } |
2622 | 2622 |
2623 | 2623 |
2624 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { | 2624 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { |
2625 // In a call to eval, we first call Runtime_ResolvePossiblyDirectEval | 2625 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
2626 // to resolve the function we need to call. Then we call the resolved | 2626 // to resolve the function we need to call. Then we call the resolved |
2627 // function using the given arguments. | 2627 // function using the given arguments. |
2628 ZoneList<Expression*>* args = expr->arguments(); | 2628 ZoneList<Expression*>* args = expr->arguments(); |
2629 int arg_count = args->length(); | 2629 int arg_count = args->length(); |
2630 | 2630 |
2631 PushCalleeAndWithBaseObject(expr); | 2631 PushCalleeAndWithBaseObject(expr); |
2632 | 2632 |
2633 // Push the arguments. | 2633 // Push the arguments. |
2634 for (int i = 0; i < arg_count; i++) { | 2634 for (int i = 0; i < arg_count; i++) { |
2635 VisitForStackValue(args->at(i)); | 2635 VisitForStackValue(args->at(i)); |
2636 } | 2636 } |
2637 | 2637 |
2638 // Push a copy of the function (found below the arguments) and | 2638 // Push a copy of the function (found below the arguments) and |
2639 // resolve eval. | 2639 // resolve eval. |
2640 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2640 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2641 __ push(r4); | 2641 __ push(r4); |
2642 EmitResolvePossiblyDirectEval(expr); | 2642 EmitResolvePossiblyDirectEval(arg_count); |
2643 | 2643 |
2644 // Touch up the stack with the resolved function. | 2644 // Touch up the stack with the resolved function. |
2645 __ StoreP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2645 __ StoreP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2646 | 2646 |
2647 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2647 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
2648 | 2648 |
2649 // Record source position for debugger. | 2649 // Record source position for debugger. |
2650 SetCallPosition(expr); | 2650 SetCallPosition(expr); |
2651 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2651 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2652 __ mov(r3, Operand(arg_count)); | 2652 __ mov(r3, Operand(arg_count)); |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3963 | 3963 |
3964 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); | 3964 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); |
3965 | 3965 |
3966 DCHECK(interrupt_address == | 3966 DCHECK(interrupt_address == |
3967 isolate->builtins()->OnStackReplacement()->entry()); | 3967 isolate->builtins()->OnStackReplacement()->entry()); |
3968 return ON_STACK_REPLACEMENT; | 3968 return ON_STACK_REPLACEMENT; |
3969 } | 3969 } |
3970 } // namespace internal | 3970 } // namespace internal |
3971 } // namespace v8 | 3971 } // namespace v8 |
3972 #endif // V8_TARGET_ARCH_PPC | 3972 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |