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

Side by Side Diff: src/hydrogen.cc

Issue 795573005: ES6 computed property names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup tests a bit 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
« no previous file with comments | « src/full-codegen.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5615 matching lines...) Expand 10 before | Expand all | Expand 10 after
5626 } 5626 }
5627 5627
5628 // The object is expected in the bailout environment during computation 5628 // The object is expected in the bailout environment during computation
5629 // of the property values and is the value of the entire expression. 5629 // of the property values and is the value of the entire expression.
5630 Push(literal); 5630 Push(literal);
5631 5631
5632 expr->CalculateEmitStore(zone()); 5632 expr->CalculateEmitStore(zone());
5633 5633
5634 for (int i = 0; i < expr->properties()->length(); i++) { 5634 for (int i = 0; i < expr->properties()->length(); i++) {
5635 ObjectLiteral::Property* property = expr->properties()->at(i); 5635 ObjectLiteral::Property* property = expr->properties()->at(i);
5636 if (property->is_computed_name()) {
5637 return Bailout(kComputedPropertyName);
5638 }
5636 if (property->IsCompileTimeValue()) continue; 5639 if (property->IsCompileTimeValue()) continue;
5637 5640
5638 Literal* key = property->key(); 5641 Literal* key = property->key()->AsLiteral();
5639 Expression* value = property->value(); 5642 Expression* value = property->value();
5640 5643
5641 switch (property->kind()) { 5644 switch (property->kind()) {
5642 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 5645 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
5643 DCHECK(!CompileTimeValue::IsCompileTimeValue(value)); 5646 DCHECK(!CompileTimeValue::IsCompileTimeValue(value));
5644 // Fall through. 5647 // Fall through.
5645 case ObjectLiteral::Property::COMPUTED: 5648 case ObjectLiteral::Property::COMPUTED:
5646 // It is safe to use [[Put]] here because the boilerplate already 5649 // It is safe to use [[Put]] here because the boilerplate already
5647 // contains computed properties with an uninitialized value. 5650 // contains computed properties with an uninitialized value.
5648 if (key->value()->IsInternalizedString()) { 5651 if (key->value()->IsInternalizedString()) {
5649 if (property->emit_store()) { 5652 if (property->emit_store()) {
5650 CHECK_ALIVE(VisitForValue(value)); 5653 CHECK_ALIVE(VisitForValue(value));
5651 HValue* value = Pop(); 5654 HValue* value = Pop();
5652 5655
5653 // Add [[HomeObject]] to function literals. 5656 // Add [[HomeObject]] to function literals.
5654 if (FunctionLiteral::NeedsHomeObject(property->value())) { 5657 if (FunctionLiteral::NeedsHomeObject(property->value())) {
5655 Handle<Symbol> sym = isolate()->factory()->home_object_symbol(); 5658 Handle<Symbol> sym = isolate()->factory()->home_object_symbol();
5656 HInstruction* store_home = BuildKeyedGeneric( 5659 HInstruction* store_home = BuildKeyedGeneric(
5657 STORE, NULL, value, Add<HConstant>(sym), literal); 5660 STORE, NULL, value, Add<HConstant>(sym), literal);
5658 AddInstruction(store_home); 5661 AddInstruction(store_home);
5659 DCHECK(store_home->HasObservableSideEffects()); 5662 DCHECK(store_home->HasObservableSideEffects());
5660 Add<HSimulate>(property->value()->id(), REMOVABLE_SIMULATE); 5663 Add<HSimulate>(property->value()->id(), REMOVABLE_SIMULATE);
5661 } 5664 }
5662 5665
5663 Handle<Map> map = property->GetReceiverType(); 5666 Handle<Map> map = property->GetReceiverType();
5664 Handle<String> name = property->key()->AsPropertyName(); 5667 Handle<String> name = key->AsPropertyName();
5665 HInstruction* store; 5668 HInstruction* store;
5666 if (map.is_null()) { 5669 if (map.is_null()) {
5667 // If we don't know the monomorphic type, do a generic store. 5670 // If we don't know the monomorphic type, do a generic store.
5668 CHECK_ALIVE(store = BuildNamedGeneric( 5671 CHECK_ALIVE(store = BuildNamedGeneric(
5669 STORE, NULL, literal, name, value)); 5672 STORE, NULL, literal, name, value));
5670 } else { 5673 } else {
5671 PropertyAccessInfo info(this, STORE, ToType(map), name); 5674 PropertyAccessInfo info(this, STORE, ToType(map), name);
5672 if (info.CanAccessMonomorphic()) { 5675 if (info.CanAccessMonomorphic()) {
5673 HValue* checked_literal = Add<HCheckMaps>(literal, map); 5676 HValue* checked_literal = Add<HCheckMaps>(literal, map);
5674 DCHECK(!info.IsAccessor()); 5677 DCHECK(!info.IsAccessor());
(...skipping 7816 matching lines...) Expand 10 before | Expand all | Expand 10 after
13491 if (ShouldProduceTraceOutput()) { 13494 if (ShouldProduceTraceOutput()) {
13492 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13495 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13493 } 13496 }
13494 13497
13495 #ifdef DEBUG 13498 #ifdef DEBUG
13496 graph_->Verify(false); // No full verify. 13499 graph_->Verify(false); // No full verify.
13497 #endif 13500 #endif
13498 } 13501 }
13499 13502
13500 } } // namespace v8::internal 13503 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698