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