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

Side by Side Diff: src/hydrogen.cc

Issue 798243004: ES6 computed property names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable test on windows Created 5 years, 11 months 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 5547 matching lines...) Expand 10 before | Expand all | Expand 10 after
5558 } 5558 }
5559 } 5559 }
5560 return true; 5560 return true;
5561 } 5561 }
5562 5562
5563 5563
5564 void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { 5564 void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
5565 DCHECK(!HasStackOverflow()); 5565 DCHECK(!HasStackOverflow());
5566 DCHECK(current_block() != NULL); 5566 DCHECK(current_block() != NULL);
5567 DCHECK(current_block()->HasPredecessor()); 5567 DCHECK(current_block()->HasPredecessor());
5568
5568 expr->BuildConstantProperties(isolate()); 5569 expr->BuildConstantProperties(isolate());
5569 Handle<JSFunction> closure = function_state()->compilation_info()->closure(); 5570 Handle<JSFunction> closure = function_state()->compilation_info()->closure();
5570 HInstruction* literal; 5571 HInstruction* literal;
5571 5572
5572 // Check whether to use fast or slow deep-copying for boilerplate. 5573 // Check whether to use fast or slow deep-copying for boilerplate.
5573 int max_properties = kMaxFastLiteralProperties; 5574 int max_properties = kMaxFastLiteralProperties;
5574 Handle<Object> literals_cell(closure->literals()->get(expr->literal_index()), 5575 Handle<Object> literals_cell(closure->literals()->get(expr->literal_index()),
5575 isolate()); 5576 isolate());
5576 Handle<AllocationSite> site; 5577 Handle<AllocationSite> site;
5577 Handle<JSObject> boilerplate; 5578 Handle<JSObject> boilerplate;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5613 } 5614 }
5614 5615
5615 // The object is expected in the bailout environment during computation 5616 // The object is expected in the bailout environment during computation
5616 // of the property values and is the value of the entire expression. 5617 // of the property values and is the value of the entire expression.
5617 Push(literal); 5618 Push(literal);
5618 5619
5619 expr->CalculateEmitStore(zone()); 5620 expr->CalculateEmitStore(zone());
5620 5621
5621 for (int i = 0; i < expr->properties()->length(); i++) { 5622 for (int i = 0; i < expr->properties()->length(); i++) {
5622 ObjectLiteral::Property* property = expr->properties()->at(i); 5623 ObjectLiteral::Property* property = expr->properties()->at(i);
5624 if (property->is_computed_name()) return Bailout(kComputedPropertyName);
5623 if (property->IsCompileTimeValue()) continue; 5625 if (property->IsCompileTimeValue()) continue;
5624 5626
5625 Literal* key = property->key(); 5627 Literal* key = property->key()->AsLiteral();
5626 Expression* value = property->value(); 5628 Expression* value = property->value();
5627 5629
5628 switch (property->kind()) { 5630 switch (property->kind()) {
5629 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 5631 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
5630 DCHECK(!CompileTimeValue::IsCompileTimeValue(value)); 5632 DCHECK(!CompileTimeValue::IsCompileTimeValue(value));
5631 // Fall through. 5633 // Fall through.
5632 case ObjectLiteral::Property::COMPUTED: 5634 case ObjectLiteral::Property::COMPUTED:
5633 // It is safe to use [[Put]] here because the boilerplate already 5635 // It is safe to use [[Put]] here because the boilerplate already
5634 // contains computed properties with an uninitialized value. 5636 // contains computed properties with an uninitialized value.
5635 if (key->value()->IsInternalizedString()) { 5637 if (key->value()->IsInternalizedString()) {
5636 if (property->emit_store()) { 5638 if (property->emit_store()) {
5637 CHECK_ALIVE(VisitForValue(value)); 5639 CHECK_ALIVE(VisitForValue(value));
5638 HValue* value = Pop(); 5640 HValue* value = Pop();
5639 5641
5640 // Add [[HomeObject]] to function literals. 5642 // Add [[HomeObject]] to function literals.
5641 if (FunctionLiteral::NeedsHomeObject(property->value())) { 5643 if (FunctionLiteral::NeedsHomeObject(property->value())) {
5642 Handle<Symbol> sym = isolate()->factory()->home_object_symbol(); 5644 Handle<Symbol> sym = isolate()->factory()->home_object_symbol();
5643 HInstruction* store_home = BuildKeyedGeneric( 5645 HInstruction* store_home = BuildKeyedGeneric(
5644 STORE, NULL, value, Add<HConstant>(sym), literal); 5646 STORE, NULL, value, Add<HConstant>(sym), literal);
5645 AddInstruction(store_home); 5647 AddInstruction(store_home);
5646 DCHECK(store_home->HasObservableSideEffects()); 5648 DCHECK(store_home->HasObservableSideEffects());
5647 Add<HSimulate>(property->value()->id(), REMOVABLE_SIMULATE); 5649 Add<HSimulate>(property->value()->id(), REMOVABLE_SIMULATE);
5648 } 5650 }
5649 5651
5650 Handle<Map> map = property->GetReceiverType(); 5652 Handle<Map> map = property->GetReceiverType();
5651 Handle<String> name = property->key()->AsPropertyName(); 5653 Handle<String> name = key->AsPropertyName();
5652 HInstruction* store; 5654 HInstruction* store;
5653 if (map.is_null()) { 5655 if (map.is_null()) {
5654 // If we don't know the monomorphic type, do a generic store. 5656 // If we don't know the monomorphic type, do a generic store.
5655 CHECK_ALIVE(store = BuildNamedGeneric( 5657 CHECK_ALIVE(store = BuildNamedGeneric(
5656 STORE, NULL, literal, name, value)); 5658 STORE, NULL, literal, name, value));
5657 } else { 5659 } else {
5658 PropertyAccessInfo info(this, STORE, ToType(map), name); 5660 PropertyAccessInfo info(this, STORE, ToType(map), name);
5659 if (info.CanAccessMonomorphic()) { 5661 if (info.CanAccessMonomorphic()) {
5660 HValue* checked_literal = Add<HCheckMaps>(literal, map); 5662 HValue* checked_literal = Add<HCheckMaps>(literal, map);
5661 DCHECK(!info.IsAccessor()); 5663 DCHECK(!info.IsAccessor());
(...skipping 7786 matching lines...) Expand 10 before | Expand all | Expand 10 after
13448 if (ShouldProduceTraceOutput()) { 13450 if (ShouldProduceTraceOutput()) {
13449 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13451 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13450 } 13452 }
13451 13453
13452 #ifdef DEBUG 13454 #ifdef DEBUG
13453 graph_->Verify(false); // No full verify. 13455 graph_->Verify(false); // No full verify.
13454 #endif 13456 #endif
13455 } 13457 }
13456 13458
13457 } } // namespace v8::internal 13459 } } // 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