Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1234)

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 2391043005: [crankshaft] Remove HLoadKeyedGeneric and use HCallWithDescriptor to call KeyedLoadIC. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 5581 matching lines...) Expand 10 before | Expand all | Expand 10 after
5592 Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate()); 5592 Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate());
5593 5593
5594 HValue* vector_value = Add<HConstant>(vector); 5594 HValue* vector_value = Add<HConstant>(vector);
5595 HValue* slot_value = 5595 HValue* slot_value =
5596 Add<HConstant>(vector->GetIndex(expr->VariableFeedbackSlot())); 5596 Add<HConstant>(vector->GetIndex(expr->VariableFeedbackSlot()));
5597 Callable callable = CodeFactory::LoadGlobalICInOptimizedCode( 5597 Callable callable = CodeFactory::LoadGlobalICInOptimizedCode(
5598 isolate(), ast_context()->typeof_mode()); 5598 isolate(), ast_context()->typeof_mode());
5599 HValue* stub = Add<HConstant>(callable.code()); 5599 HValue* stub = Add<HConstant>(callable.code());
5600 HValue* values[] = {slot_value, vector_value}; 5600 HValue* values[] = {slot_value, vector_value};
5601 HCallWithDescriptor* instr = New<HCallWithDescriptor>( 5601 HCallWithDescriptor* instr = New<HCallWithDescriptor>(
5602 stub, 0, callable.descriptor(), ArrayVector(values)); 5602 Code::LOAD_GLOBAL_IC, stub, 0, callable.descriptor(),
5603 ArrayVector(values));
5603 return ast_context()->ReturnInstruction(instr, expr->id()); 5604 return ast_context()->ReturnInstruction(instr, expr->id());
5604 } 5605 }
5605 } 5606 }
5606 5607
5607 case VariableLocation::PARAMETER: 5608 case VariableLocation::PARAMETER:
5608 case VariableLocation::LOCAL: { 5609 case VariableLocation::LOCAL: {
5609 HValue* value = LookupAndMakeLive(variable); 5610 HValue* value = LookupAndMakeLive(variable);
5610 if (value == graph()->GetConstantHole()) { 5611 if (value == graph()->GetConstantHole()) {
5611 DCHECK(IsDeclaredVariableMode(variable->mode()) && 5612 DCHECK(IsDeclaredVariableMode(variable->mode()) &&
5612 variable->mode() != VAR); 5613 variable->mode() != VAR);
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
6790 Handle<TypeFeedbackVector> vector = 6791 Handle<TypeFeedbackVector> vector =
6791 handle(current_feedback_vector(), isolate()); 6792 handle(current_feedback_vector(), isolate());
6792 HValue* name = Add<HConstant>(var->name()); 6793 HValue* name = Add<HConstant>(var->name());
6793 HValue* vector_value = Add<HConstant>(vector); 6794 HValue* vector_value = Add<HConstant>(vector);
6794 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot)); 6795 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot));
6795 Callable callable = CodeFactory::StoreICInOptimizedCode( 6796 Callable callable = CodeFactory::StoreICInOptimizedCode(
6796 isolate(), function_language_mode()); 6797 isolate(), function_language_mode());
6797 HValue* stub = Add<HConstant>(callable.code()); 6798 HValue* stub = Add<HConstant>(callable.code());
6798 HValue* values[] = {global_object, name, value, slot_value, vector_value}; 6799 HValue* values[] = {global_object, name, value, slot_value, vector_value};
6799 HCallWithDescriptor* instr = Add<HCallWithDescriptor>( 6800 HCallWithDescriptor* instr = Add<HCallWithDescriptor>(
6800 stub, 0, callable.descriptor(), ArrayVector(values)); 6801 Code::STORE_IC, stub, 0, callable.descriptor(), ArrayVector(values));
6801 USE(instr); 6802 USE(instr);
6802 DCHECK(instr->HasObservableSideEffects()); 6803 DCHECK(instr->HasObservableSideEffects());
6803 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 6804 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
6804 } 6805 }
6805 } 6806 }
6806 6807
6807 6808
6808 void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) { 6809 void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
6809 Expression* target = expr->target(); 6810 Expression* target = expr->target();
6810 VariableProxy* proxy = target->AsVariableProxy(); 6811 VariableProxy* proxy = target->AsVariableProxy();
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
7102 HValue* vector_value = Add<HConstant>(vector); 7103 HValue* vector_value = Add<HConstant>(vector);
7103 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot)); 7104 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot));
7104 7105
7105 if (access_type == LOAD) { 7106 if (access_type == LOAD) {
7106 HValue* values[] = {object, key, slot_value, vector_value}; 7107 HValue* values[] = {object, key, slot_value, vector_value};
7107 if (!expr->AsProperty()->key()->IsPropertyName()) { 7108 if (!expr->AsProperty()->key()->IsPropertyName()) {
7108 // It's possible that a keyed load of a constant string was converted 7109 // It's possible that a keyed load of a constant string was converted
7109 // to a named load. Here, at the last minute, we need to make sure to 7110 // to a named load. Here, at the last minute, we need to make sure to
7110 // use a generic Keyed Load if we are using the type vector, because 7111 // use a generic Keyed Load if we are using the type vector, because
7111 // it has to share information with full code. 7112 // it has to share information with full code.
7112 HLoadKeyedGeneric* result = 7113 Callable callable = CodeFactory::KeyedLoadICInOptimizedCode(isolate());
7113 New<HLoadKeyedGeneric>(object, key, vector, slot); 7114 HValue* stub = Add<HConstant>(callable.code());
7115 HCallWithDescriptor* result =
7116 New<HCallWithDescriptor>(Code::KEYED_LOAD_IC, stub, 0,
7117 callable.descriptor(), ArrayVector(values));
7114 return result; 7118 return result;
7115 } 7119 }
7116
7117 Callable callable = CodeFactory::LoadICInOptimizedCode(isolate()); 7120 Callable callable = CodeFactory::LoadICInOptimizedCode(isolate());
7118 HValue* stub = Add<HConstant>(callable.code()); 7121 HValue* stub = Add<HConstant>(callable.code());
7119 HCallWithDescriptor* result = New<HCallWithDescriptor>( 7122 HCallWithDescriptor* result = New<HCallWithDescriptor>(
7120 stub, 0, callable.descriptor(), ArrayVector(values)); 7123 Code::LOAD_IC, stub, 0, callable.descriptor(), ArrayVector(values));
7121 return result; 7124 return result;
7122 7125
7123 } else { 7126 } else {
7124 HValue* values[] = {object, key, value, slot_value, vector_value}; 7127 HValue* values[] = {object, key, value, slot_value, vector_value};
7125 if (vector->GetKind(slot) == FeedbackVectorSlotKind::KEYED_STORE_IC) { 7128 if (vector->GetKind(slot) == FeedbackVectorSlotKind::KEYED_STORE_IC) {
7126 // It's possible that a keyed store of a constant string was converted 7129 // It's possible that a keyed store of a constant string was converted
7127 // to a named store. Here, at the last minute, we need to make sure to 7130 // to a named store. Here, at the last minute, we need to make sure to
7128 // use a generic Keyed Store if we are using the type vector, because 7131 // use a generic Keyed Store if we are using the type vector, because
7129 // it has to share information with full code. 7132 // it has to share information with full code.
7130 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( 7133 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode(
7131 isolate(), function_language_mode()); 7134 isolate(), function_language_mode());
7132 HValue* stub = Add<HConstant>(callable.code()); 7135 HValue* stub = Add<HConstant>(callable.code());
7133 HCallWithDescriptor* result = New<HCallWithDescriptor>( 7136 HCallWithDescriptor* result =
7134 stub, 0, callable.descriptor(), ArrayVector(values)); 7137 New<HCallWithDescriptor>(Code::KEYED_STORE_IC, stub, 0,
7138 callable.descriptor(), ArrayVector(values));
7135 return result; 7139 return result;
7136 } 7140 }
7137 Callable callable = CodeFactory::StoreICInOptimizedCode( 7141 Callable callable = CodeFactory::StoreICInOptimizedCode(
7138 isolate(), function_language_mode()); 7142 isolate(), function_language_mode());
7139 HValue* stub = Add<HConstant>(callable.code()); 7143 HValue* stub = Add<HConstant>(callable.code());
7140 HCallWithDescriptor* result = New<HCallWithDescriptor>( 7144 HCallWithDescriptor* result = New<HCallWithDescriptor>(
7141 stub, 0, callable.descriptor(), ArrayVector(values)); 7145 Code::STORE_IC, stub, 0, callable.descriptor(), ArrayVector(values));
7142 return result; 7146 return result;
7143 } 7147 }
7144 } 7148 }
7145 7149
7146 7150
7147 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( 7151 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric(
7148 PropertyAccessType access_type, Expression* expr, FeedbackVectorSlot slot, 7152 PropertyAccessType access_type, Expression* expr, FeedbackVectorSlot slot,
7149 HValue* object, HValue* key, HValue* value) { 7153 HValue* object, HValue* key, HValue* value) {
7150 Handle<TypeFeedbackVector> vector = 7154 Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate());
7151 handle(current_feedback_vector(), isolate()); 7155 HValue* vector_value = Add<HConstant>(vector);
7156 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot));
7157
7152 if (access_type == LOAD) { 7158 if (access_type == LOAD) {
7153 HLoadKeyedGeneric* result = 7159 HValue* values[] = {object, key, slot_value, vector_value};
7154 New<HLoadKeyedGeneric>(object, key, vector, slot); 7160
7161 Callable callable = CodeFactory::KeyedLoadICInOptimizedCode(isolate());
7162 HValue* stub = Add<HConstant>(callable.code());
7163 HCallWithDescriptor* result =
7164 New<HCallWithDescriptor>(Code::KEYED_LOAD_IC, stub, 0,
7165 callable.descriptor(), ArrayVector(values));
7155 return result; 7166 return result;
7156 } else { 7167 } else {
7157 HValue* vector_value = Add<HConstant>(vector);
7158 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot));
7159 HValue* values[] = {object, key, value, slot_value, vector_value}; 7168 HValue* values[] = {object, key, value, slot_value, vector_value};
7160 7169
7161 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( 7170 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode(
7162 isolate(), function_language_mode()); 7171 isolate(), function_language_mode());
7163 HValue* stub = Add<HConstant>(callable.code()); 7172 HValue* stub = Add<HConstant>(callable.code());
7164 HCallWithDescriptor* result = New<HCallWithDescriptor>( 7173 HCallWithDescriptor* result =
7165 stub, 0, callable.descriptor(), ArrayVector(values)); 7174 New<HCallWithDescriptor>(Code::KEYED_STORE_IC, stub, 0,
7175 callable.descriptor(), ArrayVector(values));
7166 return result; 7176 return result;
7167 } 7177 }
7168 } 7178 }
7169 7179
7170 7180
7171 LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle<Map> map) { 7181 LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle<Map> map) {
7172 // Loads from a "stock" fast holey double arrays can elide the hole check. 7182 // Loads from a "stock" fast holey double arrays can elide the hole check.
7173 // Loads from a "stock" fast holey array can convert the hole to undefined 7183 // Loads from a "stock" fast holey array can convert the hole to undefined
7174 // with impunity. 7184 // with impunity.
7175 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE; 7185 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE;
(...skipping 6102 matching lines...) Expand 10 before | Expand all | Expand 10 after
13278 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13288 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13279 } 13289 }
13280 13290
13281 #ifdef DEBUG 13291 #ifdef DEBUG
13282 graph_->Verify(false); // No full verify. 13292 graph_->Verify(false); // No full verify.
13283 #endif 13293 #endif
13284 } 13294 }
13285 13295
13286 } // namespace internal 13296 } // namespace internal
13287 } // namespace v8 13297 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698