| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 6418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6429 Property* prop, | 6429 Property* prop, |
| 6430 BailoutId ast_id, | 6430 BailoutId ast_id, |
| 6431 BailoutId return_id, | 6431 BailoutId return_id, |
| 6432 bool is_uninitialized) { | 6432 bool is_uninitialized) { |
| 6433 if (!prop->key()->IsPropertyName()) { | 6433 if (!prop->key()->IsPropertyName()) { |
| 6434 // Keyed store. | 6434 // Keyed store. |
| 6435 HValue* value = environment()->ExpressionStackAt(0); | 6435 HValue* value = environment()->ExpressionStackAt(0); |
| 6436 HValue* key = environment()->ExpressionStackAt(1); | 6436 HValue* key = environment()->ExpressionStackAt(1); |
| 6437 HValue* object = environment()->ExpressionStackAt(2); | 6437 HValue* object = environment()->ExpressionStackAt(2); |
| 6438 bool has_side_effects = false; | 6438 bool has_side_effects = false; |
| 6439 HandleKeyedElementAccess(object, key, value, expr, return_id, STORE, | 6439 HandleKeyedElementAccess(object, key, value, expr, ast_id, return_id, STORE, |
| 6440 &has_side_effects); | 6440 &has_side_effects); |
| 6441 Drop(3); | 6441 Drop(3); |
| 6442 Push(value); | 6442 Push(value); |
| 6443 Add<HSimulate>(return_id, REMOVABLE_SIMULATE); | 6443 Add<HSimulate>(return_id, REMOVABLE_SIMULATE); |
| 6444 return ast_context()->ReturnValue(Pop()); | 6444 return ast_context()->ReturnValue(Pop()); |
| 6445 } | 6445 } |
| 6446 | 6446 |
| 6447 // Named store. | 6447 // Named store. |
| 6448 HValue* value = Pop(); | 6448 HValue* value = Pop(); |
| 6449 HValue* object = Pop(); | 6449 HValue* object = Pop(); |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7122 DCHECK(join->predecessors()->length() > 0); | 7122 DCHECK(join->predecessors()->length() > 0); |
| 7123 // Deopt if none of the cases matched. | 7123 // Deopt if none of the cases matched. |
| 7124 NoObservableSideEffectsScope scope(this); | 7124 NoObservableSideEffectsScope scope(this); |
| 7125 FinishExitWithHardDeoptimization("Unknown map in polymorphic element access"); | 7125 FinishExitWithHardDeoptimization("Unknown map in polymorphic element access"); |
| 7126 set_current_block(join); | 7126 set_current_block(join); |
| 7127 return access_type == STORE ? NULL : Pop(); | 7127 return access_type == STORE ? NULL : Pop(); |
| 7128 } | 7128 } |
| 7129 | 7129 |
| 7130 | 7130 |
| 7131 HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( | 7131 HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( |
| 7132 HValue* obj, HValue* key, HValue* val, Expression* expr, | 7132 HValue* obj, HValue* key, HValue* val, Expression* expr, BailoutId ast_id, |
| 7133 BailoutId return_id, PropertyAccessType access_type, | 7133 BailoutId return_id, PropertyAccessType access_type, |
| 7134 bool* has_side_effects) { | 7134 bool* has_side_effects) { |
| 7135 if (key->ActualValue()->IsConstant()) { | 7135 if (key->ActualValue()->IsConstant()) { |
| 7136 Handle<Object> constant = | 7136 Handle<Object> constant = |
| 7137 HConstant::cast(key->ActualValue())->handle(isolate()); | 7137 HConstant::cast(key->ActualValue())->handle(isolate()); |
| 7138 uint32_t array_index; | 7138 uint32_t array_index; |
| 7139 if (constant->IsString() && | 7139 if (constant->IsString() && |
| 7140 !Handle<String>::cast(constant)->AsArrayIndex(&array_index)) { | 7140 !Handle<String>::cast(constant)->AsArrayIndex(&array_index)) { |
| 7141 if (!constant->IsUniqueName()) { | 7141 if (!constant->IsUniqueName()) { |
| 7142 constant = isolate()->factory()->InternalizeString( | 7142 constant = isolate()->factory()->InternalizeString( |
| 7143 Handle<String>::cast(constant)); | 7143 Handle<String>::cast(constant)); |
| 7144 } | 7144 } |
| 7145 HInstruction* instr = | 7145 HInstruction* instr = |
| 7146 BuildNamedAccess(access_type, expr->id(), return_id, expr, obj, | 7146 BuildNamedAccess(access_type, ast_id, return_id, expr, obj, |
| 7147 Handle<String>::cast(constant), val, false); | 7147 Handle<String>::cast(constant), val, false); |
| 7148 if (instr == NULL || instr->IsLinked()) { | 7148 if (instr == NULL || instr->IsLinked()) { |
| 7149 *has_side_effects = false; | 7149 *has_side_effects = false; |
| 7150 } else { | 7150 } else { |
| 7151 AddInstruction(instr); | 7151 AddInstruction(instr); |
| 7152 *has_side_effects = instr->HasObservableSideEffects(); | 7152 *has_side_effects = instr->HasObservableSideEffects(); |
| 7153 } | 7153 } |
| 7154 return instr; | 7154 return instr; |
| 7155 } | 7155 } |
| 7156 } | 7156 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7358 object, name, NULL, expr->IsUninitialized()); | 7358 object, name, NULL, expr->IsUninitialized()); |
| 7359 if (instr == NULL) return; | 7359 if (instr == NULL) return; |
| 7360 if (instr->IsLinked()) return ast_context()->ReturnValue(instr); | 7360 if (instr->IsLinked()) return ast_context()->ReturnValue(instr); |
| 7361 | 7361 |
| 7362 } else { | 7362 } else { |
| 7363 HValue* key = Pop(); | 7363 HValue* key = Pop(); |
| 7364 HValue* obj = Pop(); | 7364 HValue* obj = Pop(); |
| 7365 | 7365 |
| 7366 bool has_side_effects = false; | 7366 bool has_side_effects = false; |
| 7367 HValue* load = HandleKeyedElementAccess( | 7367 HValue* load = HandleKeyedElementAccess( |
| 7368 obj, key, NULL, expr, expr->LoadId(), LOAD, &has_side_effects); | 7368 obj, key, NULL, expr, ast_id, expr->LoadId(), LOAD, &has_side_effects); |
| 7369 if (has_side_effects) { | 7369 if (has_side_effects) { |
| 7370 if (ast_context()->IsEffect()) { | 7370 if (ast_context()->IsEffect()) { |
| 7371 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 7371 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 7372 } else { | 7372 } else { |
| 7373 Push(load); | 7373 Push(load); |
| 7374 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 7374 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 7375 Drop(1); | 7375 Drop(1); |
| 7376 } | 7376 } |
| 7377 } | 7377 } |
| 7378 if (load == NULL) return; | 7378 if (load == NULL) return; |
| (...skipping 5144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12523 if (ShouldProduceTraceOutput()) { | 12523 if (ShouldProduceTraceOutput()) { |
| 12524 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12524 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12525 } | 12525 } |
| 12526 | 12526 |
| 12527 #ifdef DEBUG | 12527 #ifdef DEBUG |
| 12528 graph_->Verify(false); // No full verify. | 12528 graph_->Verify(false); // No full verify. |
| 12529 #endif | 12529 #endif |
| 12530 } | 12530 } |
| 12531 | 12531 |
| 12532 } } // namespace v8::internal | 12532 } } // namespace v8::internal |
| OLD | NEW |