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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 // No write barrier since the_hole_value is in old space. | 858 // No write barrier since the_hole_value is in old space. |
859 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 859 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
860 } | 860 } |
861 break; | 861 break; |
862 | 862 |
863 case VariableLocation::LOOKUP: { | 863 case VariableLocation::LOOKUP: { |
864 Comment cmnt(masm_, "[ VariableDeclaration"); | 864 Comment cmnt(masm_, "[ VariableDeclaration"); |
865 __ Mov(x2, Operand(variable->name())); | 865 __ Mov(x2, Operand(variable->name())); |
866 // Declaration nodes are always introduced in one of four modes. | 866 // Declaration nodes are always introduced in one of four modes. |
867 DCHECK(IsDeclaredVariableMode(mode)); | 867 DCHECK(IsDeclaredVariableMode(mode)); |
868 PropertyAttributes attr = IsImmutableVariableMode(mode) ? READ_ONLY | |
869 : NONE; | |
870 __ Mov(x1, Smi::FromInt(attr)); | |
871 // Push initial value, if any. | 868 // Push initial value, if any. |
872 // Note: For variables we must not push an initial value (such as | 869 // Note: For variables we must not push an initial value (such as |
873 // 'undefined') because we may have a (legal) redeclaration and we | 870 // 'undefined') because we may have a (legal) redeclaration and we |
874 // must not destroy the current value. | 871 // must not destroy the current value. |
875 if (hole_init) { | 872 if (hole_init) { |
876 __ LoadRoot(x0, Heap::kTheHoleValueRootIndex); | 873 __ LoadRoot(x0, Heap::kTheHoleValueRootIndex); |
877 __ Push(cp, x2, x1, x0); | 874 __ Push(x2, x0); |
878 } else { | 875 } else { |
879 // Pushing 0 (xzr) indicates no initial value. | 876 // Pushing 0 (xzr) indicates no initial value. |
880 __ Push(cp, x2, x1, xzr); | 877 __ Push(x2, xzr); |
881 } | 878 } |
882 __ CallRuntime(Runtime::kDeclareLookupSlot, 4); | 879 __ CallRuntime(IsImmutableVariableMode(mode) |
| 880 ? Runtime::kDeclareReadOnlyLookupSlot |
| 881 : Runtime::kDeclareLookupSlot, |
| 882 2); |
883 break; | 883 break; |
884 } | 884 } |
885 } | 885 } |
886 } | 886 } |
887 | 887 |
888 | 888 |
889 void FullCodeGenerator::VisitFunctionDeclaration( | 889 void FullCodeGenerator::VisitFunctionDeclaration( |
890 FunctionDeclaration* declaration) { | 890 FunctionDeclaration* declaration) { |
891 VariableProxy* proxy = declaration->proxy(); | 891 VariableProxy* proxy = declaration->proxy(); |
892 Variable* variable = proxy->var(); | 892 Variable* variable = proxy->var(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 kDontSaveFPRegs, | 925 kDontSaveFPRegs, |
926 EMIT_REMEMBERED_SET, | 926 EMIT_REMEMBERED_SET, |
927 OMIT_SMI_CHECK); | 927 OMIT_SMI_CHECK); |
928 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 928 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
929 break; | 929 break; |
930 } | 930 } |
931 | 931 |
932 case VariableLocation::LOOKUP: { | 932 case VariableLocation::LOOKUP: { |
933 Comment cmnt(masm_, "[ Function Declaration"); | 933 Comment cmnt(masm_, "[ Function Declaration"); |
934 __ Mov(x2, Operand(variable->name())); | 934 __ Mov(x2, Operand(variable->name())); |
935 __ Mov(x1, Smi::FromInt(NONE)); | 935 __ Push(x2); |
936 __ Push(cp, x2, x1); | |
937 // Push initial value for function declaration. | 936 // Push initial value for function declaration. |
938 VisitForStackValue(declaration->fun()); | 937 VisitForStackValue(declaration->fun()); |
939 __ CallRuntime(Runtime::kDeclareLookupSlot, 4); | 938 __ CallRuntime(Runtime::kDeclareLookupSlot, 2); |
940 break; | 939 break; |
941 } | 940 } |
942 } | 941 } |
943 } | 942 } |
944 | 943 |
945 | 944 |
946 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 945 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
947 // Call the runtime to declare the globals. | 946 // Call the runtime to declare the globals. |
948 __ Mov(x11, Operand(pairs)); | 947 __ Mov(x11, Operand(pairs)); |
949 Register flags = xzr; | 948 Register flags = xzr; |
950 if (Smi::FromInt(DeclareGlobalsFlags())) { | 949 if (Smi::FromInt(DeclareGlobalsFlags())) { |
951 flags = x10; | 950 flags = x10; |
952 __ Mov(flags, Smi::FromInt(DeclareGlobalsFlags())); | 951 __ Mov(flags, Smi::FromInt(DeclareGlobalsFlags())); |
953 } | 952 } |
954 __ Push(cp, x11, flags); | 953 __ Push(x11, flags); |
955 __ CallRuntime(Runtime::kDeclareGlobals, 3); | 954 __ CallRuntime(Runtime::kDeclareGlobals, 2); |
956 // Return value is ignored. | 955 // Return value is ignored. |
957 } | 956 } |
958 | 957 |
959 | 958 |
960 void FullCodeGenerator::DeclareModules(Handle<FixedArray> descriptions) { | 959 void FullCodeGenerator::DeclareModules(Handle<FixedArray> descriptions) { |
961 // Call the runtime to declare the modules. | 960 // Call the runtime to declare the modules. |
962 __ Push(descriptions); | 961 __ Push(descriptions); |
963 __ CallRuntime(Runtime::kDeclareModules, 1); | 962 __ CallRuntime(Runtime::kDeclareModules, 1); |
964 // Return value is ignored. | 963 // Return value is ignored. |
965 } | 964 } |
(...skipping 4487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5453 } | 5452 } |
5454 | 5453 |
5455 return INTERRUPT; | 5454 return INTERRUPT; |
5456 } | 5455 } |
5457 | 5456 |
5458 | 5457 |
5459 } // namespace internal | 5458 } // namespace internal |
5460 } // namespace v8 | 5459 } // namespace v8 |
5461 | 5460 |
5462 #endif // V8_TARGET_ARCH_ARM64 | 5461 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |