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 5589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5600 } | 5600 } |
5601 | 5601 |
5602 // The object is expected in the bailout environment during computation | 5602 // The object is expected in the bailout environment during computation |
5603 // of the property values and is the value of the entire expression. | 5603 // of the property values and is the value of the entire expression. |
5604 Push(literal); | 5604 Push(literal); |
5605 | 5605 |
5606 expr->CalculateEmitStore(zone()); | 5606 expr->CalculateEmitStore(zone()); |
5607 | 5607 |
5608 for (int i = 0; i < expr->properties()->length(); i++) { | 5608 for (int i = 0; i < expr->properties()->length(); i++) { |
5609 ObjectLiteral::Property* property = expr->properties()->at(i); | 5609 ObjectLiteral::Property* property = expr->properties()->at(i); |
5610 if (property->is_computed_name()) { | |
5611 return Bailout(kComputedPropertyName); | |
5612 } | |
5613 if (property->IsCompileTimeValue()) continue; | 5610 if (property->IsCompileTimeValue()) continue; |
5614 | 5611 |
5615 Literal* key = property->key()->AsLiteral(); | 5612 Literal* key = property->key(); |
5616 Expression* value = property->value(); | 5613 Expression* value = property->value(); |
5617 | 5614 |
5618 switch (property->kind()) { | 5615 switch (property->kind()) { |
5619 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 5616 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
5620 DCHECK(!CompileTimeValue::IsCompileTimeValue(value)); | 5617 DCHECK(!CompileTimeValue::IsCompileTimeValue(value)); |
5621 // Fall through. | 5618 // Fall through. |
5622 case ObjectLiteral::Property::COMPUTED: | 5619 case ObjectLiteral::Property::COMPUTED: |
5623 // It is safe to use [[Put]] here because the boilerplate already | 5620 // It is safe to use [[Put]] here because the boilerplate already |
5624 // contains computed properties with an uninitialized value. | 5621 // contains computed properties with an uninitialized value. |
5625 if (key->value()->IsInternalizedString()) { | 5622 if (key->value()->IsInternalizedString()) { |
5626 if (property->emit_store()) { | 5623 if (property->emit_store()) { |
5627 CHECK_ALIVE(VisitForValue(value)); | 5624 CHECK_ALIVE(VisitForValue(value)); |
5628 HValue* value = Pop(); | 5625 HValue* value = Pop(); |
5629 | 5626 |
5630 // Add [[HomeObject]] to function literals. | 5627 // Add [[HomeObject]] to function literals. |
5631 if (FunctionLiteral::NeedsHomeObject(property->value())) { | 5628 if (FunctionLiteral::NeedsHomeObject(property->value())) { |
5632 Handle<Symbol> sym = isolate()->factory()->home_object_symbol(); | 5629 Handle<Symbol> sym = isolate()->factory()->home_object_symbol(); |
5633 HInstruction* store_home = BuildKeyedGeneric( | 5630 HInstruction* store_home = BuildKeyedGeneric( |
5634 STORE, NULL, value, Add<HConstant>(sym), literal); | 5631 STORE, NULL, value, Add<HConstant>(sym), literal); |
5635 AddInstruction(store_home); | 5632 AddInstruction(store_home); |
5636 DCHECK(store_home->HasObservableSideEffects()); | 5633 DCHECK(store_home->HasObservableSideEffects()); |
5637 Add<HSimulate>(property->value()->id(), REMOVABLE_SIMULATE); | 5634 Add<HSimulate>(property->value()->id(), REMOVABLE_SIMULATE); |
5638 } | 5635 } |
5639 | 5636 |
5640 Handle<Map> map = property->GetReceiverType(); | 5637 Handle<Map> map = property->GetReceiverType(); |
5641 Handle<String> name = key->AsPropertyName(); | 5638 Handle<String> name = property->key()->AsPropertyName(); |
5642 HInstruction* store; | 5639 HInstruction* store; |
5643 if (map.is_null()) { | 5640 if (map.is_null()) { |
5644 // If we don't know the monomorphic type, do a generic store. | 5641 // If we don't know the monomorphic type, do a generic store. |
5645 CHECK_ALIVE(store = BuildNamedGeneric( | 5642 CHECK_ALIVE(store = BuildNamedGeneric( |
5646 STORE, NULL, literal, name, value)); | 5643 STORE, NULL, literal, name, value)); |
5647 } else { | 5644 } else { |
5648 PropertyAccessInfo info(this, STORE, ToType(map), name); | 5645 PropertyAccessInfo info(this, STORE, ToType(map), name); |
5649 if (info.CanAccessMonomorphic()) { | 5646 if (info.CanAccessMonomorphic()) { |
5650 HValue* checked_literal = Add<HCheckMaps>(literal, map); | 5647 HValue* checked_literal = Add<HCheckMaps>(literal, map); |
5651 DCHECK(!info.IsAccessor()); | 5648 DCHECK(!info.IsAccessor()); |
(...skipping 7786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13438 if (ShouldProduceTraceOutput()) { | 13435 if (ShouldProduceTraceOutput()) { |
13439 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13436 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13440 } | 13437 } |
13441 | 13438 |
13442 #ifdef DEBUG | 13439 #ifdef DEBUG |
13443 graph_->Verify(false); // No full verify. | 13440 graph_->Verify(false); // No full verify. |
13444 #endif | 13441 #endif |
13445 } | 13442 } |
13446 | 13443 |
13447 } } // namespace v8::internal | 13444 } } // namespace v8::internal |
OLD | NEW |