| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 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 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2455 // by the vector above. | 2455 // by the vector above. |
| 2456 CallIC(ic); | 2456 CallIC(ic); |
| 2457 OperandStackDepthDecrement(arg_count + 1); | 2457 OperandStackDepthDecrement(arg_count + 1); |
| 2458 | 2458 |
| 2459 RecordJSReturnSite(expr); | 2459 RecordJSReturnSite(expr); |
| 2460 // Restore context register. | 2460 // Restore context register. |
| 2461 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2461 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2462 context()->DropAndPlug(1, x0); | 2462 context()->DropAndPlug(1, x0); |
| 2463 } | 2463 } |
| 2464 | 2464 |
| 2465 | 2465 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) { |
| 2466 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2466 int arg_count = expr->arguments()->length(); |
| 2467 ASM_LOCATION("FullCodeGenerator::EmitResolvePossiblyDirectEval"); | 2467 ASM_LOCATION("FullCodeGenerator::EmitResolvePossiblyDirectEval"); |
| 2468 // Prepare to push a copy of the first argument or undefined if it doesn't | 2468 // Prepare to push a copy of the first argument or undefined if it doesn't |
| 2469 // exist. | 2469 // exist. |
| 2470 if (arg_count > 0) { | 2470 if (arg_count > 0) { |
| 2471 __ Peek(x9, arg_count * kXRegSize); | 2471 __ Peek(x9, arg_count * kXRegSize); |
| 2472 } else { | 2472 } else { |
| 2473 __ LoadRoot(x9, Heap::kUndefinedValueRootIndex); | 2473 __ LoadRoot(x9, Heap::kUndefinedValueRootIndex); |
| 2474 } | 2474 } |
| 2475 | 2475 |
| 2476 __ Ldr(x10, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2476 __ Ldr(x10, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 2477 | 2477 |
| 2478 // Prepare to push the language mode. | 2478 // Prepare to push the language mode. |
| 2479 __ Mov(x11, Smi::FromInt(language_mode())); | 2479 __ Mov(x11, Smi::FromInt(language_mode())); |
| 2480 // Prepare to push the start position of the scope the calls resides in. | 2480 // Prepare to push the start position of the scope the calls resides in. |
| 2481 __ Mov(x12, Smi::FromInt(scope()->start_position())); | 2481 __ Mov(x12, Smi::FromInt(scope()->start_position())); |
| 2482 // Prepare to push the source position of the eval call. |
| 2483 __ Mov(x13, Smi::FromInt(expr->position())); |
| 2482 | 2484 |
| 2483 // Push. | 2485 // Push. |
| 2484 __ Push(x9, x10, x11, x12); | 2486 __ Push(x9, x10, x11, x12, x13); |
| 2485 | 2487 |
| 2486 // Do the runtime call. | 2488 // Do the runtime call. |
| 2487 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); | 2489 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); |
| 2488 } | 2490 } |
| 2489 | 2491 |
| 2490 | 2492 |
| 2491 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 2493 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
| 2492 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 2494 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
| 2493 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 2495 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
| 2494 if (callee->var()->IsLookupSlot()) { | 2496 if (callee->var()->IsLookupSlot()) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2524 VisitForStackValue(callee); | 2526 VisitForStackValue(callee); |
| 2525 // refEnv.WithBaseObject() | 2527 // refEnv.WithBaseObject() |
| 2526 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); | 2528 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); |
| 2527 PushOperand(x10); // Reserved receiver slot. | 2529 PushOperand(x10); // Reserved receiver slot. |
| 2528 } | 2530 } |
| 2529 } | 2531 } |
| 2530 | 2532 |
| 2531 | 2533 |
| 2532 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { | 2534 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { |
| 2533 ASM_LOCATION("FullCodeGenerator::EmitPossiblyEvalCall"); | 2535 ASM_LOCATION("FullCodeGenerator::EmitPossiblyEvalCall"); |
| 2534 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval | 2536 // In a call to eval, we first call Runtime_ResolvePossiblyDirectEval |
| 2535 // to resolve the function we need to call. Then we call the resolved | 2537 // to resolve the function we need to call. Then we call the resolved |
| 2536 // function using the given arguments. | 2538 // function using the given arguments. |
| 2537 ZoneList<Expression*>* args = expr->arguments(); | 2539 ZoneList<Expression*>* args = expr->arguments(); |
| 2538 int arg_count = args->length(); | 2540 int arg_count = args->length(); |
| 2539 | 2541 |
| 2540 PushCalleeAndWithBaseObject(expr); | 2542 PushCalleeAndWithBaseObject(expr); |
| 2541 | 2543 |
| 2542 // Push the arguments. | 2544 // Push the arguments. |
| 2543 for (int i = 0; i < arg_count; i++) { | 2545 for (int i = 0; i < arg_count; i++) { |
| 2544 VisitForStackValue(args->at(i)); | 2546 VisitForStackValue(args->at(i)); |
| 2545 } | 2547 } |
| 2546 | 2548 |
| 2547 // Push a copy of the function (found below the arguments) and | 2549 // Push a copy of the function (found below the arguments) and |
| 2548 // resolve eval. | 2550 // resolve eval. |
| 2549 __ Peek(x10, (arg_count + 1) * kPointerSize); | 2551 __ Peek(x10, (arg_count + 1) * kPointerSize); |
| 2550 __ Push(x10); | 2552 __ Push(x10); |
| 2551 EmitResolvePossiblyDirectEval(arg_count); | 2553 EmitResolvePossiblyDirectEval(expr); |
| 2552 | 2554 |
| 2553 // Touch up the stack with the resolved function. | 2555 // Touch up the stack with the resolved function. |
| 2554 __ Poke(x0, (arg_count + 1) * kPointerSize); | 2556 __ Poke(x0, (arg_count + 1) * kPointerSize); |
| 2555 | 2557 |
| 2556 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2558 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
| 2557 | 2559 |
| 2558 // Record source position for debugger. | 2560 // Record source position for debugger. |
| 2559 SetCallPosition(expr); | 2561 SetCallPosition(expr); |
| 2560 | 2562 |
| 2561 // Call the evaluated function. | 2563 // Call the evaluated function. |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4055 } | 4057 } |
| 4056 | 4058 |
| 4057 return INTERRUPT; | 4059 return INTERRUPT; |
| 4058 } | 4060 } |
| 4059 | 4061 |
| 4060 | 4062 |
| 4061 } // namespace internal | 4063 } // namespace internal |
| 4062 } // namespace v8 | 4064 } // namespace v8 |
| 4063 | 4065 |
| 4064 #endif // V8_TARGET_ARCH_ARM64 | 4066 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |