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