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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 5473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5484 return ast_context()->ReturnInstruction(instr, expr->id()); | 5484 return ast_context()->ReturnInstruction(instr, expr->id()); |
5485 } | 5485 } |
5486 } else { | 5486 } else { |
5487 HValue* global_object = Add<HLoadNamedField>( | 5487 HValue* global_object = Add<HLoadNamedField>( |
5488 context(), nullptr, | 5488 context(), nullptr, |
5489 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 5489 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
5490 HLoadGlobalGeneric* instr = | 5490 HLoadGlobalGeneric* instr = |
5491 New<HLoadGlobalGeneric>(global_object, | 5491 New<HLoadGlobalGeneric>(global_object, |
5492 variable->name(), | 5492 variable->name(), |
5493 ast_context()->is_for_typeof()); | 5493 ast_context()->is_for_typeof()); |
5494 if (FLAG_vector_ics) { | 5494 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), |
5495 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), | 5495 expr->VariableFeedbackSlot()); |
5496 expr->VariableFeedbackSlot()); | |
5497 } | |
5498 return ast_context()->ReturnInstruction(instr, expr->id()); | 5496 return ast_context()->ReturnInstruction(instr, expr->id()); |
5499 } | 5497 } |
5500 } | 5498 } |
5501 | 5499 |
5502 case Variable::PARAMETER: | 5500 case Variable::PARAMETER: |
5503 case Variable::LOCAL: { | 5501 case Variable::LOCAL: { |
5504 HValue* value = LookupAndMakeLive(variable); | 5502 HValue* value = LookupAndMakeLive(variable); |
5505 if (value == graph()->GetConstantHole()) { | 5503 if (value == graph()->GetConstantHole()) { |
5506 DCHECK(IsDeclaredVariableMode(variable->mode()) && | 5504 DCHECK(IsDeclaredVariableMode(variable->mode()) && |
5507 variable->mode() != VAR); | 5505 variable->mode() != VAR); |
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7011 | 7009 |
7012 HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric( | 7010 HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric( |
7013 PropertyAccessType access_type, Expression* expr, HValue* object, | 7011 PropertyAccessType access_type, Expression* expr, HValue* object, |
7014 Handle<String> name, HValue* value, bool is_uninitialized) { | 7012 Handle<String> name, HValue* value, bool is_uninitialized) { |
7015 if (is_uninitialized) { | 7013 if (is_uninitialized) { |
7016 Add<HDeoptimize>( | 7014 Add<HDeoptimize>( |
7017 Deoptimizer::kInsufficientTypeFeedbackForGenericNamedAccess, | 7015 Deoptimizer::kInsufficientTypeFeedbackForGenericNamedAccess, |
7018 Deoptimizer::SOFT); | 7016 Deoptimizer::SOFT); |
7019 } | 7017 } |
7020 if (access_type == LOAD) { | 7018 if (access_type == LOAD) { |
7021 if (FLAG_vector_ics) { | 7019 Handle<TypeFeedbackVector> vector = |
7022 Handle<TypeFeedbackVector> vector = | 7020 handle(current_feedback_vector(), isolate()); |
7023 handle(current_feedback_vector(), isolate()); | 7021 FeedbackVectorICSlot slot = expr->AsProperty()->PropertyFeedbackSlot(); |
7024 FeedbackVectorICSlot slot = expr->AsProperty()->PropertyFeedbackSlot(); | |
7025 | 7022 |
7026 if (!expr->AsProperty()->key()->IsPropertyName()) { | 7023 if (!expr->AsProperty()->key()->IsPropertyName()) { |
7027 // It's possible that a keyed load of a constant string was converted | 7024 // It's possible that a keyed load of a constant string was converted |
7028 // to a named load. Here, at the last minute, we need to make sure to | 7025 // to a named load. Here, at the last minute, we need to make sure to |
7029 // use a generic Keyed Load if we are using the type vector, because | 7026 // use a generic Keyed Load if we are using the type vector, because |
7030 // it has to share information with full code. | 7027 // it has to share information with full code. |
7031 HConstant* key = Add<HConstant>(name); | 7028 HConstant* key = Add<HConstant>(name); |
7032 HLoadKeyedGeneric* result = | 7029 HLoadKeyedGeneric* result = |
7033 New<HLoadKeyedGeneric>(object, key, PREMONOMORPHIC); | 7030 New<HLoadKeyedGeneric>(object, key, PREMONOMORPHIC); |
7034 result->SetVectorAndSlot(vector, slot); | |
7035 return result; | |
7036 } | |
7037 | |
7038 HLoadNamedGeneric* result = | |
7039 New<HLoadNamedGeneric>(object, name, PREMONOMORPHIC); | |
7040 result->SetVectorAndSlot(vector, slot); | 7031 result->SetVectorAndSlot(vector, slot); |
7041 return result; | 7032 return result; |
7042 } | 7033 } |
7043 return New<HLoadNamedGeneric>(object, name, PREMONOMORPHIC); | 7034 |
| 7035 HLoadNamedGeneric* result = |
| 7036 New<HLoadNamedGeneric>(object, name, PREMONOMORPHIC); |
| 7037 result->SetVectorAndSlot(vector, slot); |
| 7038 return result; |
7044 } else { | 7039 } else { |
7045 return New<HStoreNamedGeneric>(object, name, value, | 7040 return New<HStoreNamedGeneric>(object, name, value, |
7046 function_language_mode(), PREMONOMORPHIC); | 7041 function_language_mode(), PREMONOMORPHIC); |
7047 } | 7042 } |
7048 } | 7043 } |
7049 | 7044 |
7050 | 7045 |
7051 | 7046 |
7052 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( | 7047 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( |
7053 PropertyAccessType access_type, | 7048 PropertyAccessType access_type, |
7054 Expression* expr, | 7049 Expression* expr, |
7055 HValue* object, | 7050 HValue* object, |
7056 HValue* key, | 7051 HValue* key, |
7057 HValue* value) { | 7052 HValue* value) { |
7058 if (access_type == LOAD) { | 7053 if (access_type == LOAD) { |
7059 InlineCacheState initial_state = | 7054 InlineCacheState initial_state = expr->AsProperty()->GetInlineCacheState(); |
7060 FLAG_vector_ics ? expr->AsProperty()->GetInlineCacheState() | |
7061 : PREMONOMORPHIC; | |
7062 HLoadKeyedGeneric* result = | 7055 HLoadKeyedGeneric* result = |
7063 New<HLoadKeyedGeneric>(object, key, initial_state); | 7056 New<HLoadKeyedGeneric>(object, key, initial_state); |
7064 // HLoadKeyedGeneric with vector ics benefits from being encoded as | 7057 // HLoadKeyedGeneric with vector ics benefits from being encoded as |
7065 // MEGAMORPHIC because the vector/slot combo becomes unnecessary. | 7058 // MEGAMORPHIC because the vector/slot combo becomes unnecessary. |
7066 if (FLAG_vector_ics && initial_state != MEGAMORPHIC) { | 7059 if (initial_state != MEGAMORPHIC) { |
7067 // We need to pass vector information. | 7060 // We need to pass vector information. |
7068 Handle<TypeFeedbackVector> vector = | 7061 Handle<TypeFeedbackVector> vector = |
7069 handle(current_feedback_vector(), isolate()); | 7062 handle(current_feedback_vector(), isolate()); |
7070 FeedbackVectorICSlot slot = expr->AsProperty()->PropertyFeedbackSlot(); | 7063 FeedbackVectorICSlot slot = expr->AsProperty()->PropertyFeedbackSlot(); |
7071 result->SetVectorAndSlot(vector, slot); | 7064 result->SetVectorAndSlot(vector, slot); |
7072 } | 7065 } |
7073 return result; | 7066 return result; |
7074 } else { | 7067 } else { |
7075 return New<HStoreKeyedGeneric>(object, key, value, function_language_mode(), | 7068 return New<HStoreKeyedGeneric>(object, key, value, function_language_mode(), |
7076 PREMONOMORPHIC); | 7069 PREMONOMORPHIC); |
(...skipping 6056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13133 if (ShouldProduceTraceOutput()) { | 13126 if (ShouldProduceTraceOutput()) { |
13134 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13127 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13135 } | 13128 } |
13136 | 13129 |
13137 #ifdef DEBUG | 13130 #ifdef DEBUG |
13138 graph_->Verify(false); // No full verify. | 13131 graph_->Verify(false); // No full verify. |
13139 #endif | 13132 #endif |
13140 } | 13133 } |
13141 | 13134 |
13142 } } // namespace v8::internal | 13135 } } // namespace v8::internal |
OLD | NEW |