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