OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 // No write barrier since the_hole_value is in old space. | 853 // No write barrier since the_hole_value is in old space. |
854 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 854 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
855 } | 855 } |
856 break; | 856 break; |
857 | 857 |
858 case VariableLocation::LOOKUP: { | 858 case VariableLocation::LOOKUP: { |
859 Comment cmnt(masm_, "[ VariableDeclaration"); | 859 Comment cmnt(masm_, "[ VariableDeclaration"); |
860 __ li(a2, Operand(variable->name())); | 860 __ li(a2, Operand(variable->name())); |
861 // Declaration nodes are always introduced in one of four modes. | 861 // Declaration nodes are always introduced in one of four modes. |
862 DCHECK(IsDeclaredVariableMode(mode)); | 862 DCHECK(IsDeclaredVariableMode(mode)); |
863 PropertyAttributes attr = | |
864 IsImmutableVariableMode(mode) ? READ_ONLY : NONE; | |
865 __ li(a1, Operand(Smi::FromInt(attr))); | |
866 // Push initial value, if any. | 863 // Push initial value, if any. |
867 // Note: For variables we must not push an initial value (such as | 864 // Note: For variables we must not push an initial value (such as |
868 // 'undefined') because we may have a (legal) redeclaration and we | 865 // 'undefined') because we may have a (legal) redeclaration and we |
869 // must not destroy the current value. | 866 // must not destroy the current value. |
870 if (hole_init) { | 867 if (hole_init) { |
871 __ LoadRoot(a0, Heap::kTheHoleValueRootIndex); | 868 __ LoadRoot(a0, Heap::kTheHoleValueRootIndex); |
872 __ Push(cp, a2, a1, a0); | |
873 } else { | 869 } else { |
874 DCHECK(Smi::FromInt(0) == 0); | 870 DCHECK(Smi::FromInt(0) == 0); |
875 __ mov(a0, zero_reg); // Smi::FromInt(0) indicates no initial value. | 871 __ mov(a0, zero_reg); // Smi::FromInt(0) indicates no initial value. |
876 __ Push(cp, a2, a1, a0); | |
877 } | 872 } |
878 __ CallRuntime(Runtime::kDeclareLookupSlot, 4); | 873 __ Push(a2, a0); |
| 874 __ CallRuntime(IsImmutableVariableMode(mode) |
| 875 ? Runtime::kDeclareReadOnlyLookupSlot |
| 876 : Runtime::kDeclareLookupSlot, |
| 877 2); |
879 break; | 878 break; |
880 } | 879 } |
881 } | 880 } |
882 } | 881 } |
883 | 882 |
884 | 883 |
885 void FullCodeGenerator::VisitFunctionDeclaration( | 884 void FullCodeGenerator::VisitFunctionDeclaration( |
886 FunctionDeclaration* declaration) { | 885 FunctionDeclaration* declaration) { |
887 VariableProxy* proxy = declaration->proxy(); | 886 VariableProxy* proxy = declaration->proxy(); |
888 Variable* variable = proxy->var(); | 887 Variable* variable = proxy->var(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 kDontSaveFPRegs, | 920 kDontSaveFPRegs, |
922 EMIT_REMEMBERED_SET, | 921 EMIT_REMEMBERED_SET, |
923 OMIT_SMI_CHECK); | 922 OMIT_SMI_CHECK); |
924 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 923 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
925 break; | 924 break; |
926 } | 925 } |
927 | 926 |
928 case VariableLocation::LOOKUP: { | 927 case VariableLocation::LOOKUP: { |
929 Comment cmnt(masm_, "[ FunctionDeclaration"); | 928 Comment cmnt(masm_, "[ FunctionDeclaration"); |
930 __ li(a2, Operand(variable->name())); | 929 __ li(a2, Operand(variable->name())); |
931 __ li(a1, Operand(Smi::FromInt(NONE))); | 930 __ Push(a2); |
932 __ Push(cp, a2, a1); | |
933 // Push initial value for function declaration. | 931 // Push initial value for function declaration. |
934 VisitForStackValue(declaration->fun()); | 932 VisitForStackValue(declaration->fun()); |
935 __ CallRuntime(Runtime::kDeclareLookupSlot, 4); | 933 __ CallRuntime(Runtime::kDeclareLookupSlot, 2); |
936 break; | 934 break; |
937 } | 935 } |
938 } | 936 } |
939 } | 937 } |
940 | 938 |
941 | 939 |
942 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 940 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
943 // Call the runtime to declare the globals. | 941 // Call the runtime to declare the globals. |
944 // The context is the first argument. | |
945 __ li(a1, Operand(pairs)); | 942 __ li(a1, Operand(pairs)); |
946 __ li(a0, Operand(Smi::FromInt(DeclareGlobalsFlags()))); | 943 __ li(a0, Operand(Smi::FromInt(DeclareGlobalsFlags()))); |
947 __ Push(cp, a1, a0); | 944 __ Push(a1, a0); |
948 __ CallRuntime(Runtime::kDeclareGlobals, 3); | 945 __ CallRuntime(Runtime::kDeclareGlobals, 2); |
949 // Return value is ignored. | 946 // Return value is ignored. |
950 } | 947 } |
951 | 948 |
952 | 949 |
953 void FullCodeGenerator::DeclareModules(Handle<FixedArray> descriptions) { | 950 void FullCodeGenerator::DeclareModules(Handle<FixedArray> descriptions) { |
954 // Call the runtime to declare the modules. | 951 // Call the runtime to declare the modules. |
955 __ Push(descriptions); | 952 __ Push(descriptions); |
956 __ CallRuntime(Runtime::kDeclareModules, 1); | 953 __ CallRuntime(Runtime::kDeclareModules, 1); |
957 // Return value is ignored. | 954 // Return value is ignored. |
958 } | 955 } |
(...skipping 4476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5435 reinterpret_cast<uint64_t>( | 5432 reinterpret_cast<uint64_t>( |
5436 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5433 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5437 return OSR_AFTER_STACK_CHECK; | 5434 return OSR_AFTER_STACK_CHECK; |
5438 } | 5435 } |
5439 | 5436 |
5440 | 5437 |
5441 } // namespace internal | 5438 } // namespace internal |
5442 } // namespace v8 | 5439 } // namespace v8 |
5443 | 5440 |
5444 #endif // V8_TARGET_ARCH_MIPS64 | 5441 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |