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