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

Side by Side Diff: src/hydrogen.cc

Issue 807173002: ES6 computed property names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/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
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 }
5610 if (property->IsCompileTimeValue()) continue; 5613 if (property->IsCompileTimeValue()) continue;
5611 5614
5612 Literal* key = property->key(); 5615 Literal* key = property->key()->AsLiteral();
5613 Expression* value = property->value(); 5616 Expression* value = property->value();
5614 5617
5615 switch (property->kind()) { 5618 switch (property->kind()) {
5616 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 5619 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
5617 DCHECK(!CompileTimeValue::IsCompileTimeValue(value)); 5620 DCHECK(!CompileTimeValue::IsCompileTimeValue(value));
5618 // Fall through. 5621 // Fall through.
5619 case ObjectLiteral::Property::COMPUTED: 5622 case ObjectLiteral::Property::COMPUTED:
5620 // It is safe to use [[Put]] here because the boilerplate already 5623 // It is safe to use [[Put]] here because the boilerplate already
5621 // contains computed properties with an uninitialized value. 5624 // contains computed properties with an uninitialized value.
5622 if (key->value()->IsInternalizedString()) { 5625 if (key->value()->IsInternalizedString()) {
5623 if (property->emit_store()) { 5626 if (property->emit_store()) {
5624 CHECK_ALIVE(VisitForValue(value)); 5627 CHECK_ALIVE(VisitForValue(value));
5625 HValue* value = Pop(); 5628 HValue* value = Pop();
5626 5629
5627 // Add [[HomeObject]] to function literals. 5630 // Add [[HomeObject]] to function literals.
5628 if (FunctionLiteral::NeedsHomeObject(property->value())) { 5631 if (FunctionLiteral::NeedsHomeObject(property->value())) {
5629 Handle<Symbol> sym = isolate()->factory()->home_object_symbol(); 5632 Handle<Symbol> sym = isolate()->factory()->home_object_symbol();
5630 HInstruction* store_home = BuildKeyedGeneric( 5633 HInstruction* store_home = BuildKeyedGeneric(
5631 STORE, NULL, value, Add<HConstant>(sym), literal); 5634 STORE, NULL, value, Add<HConstant>(sym), literal);
5632 AddInstruction(store_home); 5635 AddInstruction(store_home);
5633 DCHECK(store_home->HasObservableSideEffects()); 5636 DCHECK(store_home->HasObservableSideEffects());
5634 Add<HSimulate>(property->value()->id(), REMOVABLE_SIMULATE); 5637 Add<HSimulate>(property->value()->id(), REMOVABLE_SIMULATE);
5635 } 5638 }
5636 5639
5637 Handle<Map> map = property->GetReceiverType(); 5640 Handle<Map> map = property->GetReceiverType();
5638 Handle<String> name = property->key()->AsPropertyName(); 5641 Handle<String> name = key->AsPropertyName();
5639 HInstruction* store; 5642 HInstruction* store;
5640 if (map.is_null()) { 5643 if (map.is_null()) {
5641 // If we don't know the monomorphic type, do a generic store. 5644 // If we don't know the monomorphic type, do a generic store.
5642 CHECK_ALIVE(store = BuildNamedGeneric( 5645 CHECK_ALIVE(store = BuildNamedGeneric(
5643 STORE, NULL, literal, name, value)); 5646 STORE, NULL, literal, name, value));
5644 } else { 5647 } else {
5645 PropertyAccessInfo info(this, STORE, ToType(map), name); 5648 PropertyAccessInfo info(this, STORE, ToType(map), name);
5646 if (info.CanAccessMonomorphic()) { 5649 if (info.CanAccessMonomorphic()) {
5647 HValue* checked_literal = Add<HCheckMaps>(literal, map); 5650 HValue* checked_literal = Add<HCheckMaps>(literal, map);
5648 DCHECK(!info.IsAccessor()); 5651 DCHECK(!info.IsAccessor());
(...skipping 7786 matching lines...) Expand 10 before | Expand all | Expand 10 after
13435 if (ShouldProduceTraceOutput()) { 13438 if (ShouldProduceTraceOutput()) {
13436 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13439 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13437 } 13440 }
13438 13441
13439 #ifdef DEBUG 13442 #ifdef DEBUG
13440 graph_->Verify(false); // No full verify. 13443 graph_->Verify(false); // No full verify.
13441 #endif 13444 #endif
13442 } 13445 }
13443 13446
13444 } } // namespace v8::internal 13447 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698