| 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 <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
| 10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
| (...skipping 5677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5688 // Lookup in script contexts. | 5688 // Lookup in script contexts. |
| 5689 { | 5689 { |
| 5690 Handle<ScriptContextTable> script_contexts( | 5690 Handle<ScriptContextTable> script_contexts( |
| 5691 global->native_context()->script_context_table()); | 5691 global->native_context()->script_context_table()); |
| 5692 ScriptContextTable::LookupResult lookup; | 5692 ScriptContextTable::LookupResult lookup; |
| 5693 if (ScriptContextTable::Lookup(script_contexts, variable->name(), | 5693 if (ScriptContextTable::Lookup(script_contexts, variable->name(), |
| 5694 &lookup)) { | 5694 &lookup)) { |
| 5695 Handle<Context> script_context = ScriptContextTable::GetContext( | 5695 Handle<Context> script_context = ScriptContextTable::GetContext( |
| 5696 script_contexts, lookup.context_index); | 5696 script_contexts, lookup.context_index); |
| 5697 Handle<Object> current_value = | 5697 Handle<Object> current_value = |
| 5698 FixedArray::get(script_context, lookup.slot_index); | 5698 FixedArray::get(*script_context, lookup.slot_index, isolate()); |
| 5699 | 5699 |
| 5700 // If the values is not the hole, it will stay initialized, | 5700 // If the values is not the hole, it will stay initialized, |
| 5701 // so no need to generate a check. | 5701 // so no need to generate a check. |
| 5702 if (*current_value == *isolate()->factory()->the_hole_value()) { | 5702 if (*current_value == *isolate()->factory()->the_hole_value()) { |
| 5703 return Bailout(kReferenceToUninitializedVariable); | 5703 return Bailout(kReferenceToUninitializedVariable); |
| 5704 } | 5704 } |
| 5705 HInstruction* result = New<HLoadNamedField>( | 5705 HInstruction* result = New<HLoadNamedField>( |
| 5706 Add<HConstant>(script_context), nullptr, | 5706 Add<HConstant>(script_context), nullptr, |
| 5707 HObjectAccess::ForContextSlot(lookup.slot_index)); | 5707 HObjectAccess::ForContextSlot(lookup.slot_index)); |
| 5708 return ast_context()->ReturnInstruction(result, expr->id()); | 5708 return ast_context()->ReturnInstruction(result, expr->id()); |
| (...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6884 global->native_context()->script_context_table()); | 6884 global->native_context()->script_context_table()); |
| 6885 ScriptContextTable::LookupResult lookup; | 6885 ScriptContextTable::LookupResult lookup; |
| 6886 if (ScriptContextTable::Lookup(script_contexts, var->name(), &lookup)) { | 6886 if (ScriptContextTable::Lookup(script_contexts, var->name(), &lookup)) { |
| 6887 if (lookup.mode == CONST) { | 6887 if (lookup.mode == CONST) { |
| 6888 return Bailout(kNonInitializerAssignmentToConst); | 6888 return Bailout(kNonInitializerAssignmentToConst); |
| 6889 } | 6889 } |
| 6890 Handle<Context> script_context = | 6890 Handle<Context> script_context = |
| 6891 ScriptContextTable::GetContext(script_contexts, lookup.context_index); | 6891 ScriptContextTable::GetContext(script_contexts, lookup.context_index); |
| 6892 | 6892 |
| 6893 Handle<Object> current_value = | 6893 Handle<Object> current_value = |
| 6894 FixedArray::get(script_context, lookup.slot_index); | 6894 FixedArray::get(*script_context, lookup.slot_index, isolate()); |
| 6895 | 6895 |
| 6896 // If the values is not the hole, it will stay initialized, | 6896 // If the values is not the hole, it will stay initialized, |
| 6897 // so no need to generate a check. | 6897 // so no need to generate a check. |
| 6898 if (*current_value == *isolate()->factory()->the_hole_value()) { | 6898 if (*current_value == *isolate()->factory()->the_hole_value()) { |
| 6899 return Bailout(kReferenceToUninitializedVariable); | 6899 return Bailout(kReferenceToUninitializedVariable); |
| 6900 } | 6900 } |
| 6901 | 6901 |
| 6902 HStoreNamedField* instr = Add<HStoreNamedField>( | 6902 HStoreNamedField* instr = Add<HStoreNamedField>( |
| 6903 Add<HConstant>(script_context), | 6903 Add<HConstant>(script_context), |
| 6904 HObjectAccess::ForContextSlot(lookup.slot_index), value); | 6904 HObjectAccess::ForContextSlot(lookup.slot_index), value); |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7408 LoadKeyedHoleMode load_mode = BuildKeyedHoleMode(map); | 7408 LoadKeyedHoleMode load_mode = BuildKeyedHoleMode(map); |
| 7409 return BuildUncheckedMonomorphicElementAccess( | 7409 return BuildUncheckedMonomorphicElementAccess( |
| 7410 checked_object, key, val, | 7410 checked_object, key, val, |
| 7411 map->instance_type() == JS_ARRAY_TYPE, | 7411 map->instance_type() == JS_ARRAY_TYPE, |
| 7412 map->elements_kind(), access_type, | 7412 map->elements_kind(), access_type, |
| 7413 load_mode, store_mode); | 7413 load_mode, store_mode); |
| 7414 } | 7414 } |
| 7415 | 7415 |
| 7416 | 7416 |
| 7417 static bool CanInlineElementAccess(Handle<Map> map) { | 7417 static bool CanInlineElementAccess(Handle<Map> map) { |
| 7418 return map->IsJSObjectMap() && !map->has_dictionary_elements() && | 7418 return map->IsJSObjectMap() && |
| 7419 !map->has_sloppy_arguments_elements() && | 7419 (map->has_fast_elements() || map->has_fixed_typed_array_elements()) && |
| 7420 !map->has_indexed_interceptor() && !map->is_access_check_needed(); | 7420 !map->has_indexed_interceptor() && !map->is_access_check_needed(); |
| 7421 } | 7421 } |
| 7422 | 7422 |
| 7423 | 7423 |
| 7424 HInstruction* HOptimizedGraphBuilder::TryBuildConsolidatedElementLoad( | 7424 HInstruction* HOptimizedGraphBuilder::TryBuildConsolidatedElementLoad( |
| 7425 HValue* object, | 7425 HValue* object, |
| 7426 HValue* key, | 7426 HValue* key, |
| 7427 HValue* val, | 7427 HValue* val, |
| 7428 SmallMapList* maps) { | 7428 SmallMapList* maps) { |
| 7429 // For polymorphic loads of similar elements kinds (i.e. all tagged or all | 7429 // For polymorphic loads of similar elements kinds (i.e. all tagged or all |
| (...skipping 6234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13664 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13664 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13665 } | 13665 } |
| 13666 | 13666 |
| 13667 #ifdef DEBUG | 13667 #ifdef DEBUG |
| 13668 graph_->Verify(false); // No full verify. | 13668 graph_->Verify(false); // No full verify. |
| 13669 #endif | 13669 #endif |
| 13670 } | 13670 } |
| 13671 | 13671 |
| 13672 } // namespace internal | 13672 } // namespace internal |
| 13673 } // namespace v8 | 13673 } // namespace v8 |
| OLD | NEW |