| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2792 ASM_LOCATION("FullCodeGenerator::EmitResolvePossiblyDirectEval"); | 2792 ASM_LOCATION("FullCodeGenerator::EmitResolvePossiblyDirectEval"); |
| 2793 // Prepare to push a copy of the first argument or undefined if it doesn't | 2793 // Prepare to push a copy of the first argument or undefined if it doesn't |
| 2794 // exist. | 2794 // exist. |
| 2795 if (arg_count > 0) { | 2795 if (arg_count > 0) { |
| 2796 __ Peek(x9, arg_count * kXRegSize); | 2796 __ Peek(x9, arg_count * kXRegSize); |
| 2797 } else { | 2797 } else { |
| 2798 __ LoadRoot(x9, Heap::kUndefinedValueRootIndex); | 2798 __ LoadRoot(x9, Heap::kUndefinedValueRootIndex); |
| 2799 } | 2799 } |
| 2800 | 2800 |
| 2801 __ Ldr(x10, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2801 __ Ldr(x10, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 2802 // Prepare to push the receiver of the enclosing function. |
| 2803 Variable* this_var = scope()->LookupThis(); |
| 2804 DCHECK_NOT_NULL(this_var); |
| 2805 __ Ldr(x11, VarOperand(this_var, x11)); |
| 2802 | 2806 |
| 2803 // Prepare to push the language mode. | 2807 // Prepare to push the language mode. |
| 2804 __ Mov(x11, Smi::FromInt(language_mode())); | 2808 __ Mov(x12, Smi::FromInt(language_mode())); |
| 2805 // Prepare to push the start position of the scope the calls resides in. | 2809 // Prepare to push the start position of the scope the calls resides in. |
| 2806 __ Mov(x12, Smi::FromInt(scope()->start_position())); | 2810 __ Mov(x13, Smi::FromInt(scope()->start_position())); |
| 2807 | 2811 |
| 2808 // Push. | 2812 // Push. |
| 2809 __ Push(x9, x10, x11, x12); | 2813 __ Push(x9, x10, x11, x12, x13); |
| 2810 | 2814 |
| 2811 // Do the runtime call. | 2815 // Do the runtime call. |
| 2812 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); | 2816 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); |
| 2813 } | 2817 } |
| 2814 | 2818 |
| 2815 | 2819 |
| 2816 void FullCodeGenerator::EmitInitializeThisAfterSuper( | 2820 void FullCodeGenerator::EmitInitializeThisAfterSuper( |
| 2817 SuperCallReference* super_ref, FeedbackVectorICSlot slot) { | 2821 SuperCallReference* super_ref, FeedbackVectorICSlot slot) { |
| 2818 Variable* this_var = super_ref->this_var()->var(); | 2822 Variable* this_var = super_ref->this_var()->var(); |
| 2819 GetVar(x1, this_var); | 2823 GetVar(x1, this_var); |
| 2820 Label uninitialized_this; | 2824 Label uninitialized_this; |
| 2821 __ JumpIfRoot(x1, Heap::kTheHoleValueRootIndex, &uninitialized_this); | 2825 __ JumpIfRoot(x1, Heap::kTheHoleValueRootIndex, &uninitialized_this); |
| 2822 __ Mov(x0, Operand(this_var->name())); | 2826 __ Mov(x0, Operand(this_var->name())); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2834 // through this function. Avoid early returns. | 2838 // through this function. Avoid early returns. |
| 2835 expr->return_is_recorded_ = false; | 2839 expr->return_is_recorded_ = false; |
| 2836 #endif | 2840 #endif |
| 2837 | 2841 |
| 2838 Comment cmnt(masm_, "[ Call"); | 2842 Comment cmnt(masm_, "[ Call"); |
| 2839 Expression* callee = expr->expression(); | 2843 Expression* callee = expr->expression(); |
| 2840 Call::CallType call_type = expr->GetCallType(isolate()); | 2844 Call::CallType call_type = expr->GetCallType(isolate()); |
| 2841 | 2845 |
| 2842 if (call_type == Call::POSSIBLY_EVAL_CALL) { | 2846 if (call_type == Call::POSSIBLY_EVAL_CALL) { |
| 2843 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval | 2847 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
| 2844 // to resolve the function we need to call. Then we call the resolved | 2848 // to resolve the function we need to call and the receiver of the |
| 2845 // function using the given arguments. | 2849 // call. Then we call the resolved function using the given |
| 2850 // arguments. |
| 2846 ZoneList<Expression*>* args = expr->arguments(); | 2851 ZoneList<Expression*>* args = expr->arguments(); |
| 2847 int arg_count = args->length(); | 2852 int arg_count = args->length(); |
| 2848 | 2853 |
| 2849 { | 2854 { |
| 2850 PreservePositionScope pos_scope(masm()->positions_recorder()); | 2855 PreservePositionScope pos_scope(masm()->positions_recorder()); |
| 2851 VisitForStackValue(callee); | 2856 VisitForStackValue(callee); |
| 2852 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); | 2857 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); |
| 2853 __ Push(x10); // Reserved receiver slot. | 2858 __ Push(x10); // Reserved receiver slot. |
| 2854 | 2859 |
| 2855 // Push the arguments. | 2860 // Push the arguments. |
| 2856 for (int i = 0; i < arg_count; i++) { | 2861 for (int i = 0; i < arg_count; i++) { |
| 2857 VisitForStackValue(args->at(i)); | 2862 VisitForStackValue(args->at(i)); |
| 2858 } | 2863 } |
| 2859 | 2864 |
| 2860 // Push a copy of the function (found below the arguments) and | 2865 // Push a copy of the function (found below the arguments) and |
| 2861 // resolve eval. | 2866 // resolve eval. |
| 2862 __ Peek(x10, (arg_count + 1) * kPointerSize); | 2867 __ Peek(x10, (arg_count + 1) * kPointerSize); |
| 2863 __ Push(x10); | 2868 __ Push(x10); |
| 2864 EmitResolvePossiblyDirectEval(arg_count); | 2869 EmitResolvePossiblyDirectEval(arg_count); |
| 2865 | 2870 |
| 2866 // Touch up the stack with the resolved function. | 2871 // The runtime call returns a pair of values in x0 (function) and |
| 2867 __ Poke(x0, (arg_count + 1) * kPointerSize); | 2872 // x1 (receiver). Touch up the stack with the right values. |
| 2873 __ PokePair(x1, x0, arg_count * kPointerSize); |
| 2868 | 2874 |
| 2869 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS); | 2875 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS); |
| 2870 } | 2876 } |
| 2871 | 2877 |
| 2872 // Record source position for debugger. | 2878 // Record source position for debugger. |
| 2873 SetSourcePosition(expr->position()); | 2879 SetSourcePosition(expr->position()); |
| 2874 | 2880 |
| 2875 // Call the evaluated function. | 2881 // Call the evaluated function. |
| 2876 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 2882 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
| 2877 __ Peek(x1, (arg_count + 1) * kXRegSize); | 2883 __ Peek(x1, (arg_count + 1) * kXRegSize); |
| (...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4451 | 4457 |
| 4452 if (property != NULL) { | 4458 if (property != NULL) { |
| 4453 VisitForStackValue(property->obj()); | 4459 VisitForStackValue(property->obj()); |
| 4454 VisitForStackValue(property->key()); | 4460 VisitForStackValue(property->key()); |
| 4455 __ Mov(x10, Smi::FromInt(language_mode())); | 4461 __ Mov(x10, Smi::FromInt(language_mode())); |
| 4456 __ Push(x10); | 4462 __ Push(x10); |
| 4457 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); | 4463 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); |
| 4458 context()->Plug(x0); | 4464 context()->Plug(x0); |
| 4459 } else if (proxy != NULL) { | 4465 } else if (proxy != NULL) { |
| 4460 Variable* var = proxy->var(); | 4466 Variable* var = proxy->var(); |
| 4461 // Delete of an unqualified identifier is disallowed in strict mode but | 4467 // Delete of an unqualified identifier is disallowed in strict mode |
| 4462 // "delete this" is allowed. | 4468 // but "delete this" is allowed. |
| 4463 bool is_this = var->HasThisName(isolate()); | 4469 DCHECK(is_sloppy(language_mode()) || var->is_this()); |
| 4464 DCHECK(is_sloppy(language_mode()) || is_this); | |
| 4465 if (var->IsUnallocated()) { | 4470 if (var->IsUnallocated()) { |
| 4466 __ Ldr(x12, GlobalObjectMemOperand()); | 4471 __ Ldr(x12, GlobalObjectMemOperand()); |
| 4467 __ Mov(x11, Operand(var->name())); | 4472 __ Mov(x11, Operand(var->name())); |
| 4468 __ Mov(x10, Smi::FromInt(SLOPPY)); | 4473 __ Mov(x10, Smi::FromInt(SLOPPY)); |
| 4469 __ Push(x12, x11, x10); | 4474 __ Push(x12, x11, x10); |
| 4470 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); | 4475 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); |
| 4471 context()->Plug(x0); | 4476 context()->Plug(x0); |
| 4472 } else if (var->IsStackAllocated() || var->IsContextSlot()) { | 4477 } else if (var->IsStackAllocated() || var->IsContextSlot()) { |
| 4473 // Result of deleting non-global, non-dynamic variables is false. | 4478 // Result of deleting non-global, non-dynamic variables is false. |
| 4474 // The subexpression does not have side effects. | 4479 // The subexpression does not have side effects. |
| 4475 context()->Plug(is_this); | 4480 context()->Plug(var->is_this()); |
| 4476 } else { | 4481 } else { |
| 4477 // Non-global variable. Call the runtime to try to delete from the | 4482 // Non-global variable. Call the runtime to try to delete from the |
| 4478 // context where the variable was introduced. | 4483 // context where the variable was introduced. |
| 4479 __ Mov(x2, Operand(var->name())); | 4484 __ Mov(x2, Operand(var->name())); |
| 4480 __ Push(context_register(), x2); | 4485 __ Push(context_register(), x2); |
| 4481 __ CallRuntime(Runtime::kDeleteLookupSlot, 2); | 4486 __ CallRuntime(Runtime::kDeleteLookupSlot, 2); |
| 4482 context()->Plug(x0); | 4487 context()->Plug(x0); |
| 4483 } | 4488 } |
| 4484 } else { | 4489 } else { |
| 4485 // Result of deleting non-property, non-variable reference is true. | 4490 // Result of deleting non-property, non-variable reference is true. |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5563 } | 5568 } |
| 5564 | 5569 |
| 5565 return INTERRUPT; | 5570 return INTERRUPT; |
| 5566 } | 5571 } |
| 5567 | 5572 |
| 5568 | 5573 |
| 5569 } // namespace internal | 5574 } // namespace internal |
| 5570 } // namespace v8 | 5575 } // namespace v8 |
| 5571 | 5576 |
| 5572 #endif // V8_TARGET_ARCH_ARM64 | 5577 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |