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 #include "src/bailout-reason.h" | 7 #include "src/bailout-reason.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/field-index.h" | 9 #include "src/field-index.h" |
10 #include "src/hydrogen.h" | 10 #include "src/hydrogen.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 bool runtime_stack_params = descriptor_.stack_parameter_count().is_valid(); | 149 bool runtime_stack_params = descriptor_.stack_parameter_count().is_valid(); |
150 HInstruction* stack_parameter_count = NULL; | 150 HInstruction* stack_parameter_count = NULL; |
151 for (int i = 0; i < param_count; ++i) { | 151 for (int i = 0; i < param_count; ++i) { |
152 Representation r = GetParameterRepresentation(i); | 152 Representation r = GetParameterRepresentation(i); |
153 HParameter* param; | 153 HParameter* param; |
154 if (i >= register_param_count) { | 154 if (i >= register_param_count) { |
155 param = Add<HParameter>(i - register_param_count, | 155 param = Add<HParameter>(i - register_param_count, |
156 HParameter::STACK_PARAMETER, r); | 156 HParameter::STACK_PARAMETER, r); |
157 } else { | 157 } else { |
158 param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r); | 158 param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r); |
| 159 start_environment->Bind(i, param); |
159 } | 160 } |
160 start_environment->Bind(i, param); | |
161 parameters_[i] = param; | 161 parameters_[i] = param; |
162 if (i < register_param_count && IsParameterCountRegister(i)) { | 162 if (i < register_param_count && IsParameterCountRegister(i)) { |
163 param->set_type(HType::Smi()); | 163 param->set_type(HType::Smi()); |
164 stack_parameter_count = param; | 164 stack_parameter_count = param; |
165 arguments_length_ = stack_parameter_count; | 165 arguments_length_ = stack_parameter_count; |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 DCHECK(!runtime_stack_params || arguments_length_ != NULL); | 169 DCHECK(!runtime_stack_params || arguments_length_ != NULL); |
170 if (!runtime_stack_params) { | 170 if (!runtime_stack_params) { |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 casted_stub()->representation(), false); | 1009 casted_stub()->representation(), false); |
1010 return GetParameter(2); | 1010 return GetParameter(2); |
1011 } | 1011 } |
1012 | 1012 |
1013 | 1013 |
1014 Handle<Code> StoreFieldStub::GenerateCode() { return DoGenerateCode(this); } | 1014 Handle<Code> StoreFieldStub::GenerateCode() { return DoGenerateCode(this); } |
1015 | 1015 |
1016 | 1016 |
1017 template <> | 1017 template <> |
1018 HValue* CodeStubGraphBuilder<StoreTransitionStub>::BuildCodeStub() { | 1018 HValue* CodeStubGraphBuilder<StoreTransitionStub>::BuildCodeStub() { |
1019 HValue* object = GetParameter(StoreTransitionDescriptor::kReceiverIndex); | 1019 HValue* object = GetParameter(StoreTransitionHelper::ReceiverIndex()); |
1020 | 1020 |
1021 switch (casted_stub()->store_mode()) { | 1021 switch (casted_stub()->store_mode()) { |
1022 case StoreTransitionStub::ExtendStorageAndStoreMapAndValue: { | 1022 case StoreTransitionStub::ExtendStorageAndStoreMapAndValue: { |
1023 HValue* properties = Add<HLoadNamedField>( | 1023 HValue* properties = Add<HLoadNamedField>( |
1024 object, nullptr, HObjectAccess::ForPropertiesPointer()); | 1024 object, nullptr, HObjectAccess::ForPropertiesPointer()); |
1025 HValue* length = AddLoadFixedArrayLength(properties); | 1025 HValue* length = AddLoadFixedArrayLength(properties); |
1026 HValue* delta = | 1026 HValue* delta = |
1027 Add<HConstant>(static_cast<int32_t>(JSObject::kFieldsAdded)); | 1027 Add<HConstant>(static_cast<int32_t>(JSObject::kFieldsAdded)); |
1028 HValue* new_capacity = AddUncasted<HAdd>(length, delta); | 1028 HValue* new_capacity = AddUncasted<HAdd>(length, delta); |
1029 | 1029 |
(...skipping 10 matching lines...) Expand all Loading... |
1040 | 1040 |
1041 BuildCopyProperties(properties, new_properties, length, new_capacity); | 1041 BuildCopyProperties(properties, new_properties, length, new_capacity); |
1042 | 1042 |
1043 Add<HStoreNamedField>(object, HObjectAccess::ForPropertiesPointer(), | 1043 Add<HStoreNamedField>(object, HObjectAccess::ForPropertiesPointer(), |
1044 new_properties); | 1044 new_properties); |
1045 } | 1045 } |
1046 // Fall through. | 1046 // Fall through. |
1047 case StoreTransitionStub::StoreMapAndValue: | 1047 case StoreTransitionStub::StoreMapAndValue: |
1048 // Store the new value into the "extended" object. | 1048 // Store the new value into the "extended" object. |
1049 BuildStoreNamedField( | 1049 BuildStoreNamedField( |
1050 object, GetParameter(StoreTransitionDescriptor::kValueIndex), | 1050 object, GetParameter(StoreTransitionHelper::ValueIndex()), |
1051 casted_stub()->index(), casted_stub()->representation(), true); | 1051 casted_stub()->index(), casted_stub()->representation(), true); |
1052 // Fall through. | 1052 // Fall through. |
1053 | 1053 |
1054 case StoreTransitionStub::StoreMapOnly: | 1054 case StoreTransitionStub::StoreMapOnly: |
1055 // And finally update the map. | 1055 // And finally update the map. |
1056 Add<HStoreNamedField>(object, HObjectAccess::ForMap(), | 1056 Add<HStoreNamedField>(object, HObjectAccess::ForMap(), |
1057 GetParameter(StoreTransitionDescriptor::kMapIndex)); | 1057 GetParameter(StoreTransitionHelper::MapIndex())); |
1058 break; | 1058 break; |
1059 } | 1059 } |
1060 return GetParameter(StoreTransitionDescriptor::kValueIndex); | 1060 return GetParameter(StoreTransitionHelper::ValueIndex()); |
1061 } | 1061 } |
1062 | 1062 |
1063 | 1063 |
1064 Handle<Code> StoreTransitionStub::GenerateCode() { | 1064 Handle<Code> StoreTransitionStub::GenerateCode() { |
1065 return DoGenerateCode(this); | 1065 return DoGenerateCode(this); |
1066 } | 1066 } |
1067 | 1067 |
1068 | 1068 |
1069 template <> | 1069 template <> |
1070 HValue* CodeStubGraphBuilder<StringLengthStub>::BuildCodeStub() { | 1070 HValue* CodeStubGraphBuilder<StringLengthStub>::BuildCodeStub() { |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 } | 1603 } |
1604 | 1604 |
1605 | 1605 |
1606 Handle<Code> StoreGlobalStub::GenerateCode() { | 1606 Handle<Code> StoreGlobalStub::GenerateCode() { |
1607 return DoGenerateCode(this); | 1607 return DoGenerateCode(this); |
1608 } | 1608 } |
1609 | 1609 |
1610 | 1610 |
1611 template <> | 1611 template <> |
1612 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() { | 1612 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() { |
1613 HValue* object = GetParameter(StoreTransitionDescriptor::kReceiverIndex); | 1613 HValue* object = GetParameter(StoreTransitionHelper::ReceiverIndex()); |
1614 HValue* key = GetParameter(StoreTransitionDescriptor::kNameIndex); | 1614 HValue* key = GetParameter(StoreTransitionHelper::NameIndex()); |
1615 HValue* value = GetParameter(StoreTransitionDescriptor::kValueIndex); | 1615 HValue* value = GetParameter(StoreTransitionHelper::ValueIndex()); |
1616 HValue* map = GetParameter(StoreTransitionDescriptor::kMapIndex); | 1616 HValue* map = GetParameter(StoreTransitionHelper::MapIndex()); |
1617 | 1617 |
1618 if (FLAG_trace_elements_transitions) { | 1618 if (FLAG_trace_elements_transitions) { |
1619 // Tracing elements transitions is the job of the runtime. | 1619 // Tracing elements transitions is the job of the runtime. |
1620 Add<HDeoptimize>(Deoptimizer::kTracingElementsTransitions, | 1620 Add<HDeoptimize>(Deoptimizer::kTracingElementsTransitions, |
1621 Deoptimizer::EAGER); | 1621 Deoptimizer::EAGER); |
1622 } else { | 1622 } else { |
1623 info()->MarkAsSavesCallerDoubles(); | 1623 info()->MarkAsSavesCallerDoubles(); |
1624 | 1624 |
1625 BuildTransitionElementsKind(object, map, | 1625 BuildTransitionElementsKind(object, map, |
1626 casted_stub()->from_kind(), | 1626 casted_stub()->from_kind(), |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2207 return Pop(); | 2207 return Pop(); |
2208 } | 2208 } |
2209 | 2209 |
2210 | 2210 |
2211 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2211 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
2212 return DoGenerateCode(this); | 2212 return DoGenerateCode(this); |
2213 } | 2213 } |
2214 | 2214 |
2215 } // namespace internal | 2215 } // namespace internal |
2216 } // namespace v8 | 2216 } // namespace v8 |
OLD | NEW |