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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 5322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5333 return Bailout(kReferenceToUninitializedVariable); | 5333 return Bailout(kReferenceToUninitializedVariable); |
5334 } | 5334 } |
5335 HInstruction* result = New<HLoadNamedField>( | 5335 HInstruction* result = New<HLoadNamedField>( |
5336 Add<HConstant>(script_context), nullptr, | 5336 Add<HConstant>(script_context), nullptr, |
5337 HObjectAccess::ForContextSlot(lookup.slot_index)); | 5337 HObjectAccess::ForContextSlot(lookup.slot_index)); |
5338 return ast_context()->ReturnInstruction(result, expr->id()); | 5338 return ast_context()->ReturnInstruction(result, expr->id()); |
5339 } | 5339 } |
5340 } | 5340 } |
5341 | 5341 |
5342 LookupIterator it(global, variable->name(), LookupIterator::OWN); | 5342 LookupIterator it(global, variable->name(), LookupIterator::OWN); |
| 5343 it.TryLookupCachedProperty(); |
5343 if (CanInlineGlobalPropertyAccess(variable, &it, LOAD)) { | 5344 if (CanInlineGlobalPropertyAccess(variable, &it, LOAD)) { |
5344 InlineGlobalPropertyLoad(&it, expr->id()); | 5345 InlineGlobalPropertyLoad(&it, expr->id()); |
5345 return; | 5346 return; |
5346 } else { | 5347 } else { |
5347 Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate()); | 5348 Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate()); |
5348 | 5349 |
5349 HValue* vector_value = Add<HConstant>(vector); | 5350 HValue* vector_value = Add<HConstant>(vector); |
5350 HValue* slot_value = | 5351 HValue* slot_value = |
5351 Add<HConstant>(vector->GetIndex(expr->VariableFeedbackSlot())); | 5352 Add<HConstant>(vector->GetIndex(expr->VariableFeedbackSlot())); |
5352 Callable callable = CodeFactory::LoadGlobalICInOptimizedCode( | 5353 Callable callable = CodeFactory::LoadGlobalICInOptimizedCode( |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6144 return BuildStoreNamedField(info, checked_object, value); | 6145 return BuildStoreNamedField(info, checked_object, value); |
6145 } | 6146 } |
6146 } | 6147 } |
6147 | 6148 |
6148 if (info->IsTransition()) { | 6149 if (info->IsTransition()) { |
6149 DCHECK(!info->IsLoad()); | 6150 DCHECK(!info->IsLoad()); |
6150 return BuildStoreNamedField(info, checked_object, value); | 6151 return BuildStoreNamedField(info, checked_object, value); |
6151 } | 6152 } |
6152 | 6153 |
6153 if (info->IsAccessorConstant()) { | 6154 if (info->IsAccessorConstant()) { |
| 6155 MaybeHandle<Name> maybe_name = |
| 6156 FunctionTemplateInfo::TryGetCachedPropertyName(isolate(), |
| 6157 info->accessor()); |
| 6158 if (!maybe_name.is_null()) { |
| 6159 Handle<Name> name = maybe_name.ToHandleChecked(); |
| 6160 PropertyAccessInfo cache_info(this, LOAD, info->map(), name); |
| 6161 // Load new target. |
| 6162 if (cache_info.CanAccessMonomorphic()) { |
| 6163 return BuildLoadNamedField(&cache_info, checked_object); |
| 6164 } |
| 6165 } |
| 6166 |
6154 Push(checked_object); | 6167 Push(checked_object); |
6155 int argument_count = 1; | 6168 int argument_count = 1; |
6156 if (!info->IsLoad()) { | 6169 if (!info->IsLoad()) { |
6157 argument_count = 2; | 6170 argument_count = 2; |
6158 Push(value); | 6171 Push(value); |
6159 } | 6172 } |
6160 | 6173 |
6161 if (info->accessor()->IsJSFunction() && | 6174 if (info->accessor()->IsJSFunction() && |
6162 info->NeedsWrappingFor(Handle<JSFunction>::cast(info->accessor()))) { | 6175 info->NeedsWrappingFor(Handle<JSFunction>::cast(info->accessor()))) { |
6163 HValue* function = Add<HConstant>(info->accessor()); | 6176 HValue* function = Add<HConstant>(info->accessor()); |
(...skipping 6871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13035 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13048 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13036 } | 13049 } |
13037 | 13050 |
13038 #ifdef DEBUG | 13051 #ifdef DEBUG |
13039 graph_->Verify(false); // No full verify. | 13052 graph_->Verify(false); // No full verify. |
13040 #endif | 13053 #endif |
13041 } | 13054 } |
13042 | 13055 |
13043 } // namespace internal | 13056 } // namespace internal |
13044 } // namespace v8 | 13057 } // namespace v8 |
OLD | NEW |