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 811593004: Revert of 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
« 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 5534 matching lines...) Expand 10 before | Expand all | Expand 10 after
5545 } 5545 }
5546 } 5546 }
5547 return true; 5547 return true;
5548 } 5548 }
5549 5549
5550 5550
5551 void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { 5551 void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
5552 DCHECK(!HasStackOverflow()); 5552 DCHECK(!HasStackOverflow());
5553 DCHECK(current_block() != NULL); 5553 DCHECK(current_block() != NULL);
5554 DCHECK(current_block()->HasPredecessor()); 5554 DCHECK(current_block()->HasPredecessor());
5555
5556 for (int i = 0; i < expr->properties()->length(); i++) {
5557 if (expr->properties()->at(i)->is_computed_name()) {
5558 return Bailout(kComputedPropertyName);
5559 }
5560 }
5561
5562 expr->BuildConstantProperties(isolate()); 5555 expr->BuildConstantProperties(isolate());
5563 Handle<JSFunction> closure = function_state()->compilation_info()->closure(); 5556 Handle<JSFunction> closure = function_state()->compilation_info()->closure();
5564 HInstruction* literal; 5557 HInstruction* literal;
5565 5558
5566 // Check whether to use fast or slow deep-copying for boilerplate. 5559 // Check whether to use fast or slow deep-copying for boilerplate.
5567 int max_properties = kMaxFastLiteralProperties; 5560 int max_properties = kMaxFastLiteralProperties;
5568 Handle<Object> literals_cell(closure->literals()->get(expr->literal_index()), 5561 Handle<Object> literals_cell(closure->literals()->get(expr->literal_index()),
5569 isolate()); 5562 isolate());
5570 Handle<AllocationSite> site; 5563 Handle<AllocationSite> site;
5571 Handle<JSObject> boilerplate; 5564 Handle<JSObject> boilerplate;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5607 } 5600 }
5608 5601
5609 // The object is expected in the bailout environment during computation 5602 // The object is expected in the bailout environment during computation
5610 // 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.
5611 Push(literal); 5604 Push(literal);
5612 5605
5613 expr->CalculateEmitStore(zone()); 5606 expr->CalculateEmitStore(zone());
5614 5607
5615 for (int i = 0; i < expr->properties()->length(); i++) { 5608 for (int i = 0; i < expr->properties()->length(); i++) {
5616 ObjectLiteral::Property* property = expr->properties()->at(i); 5609 ObjectLiteral::Property* property = expr->properties()->at(i);
5617 DCHECK(!property->is_computed_name());
5618 if (property->IsCompileTimeValue()) continue; 5610 if (property->IsCompileTimeValue()) continue;
5619 5611
5620 Literal* key = property->key()->AsLiteral(); 5612 Literal* key = property->key();
5621 Expression* value = property->value(); 5613 Expression* value = property->value();
5622 5614
5623 switch (property->kind()) { 5615 switch (property->kind()) {
5624 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 5616 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
5625 DCHECK(!CompileTimeValue::IsCompileTimeValue(value)); 5617 DCHECK(!CompileTimeValue::IsCompileTimeValue(value));
5626 // Fall through. 5618 // Fall through.
5627 case ObjectLiteral::Property::COMPUTED: 5619 case ObjectLiteral::Property::COMPUTED:
5628 // It is safe to use [[Put]] here because the boilerplate already 5620 // It is safe to use [[Put]] here because the boilerplate already
5629 // contains computed properties with an uninitialized value. 5621 // contains computed properties with an uninitialized value.
5630 if (key->value()->IsInternalizedString()) { 5622 if (key->value()->IsInternalizedString()) {
5631 if (property->emit_store()) { 5623 if (property->emit_store()) {
5632 CHECK_ALIVE(VisitForValue(value)); 5624 CHECK_ALIVE(VisitForValue(value));
5633 HValue* value = Pop(); 5625 HValue* value = Pop();
5634 5626
5635 // Add [[HomeObject]] to function literals. 5627 // Add [[HomeObject]] to function literals.
5636 if (FunctionLiteral::NeedsHomeObject(property->value())) { 5628 if (FunctionLiteral::NeedsHomeObject(property->value())) {
5637 Handle<Symbol> sym = isolate()->factory()->home_object_symbol(); 5629 Handle<Symbol> sym = isolate()->factory()->home_object_symbol();
5638 HInstruction* store_home = BuildKeyedGeneric( 5630 HInstruction* store_home = BuildKeyedGeneric(
5639 STORE, NULL, value, Add<HConstant>(sym), literal); 5631 STORE, NULL, value, Add<HConstant>(sym), literal);
5640 AddInstruction(store_home); 5632 AddInstruction(store_home);
5641 DCHECK(store_home->HasObservableSideEffects()); 5633 DCHECK(store_home->HasObservableSideEffects());
5642 Add<HSimulate>(property->value()->id(), REMOVABLE_SIMULATE); 5634 Add<HSimulate>(property->value()->id(), REMOVABLE_SIMULATE);
5643 } 5635 }
5644 5636
5645 Handle<Map> map = property->GetReceiverType(); 5637 Handle<Map> map = property->GetReceiverType();
5646 Handle<String> name = key->AsPropertyName(); 5638 Handle<String> name = property->key()->AsPropertyName();
5647 HInstruction* store; 5639 HInstruction* store;
5648 if (map.is_null()) { 5640 if (map.is_null()) {
5649 // 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.
5650 CHECK_ALIVE(store = BuildNamedGeneric( 5642 CHECK_ALIVE(store = BuildNamedGeneric(
5651 STORE, NULL, literal, name, value)); 5643 STORE, NULL, literal, name, value));
5652 } else { 5644 } else {
5653 PropertyAccessInfo info(this, STORE, ToType(map), name); 5645 PropertyAccessInfo info(this, STORE, ToType(map), name);
5654 if (info.CanAccessMonomorphic()) { 5646 if (info.CanAccessMonomorphic()) {
5655 HValue* checked_literal = Add<HCheckMaps>(literal, map); 5647 HValue* checked_literal = Add<HCheckMaps>(literal, map);
5656 DCHECK(!info.IsAccessor()); 5648 DCHECK(!info.IsAccessor());
(...skipping 7786 matching lines...) Expand 10 before | Expand all | Expand 10 after
13443 if (ShouldProduceTraceOutput()) { 13435 if (ShouldProduceTraceOutput()) {
13444 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13436 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13445 } 13437 }
13446 13438
13447 #ifdef DEBUG 13439 #ifdef DEBUG
13448 graph_->Verify(false); // No full verify. 13440 graph_->Verify(false); // No full verify.
13449 #endif 13441 #endif
13450 } 13442 }
13451 13443
13452 } } // namespace v8::internal 13444 } } // 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