OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 2479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2490 // by the vector above. | 2490 // by the vector above. |
2491 CallIC(ic); | 2491 CallIC(ic); |
2492 OperandStackDepthDecrement(arg_count + 1); | 2492 OperandStackDepthDecrement(arg_count + 1); |
2493 | 2493 |
2494 RecordJSReturnSite(expr); | 2494 RecordJSReturnSite(expr); |
2495 // Restore context register. | 2495 // Restore context register. |
2496 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2496 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2497 context()->DropAndPlug(1, r2); | 2497 context()->DropAndPlug(1, r2); |
2498 } | 2498 } |
2499 | 2499 |
2500 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) { | 2500 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
2501 int arg_count = expr->arguments()->length(); | |
2502 // r6: copy of the first argument or undefined if it doesn't exist. | 2501 // r6: copy of the first argument or undefined if it doesn't exist. |
2503 if (arg_count > 0) { | 2502 if (arg_count > 0) { |
2504 __ LoadP(r6, MemOperand(sp, arg_count * kPointerSize), r0); | 2503 __ LoadP(r6, MemOperand(sp, arg_count * kPointerSize), r0); |
2505 } else { | 2504 } else { |
2506 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); | 2505 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); |
2507 } | 2506 } |
2508 | 2507 |
2509 // r5: the receiver of the enclosing function. | 2508 // r5: the receiver of the enclosing function. |
2510 __ LoadP(r5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2509 __ LoadP(r5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
2511 | 2510 |
2512 // r4: language mode. | 2511 // r4: language mode. |
2513 __ LoadSmiLiteral(r4, Smi::FromInt(language_mode())); | 2512 __ LoadSmiLiteral(r4, Smi::FromInt(language_mode())); |
2514 | 2513 |
2515 // r3: the source position of the eval call. | 2514 // r3: the start position of the scope the calls resides in. |
2516 __ LoadSmiLiteral(r3, Smi::FromInt(expr->position())); | 2515 __ LoadSmiLiteral(r3, Smi::FromInt(scope()->start_position())); |
2517 | 2516 |
2518 // Do the runtime call. | 2517 // Do the runtime call. |
2519 __ Push(r6, r5, r4, r3); | 2518 __ Push(r6, r5, r4, r3); |
2520 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); | 2519 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); |
2521 } | 2520 } |
2522 | 2521 |
2523 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 2522 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
2524 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 2523 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
2525 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 2524 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
2526 if (callee->var()->IsLookupSlot()) { | 2525 if (callee->var()->IsLookupSlot()) { |
(...skipping 28 matching lines...) Expand all Loading... |
2555 } | 2554 } |
2556 } else { | 2555 } else { |
2557 VisitForStackValue(callee); | 2556 VisitForStackValue(callee); |
2558 // refEnv.WithBaseObject() | 2557 // refEnv.WithBaseObject() |
2559 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); | 2558 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); |
2560 PushOperand(r4); // Reserved receiver slot. | 2559 PushOperand(r4); // Reserved receiver slot. |
2561 } | 2560 } |
2562 } | 2561 } |
2563 | 2562 |
2564 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { | 2563 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { |
2565 // In a call to eval, we first call Runtime_ResolvePossiblyDirectEval | 2564 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
2566 // to resolve the function we need to call. Then we call the resolved | 2565 // to resolve the function we need to call. Then we call the resolved |
2567 // function using the given arguments. | 2566 // function using the given arguments. |
2568 ZoneList<Expression*>* args = expr->arguments(); | 2567 ZoneList<Expression*>* args = expr->arguments(); |
2569 int arg_count = args->length(); | 2568 int arg_count = args->length(); |
2570 | 2569 |
2571 PushCalleeAndWithBaseObject(expr); | 2570 PushCalleeAndWithBaseObject(expr); |
2572 | 2571 |
2573 // Push the arguments. | 2572 // Push the arguments. |
2574 for (int i = 0; i < arg_count; i++) { | 2573 for (int i = 0; i < arg_count; i++) { |
2575 VisitForStackValue(args->at(i)); | 2574 VisitForStackValue(args->at(i)); |
2576 } | 2575 } |
2577 | 2576 |
2578 // Push a copy of the function (found below the arguments) and | 2577 // Push a copy of the function (found below the arguments) and |
2579 // resolve eval. | 2578 // resolve eval. |
2580 __ LoadP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2579 __ LoadP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2581 __ push(r3); | 2580 __ push(r3); |
2582 EmitResolvePossiblyDirectEval(expr); | 2581 EmitResolvePossiblyDirectEval(arg_count); |
2583 | 2582 |
2584 // Touch up the stack with the resolved function. | 2583 // Touch up the stack with the resolved function. |
2585 __ StoreP(r2, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2584 __ StoreP(r2, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2586 | 2585 |
2587 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2586 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
2588 | 2587 |
2589 // Record source position for debugger. | 2588 // Record source position for debugger. |
2590 SetCallPosition(expr); | 2589 SetCallPosition(expr); |
2591 __ LoadP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 2590 __ LoadP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
2592 __ mov(r2, Operand(arg_count)); | 2591 __ mov(r2, Operand(arg_count)); |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3870 DCHECK(kOSRBranchInstruction == br_instr); | 3869 DCHECK(kOSRBranchInstruction == br_instr); |
3871 | 3870 |
3872 DCHECK(interrupt_address == | 3871 DCHECK(interrupt_address == |
3873 isolate->builtins()->OnStackReplacement()->entry()); | 3872 isolate->builtins()->OnStackReplacement()->entry()); |
3874 return ON_STACK_REPLACEMENT; | 3873 return ON_STACK_REPLACEMENT; |
3875 } | 3874 } |
3876 | 3875 |
3877 } // namespace internal | 3876 } // namespace internal |
3878 } // namespace v8 | 3877 } // namespace v8 |
3879 #endif // V8_TARGET_ARCH_S390 | 3878 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |