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 5640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5651 // Lookup in script contexts. | 5651 // Lookup in script contexts. |
5652 { | 5652 { |
5653 Handle<ScriptContextTable> script_contexts( | 5653 Handle<ScriptContextTable> script_contexts( |
5654 global->native_context()->script_context_table()); | 5654 global->native_context()->script_context_table()); |
5655 ScriptContextTable::LookupResult lookup; | 5655 ScriptContextTable::LookupResult lookup; |
5656 if (ScriptContextTable::Lookup(script_contexts, variable->name(), | 5656 if (ScriptContextTable::Lookup(script_contexts, variable->name(), |
5657 &lookup)) { | 5657 &lookup)) { |
5658 Handle<Context> script_context = ScriptContextTable::GetContext( | 5658 Handle<Context> script_context = ScriptContextTable::GetContext( |
5659 script_contexts, lookup.context_index); | 5659 script_contexts, lookup.context_index); |
5660 Handle<Object> current_value = | 5660 Handle<Object> current_value = |
5661 FixedArray::get(script_context, lookup.slot_index); | 5661 FixedArray::get(*script_context, lookup.slot_index, isolate()); |
5662 | 5662 |
5663 // If the values is not the hole, it will stay initialized, | 5663 // If the values is not the hole, it will stay initialized, |
5664 // so no need to generate a check. | 5664 // so no need to generate a check. |
5665 if (*current_value == *isolate()->factory()->the_hole_value()) { | 5665 if (*current_value == *isolate()->factory()->the_hole_value()) { |
5666 return Bailout(kReferenceToUninitializedVariable); | 5666 return Bailout(kReferenceToUninitializedVariable); |
5667 } | 5667 } |
5668 HInstruction* result = New<HLoadNamedField>( | 5668 HInstruction* result = New<HLoadNamedField>( |
5669 Add<HConstant>(script_context), nullptr, | 5669 Add<HConstant>(script_context), nullptr, |
5670 HObjectAccess::ForContextSlot(lookup.slot_index)); | 5670 HObjectAccess::ForContextSlot(lookup.slot_index)); |
5671 return ast_context()->ReturnInstruction(result, expr->id()); | 5671 return ast_context()->ReturnInstruction(result, expr->id()); |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6857 global->native_context()->script_context_table()); | 6857 global->native_context()->script_context_table()); |
6858 ScriptContextTable::LookupResult lookup; | 6858 ScriptContextTable::LookupResult lookup; |
6859 if (ScriptContextTable::Lookup(script_contexts, var->name(), &lookup)) { | 6859 if (ScriptContextTable::Lookup(script_contexts, var->name(), &lookup)) { |
6860 if (lookup.mode == CONST) { | 6860 if (lookup.mode == CONST) { |
6861 return Bailout(kNonInitializerAssignmentToConst); | 6861 return Bailout(kNonInitializerAssignmentToConst); |
6862 } | 6862 } |
6863 Handle<Context> script_context = | 6863 Handle<Context> script_context = |
6864 ScriptContextTable::GetContext(script_contexts, lookup.context_index); | 6864 ScriptContextTable::GetContext(script_contexts, lookup.context_index); |
6865 | 6865 |
6866 Handle<Object> current_value = | 6866 Handle<Object> current_value = |
6867 FixedArray::get(script_context, lookup.slot_index); | 6867 FixedArray::get(*script_context, lookup.slot_index, isolate()); |
6868 | 6868 |
6869 // If the values is not the hole, it will stay initialized, | 6869 // If the values is not the hole, it will stay initialized, |
6870 // so no need to generate a check. | 6870 // so no need to generate a check. |
6871 if (*current_value == *isolate()->factory()->the_hole_value()) { | 6871 if (*current_value == *isolate()->factory()->the_hole_value()) { |
6872 return Bailout(kReferenceToUninitializedVariable); | 6872 return Bailout(kReferenceToUninitializedVariable); |
6873 } | 6873 } |
6874 | 6874 |
6875 HStoreNamedField* instr = Add<HStoreNamedField>( | 6875 HStoreNamedField* instr = Add<HStoreNamedField>( |
6876 Add<HConstant>(script_context), | 6876 Add<HConstant>(script_context), |
6877 HObjectAccess::ForContextSlot(lookup.slot_index), value); | 6877 HObjectAccess::ForContextSlot(lookup.slot_index), value); |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7381 LoadKeyedHoleMode load_mode = BuildKeyedHoleMode(map); | 7381 LoadKeyedHoleMode load_mode = BuildKeyedHoleMode(map); |
7382 return BuildUncheckedMonomorphicElementAccess( | 7382 return BuildUncheckedMonomorphicElementAccess( |
7383 checked_object, key, val, | 7383 checked_object, key, val, |
7384 map->instance_type() == JS_ARRAY_TYPE, | 7384 map->instance_type() == JS_ARRAY_TYPE, |
7385 map->elements_kind(), access_type, | 7385 map->elements_kind(), access_type, |
7386 load_mode, store_mode); | 7386 load_mode, store_mode); |
7387 } | 7387 } |
7388 | 7388 |
7389 | 7389 |
7390 static bool CanInlineElementAccess(Handle<Map> map) { | 7390 static bool CanInlineElementAccess(Handle<Map> map) { |
7391 return map->IsJSObjectMap() && !map->has_dictionary_elements() && | 7391 return map->IsJSObjectMap() && |
7392 !map->has_sloppy_arguments_elements() && | 7392 (map->has_fast_elements() || map->has_fixed_typed_array_elements()) && |
7393 !map->has_indexed_interceptor() && !map->is_access_check_needed(); | 7393 !map->has_indexed_interceptor() && !map->is_access_check_needed(); |
7394 } | 7394 } |
7395 | 7395 |
7396 | 7396 |
7397 HInstruction* HOptimizedGraphBuilder::TryBuildConsolidatedElementLoad( | 7397 HInstruction* HOptimizedGraphBuilder::TryBuildConsolidatedElementLoad( |
7398 HValue* object, | 7398 HValue* object, |
7399 HValue* key, | 7399 HValue* key, |
7400 HValue* val, | 7400 HValue* val, |
7401 SmallMapList* maps) { | 7401 SmallMapList* maps) { |
7402 // For polymorphic loads of similar elements kinds (i.e. all tagged or all | 7402 // For polymorphic loads of similar elements kinds (i.e. all tagged or all |
(...skipping 6229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13632 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13632 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13633 } | 13633 } |
13634 | 13634 |
13635 #ifdef DEBUG | 13635 #ifdef DEBUG |
13636 graph_->Verify(false); // No full verify. | 13636 graph_->Verify(false); // No full verify. |
13637 #endif | 13637 #endif |
13638 } | 13638 } |
13639 | 13639 |
13640 } // namespace internal | 13640 } // namespace internal |
13641 } // namespace v8 | 13641 } // namespace v8 |
OLD | NEW |