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 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2491 // by the vector above. | 2491 // by the vector above. |
2492 CallIC(ic); | 2492 CallIC(ic); |
2493 OperandStackDepthDecrement(arg_count + 1); | 2493 OperandStackDepthDecrement(arg_count + 1); |
2494 | 2494 |
2495 RecordJSReturnSite(expr); | 2495 RecordJSReturnSite(expr); |
2496 // Restore context register. | 2496 // Restore context register. |
2497 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2497 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2498 context()->DropAndPlug(1, r2); | 2498 context()->DropAndPlug(1, r2); |
2499 } | 2499 } |
2500 | 2500 |
2501 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2501 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) { |
| 2502 int arg_count = expr->arguments()->length(); |
2502 // r6: copy of the first argument or undefined if it doesn't exist. | 2503 // r6: copy of the first argument or undefined if it doesn't exist. |
2503 if (arg_count > 0) { | 2504 if (arg_count > 0) { |
2504 __ LoadP(r6, MemOperand(sp, arg_count * kPointerSize), r0); | 2505 __ LoadP(r6, MemOperand(sp, arg_count * kPointerSize), r0); |
2505 } else { | 2506 } else { |
2506 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); | 2507 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); |
2507 } | 2508 } |
2508 | 2509 |
2509 // r5: the receiver of the enclosing function. | 2510 // r5: the receiver of the enclosing function. |
2510 __ LoadP(r5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2511 __ LoadP(r5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
2511 | 2512 |
2512 // r4: language mode. | 2513 // r4: language mode. |
2513 __ LoadSmiLiteral(r4, Smi::FromInt(language_mode())); | 2514 __ LoadSmiLiteral(r4, Smi::FromInt(language_mode())); |
2514 | 2515 |
2515 // r3: the start position of the scope the calls resides in. | 2516 // r3: the start position of the scope the calls resides in. |
2516 __ LoadSmiLiteral(r3, Smi::FromInt(scope()->start_position())); | 2517 __ LoadSmiLiteral(r3, Smi::FromInt(scope()->start_position())); |
2517 | 2518 |
| 2519 // r2: the source position of the eval call. |
| 2520 __ LoadSmiLiteral(r2, Smi::FromInt(expr->position())); |
| 2521 |
2518 // Do the runtime call. | 2522 // Do the runtime call. |
2519 __ Push(r6, r5, r4, r3); | 2523 __ Push(r6, r5, r4, r3, r2); |
2520 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); | 2524 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); |
2521 } | 2525 } |
2522 | 2526 |
2523 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 2527 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
2524 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 2528 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
2525 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 2529 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
2526 if (callee->var()->IsLookupSlot()) { | 2530 if (callee->var()->IsLookupSlot()) { |
2527 Label slow, done; | 2531 Label slow, done; |
2528 SetExpressionPosition(callee); | 2532 SetExpressionPosition(callee); |
2529 // Generate code for loading from variables potentially shadowed by | 2533 // Generate code for loading from variables potentially shadowed by |
(...skipping 25 matching lines...) Expand all Loading... |
2555 } | 2559 } |
2556 } else { | 2560 } else { |
2557 VisitForStackValue(callee); | 2561 VisitForStackValue(callee); |
2558 // refEnv.WithBaseObject() | 2562 // refEnv.WithBaseObject() |
2559 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); | 2563 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); |
2560 PushOperand(r4); // Reserved receiver slot. | 2564 PushOperand(r4); // Reserved receiver slot. |
2561 } | 2565 } |
2562 } | 2566 } |
2563 | 2567 |
2564 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { | 2568 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { |
2565 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval | 2569 // In a call to eval, we first call |
2566 // to resolve the function we need to call. Then we call the resolved | 2570 // Runtime_ResolvePossiblyDirectEval to resolve the function we need |
2567 // function using the given arguments. | 2571 // to call. Then we call the resolved function using the given arguments. |
2568 ZoneList<Expression*>* args = expr->arguments(); | 2572 ZoneList<Expression*>* args = expr->arguments(); |
2569 int arg_count = args->length(); | 2573 int arg_count = args->length(); |
2570 | 2574 |
2571 PushCalleeAndWithBaseObject(expr); | 2575 PushCalleeAndWithBaseObject(expr); |
2572 | 2576 |
2573 // Push the arguments. | 2577 // Push the arguments. |
2574 for (int i = 0; i < arg_count; i++) { | 2578 for (int i = 0; i < arg_count; i++) { |
2575 VisitForStackValue(args->at(i)); | 2579 VisitForStackValue(args->at(i)); |
2576 } | 2580 } |
2577 | 2581 |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3870 DCHECK(kOSRBranchInstruction == br_instr); | 3874 DCHECK(kOSRBranchInstruction == br_instr); |
3871 | 3875 |
3872 DCHECK(interrupt_address == | 3876 DCHECK(interrupt_address == |
3873 isolate->builtins()->OnStackReplacement()->entry()); | 3877 isolate->builtins()->OnStackReplacement()->entry()); |
3874 return ON_STACK_REPLACEMENT; | 3878 return ON_STACK_REPLACEMENT; |
3875 } | 3879 } |
3876 | 3880 |
3877 } // namespace internal | 3881 } // namespace internal |
3878 } // namespace v8 | 3882 } // namespace v8 |
3879 #endif // V8_TARGET_ARCH_S390 | 3883 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |