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 5635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5646 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 5646 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
5647 DCHECK(!CompileTimeValue::IsCompileTimeValue(value)); | 5647 DCHECK(!CompileTimeValue::IsCompileTimeValue(value)); |
5648 // Fall through. | 5648 // Fall through. |
5649 case ObjectLiteral::Property::COMPUTED: | 5649 case ObjectLiteral::Property::COMPUTED: |
5650 // It is safe to use [[Put]] here because the boilerplate already | 5650 // It is safe to use [[Put]] here because the boilerplate already |
5651 // contains computed properties with an uninitialized value. | 5651 // contains computed properties with an uninitialized value. |
5652 if (key->value()->IsInternalizedString()) { | 5652 if (key->value()->IsInternalizedString()) { |
5653 if (property->emit_store()) { | 5653 if (property->emit_store()) { |
5654 CHECK_ALIVE(VisitForValue(value)); | 5654 CHECK_ALIVE(VisitForValue(value)); |
5655 HValue* value = Pop(); | 5655 HValue* value = Pop(); |
| 5656 |
| 5657 // Add [[HomeObject]] to function literals. |
| 5658 if (FunctionLiteral::NeedsHomeObject(property->value())) { |
| 5659 Handle<Symbol> sym = isolate()->factory()->home_object_symbol(); |
| 5660 HInstruction* store_home = BuildKeyedGeneric( |
| 5661 STORE, NULL, value, Add<HConstant>(sym), literal); |
| 5662 AddInstruction(store_home); |
| 5663 DCHECK(store_home->HasObservableSideEffects()); |
| 5664 Add<HSimulate>(property->value()->id(), REMOVABLE_SIMULATE); |
| 5665 } |
| 5666 |
5656 Handle<Map> map = property->GetReceiverType(); | 5667 Handle<Map> map = property->GetReceiverType(); |
5657 Handle<String> name = property->key()->AsPropertyName(); | 5668 Handle<String> name = property->key()->AsPropertyName(); |
5658 HInstruction* store; | 5669 HInstruction* store; |
5659 if (map.is_null()) { | 5670 if (map.is_null()) { |
5660 // If we don't know the monomorphic type, do a generic store. | 5671 // If we don't know the monomorphic type, do a generic store. |
5661 CHECK_ALIVE(store = BuildNamedGeneric( | 5672 CHECK_ALIVE(store = BuildNamedGeneric( |
5662 STORE, NULL, literal, name, value)); | 5673 STORE, NULL, literal, name, value)); |
5663 } else { | 5674 } else { |
5664 PropertyAccessInfo info(this, STORE, ToType(map), name); | 5675 PropertyAccessInfo info(this, STORE, ToType(map), name); |
5665 if (info.CanAccessMonomorphic()) { | 5676 if (info.CanAccessMonomorphic()) { |
5666 HValue* checked_literal = Add<HCheckMaps>(literal, map); | 5677 HValue* checked_literal = Add<HCheckMaps>(literal, map); |
5667 DCHECK(!info.IsAccessor()); | 5678 DCHECK(!info.IsAccessor()); |
5668 store = BuildMonomorphicAccess( | 5679 store = BuildMonomorphicAccess( |
5669 &info, literal, checked_literal, value, | 5680 &info, literal, checked_literal, value, |
5670 BailoutId::None(), BailoutId::None()); | 5681 BailoutId::None(), BailoutId::None()); |
5671 } else { | 5682 } else { |
5672 CHECK_ALIVE(store = BuildNamedGeneric( | 5683 CHECK_ALIVE(store = BuildNamedGeneric( |
5673 STORE, NULL, literal, name, value)); | 5684 STORE, NULL, literal, name, value)); |
5674 } | 5685 } |
5675 } | 5686 } |
5676 AddInstruction(store); | 5687 AddInstruction(store); |
5677 if (store->HasObservableSideEffects()) { | 5688 DCHECK(store->HasObservableSideEffects()); |
5678 Add<HSimulate>(key->id(), REMOVABLE_SIMULATE); | 5689 Add<HSimulate>(key->id(), REMOVABLE_SIMULATE); |
5679 } | |
5680 } else { | 5690 } else { |
5681 CHECK_ALIVE(VisitForEffect(value)); | 5691 CHECK_ALIVE(VisitForEffect(value)); |
5682 } | 5692 } |
5683 break; | 5693 break; |
5684 } | 5694 } |
5685 // Fall through. | 5695 // Fall through. |
5686 case ObjectLiteral::Property::PROTOTYPE: | 5696 case ObjectLiteral::Property::PROTOTYPE: |
5687 case ObjectLiteral::Property::SETTER: | 5697 case ObjectLiteral::Property::SETTER: |
5688 case ObjectLiteral::Property::GETTER: | 5698 case ObjectLiteral::Property::GETTER: |
5689 return Bailout(kObjectLiteralWithComplexProperty); | 5699 return Bailout(kObjectLiteralWithComplexProperty); |
(...skipping 7039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12729 if (ShouldProduceTraceOutput()) { | 12739 if (ShouldProduceTraceOutput()) { |
12730 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12740 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12731 } | 12741 } |
12732 | 12742 |
12733 #ifdef DEBUG | 12743 #ifdef DEBUG |
12734 graph_->Verify(false); // No full verify. | 12744 graph_->Verify(false); // No full verify. |
12735 #endif | 12745 #endif |
12736 } | 12746 } |
12737 | 12747 |
12738 } } // namespace v8::internal | 12748 } } // namespace v8::internal |
OLD | NEW |