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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 5284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5295 // The object is expected in the bailout environment during computation | 5295 // The object is expected in the bailout environment during computation |
5296 // of the property values and is the value of the entire expression. | 5296 // of the property values and is the value of the entire expression. |
5297 Push(literal); | 5297 Push(literal); |
5298 | 5298 |
5299 expr->CalculateEmitStore(zone()); | 5299 expr->CalculateEmitStore(zone()); |
5300 | 5300 |
5301 for (int i = 0; i < expr->properties()->length(); i++) { | 5301 for (int i = 0; i < expr->properties()->length(); i++) { |
5302 ObjectLiteral::Property* property = expr->properties()->at(i); | 5302 ObjectLiteral::Property* property = expr->properties()->at(i); |
5303 if (property->IsCompileTimeValue()) continue; | 5303 if (property->IsCompileTimeValue()) continue; |
5304 | 5304 |
5305 Literal* key = property->key(); | 5305 Literal* key = property->key()->AsLiteral(); |
5306 Expression* value = property->value(); | 5306 Expression* value = property->value(); |
5307 | 5307 |
5308 switch (property->kind()) { | 5308 switch (property->kind()) { |
5309 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 5309 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
5310 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); | 5310 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); |
5311 // Fall through. | 5311 // Fall through. |
5312 case ObjectLiteral::Property::COMPUTED: | 5312 case ObjectLiteral::Property::COMPUTED: |
5313 if (key->value()->IsInternalizedString()) { | 5313 if (key->value()->IsInternalizedString()) { |
5314 if (property->emit_store()) { | 5314 if (property->emit_store()) { |
5315 CHECK_ALIVE(VisitForValue(value)); | 5315 CHECK_ALIVE(VisitForValue(value)); |
5316 HValue* value = Pop(); | 5316 HValue* value = Pop(); |
5317 Handle<Map> map = property->GetReceiverType(); | 5317 Handle<Map> map = property->GetReceiverType(); |
5318 Handle<String> name = property->key()->AsPropertyName(); | 5318 Handle<String> name = key->AsPropertyName(); |
5319 HInstruction* store; | 5319 HInstruction* store; |
5320 if (map.is_null()) { | 5320 if (map.is_null()) { |
5321 // If we don't know the monomorphic type, do a generic store. | 5321 // If we don't know the monomorphic type, do a generic store. |
5322 CHECK_ALIVE(store = BuildNamedGeneric( | 5322 CHECK_ALIVE(store = BuildNamedGeneric( |
5323 STORE, literal, name, value)); | 5323 STORE, literal, name, value)); |
5324 } else { | 5324 } else { |
5325 PropertyAccessInfo info(this, STORE, ToType(map), name); | 5325 PropertyAccessInfo info(this, STORE, ToType(map), name); |
5326 if (info.CanAccessMonomorphic()) { | 5326 if (info.CanAccessMonomorphic()) { |
5327 HValue* checked_literal = Add<HCheckMaps>(literal, map); | 5327 HValue* checked_literal = Add<HCheckMaps>(literal, map); |
5328 ASSERT(!info.lookup()->IsPropertyCallbacks()); | 5328 ASSERT(!info.lookup()->IsPropertyCallbacks()); |
5329 store = BuildMonomorphicAccess( | 5329 store = BuildMonomorphicAccess( |
5330 &info, literal, checked_literal, value, | 5330 &info, literal, checked_literal, value, |
5331 BailoutId::None(), BailoutId::None()); | 5331 BailoutId::None(), BailoutId::None()); |
5332 } else { | 5332 } else { |
5333 CHECK_ALIVE(store = BuildNamedGeneric( | 5333 CHECK_ALIVE(store = BuildNamedGeneric( |
5334 STORE, literal, name, value)); | 5334 STORE, literal, name, value)); |
5335 } | 5335 } |
5336 } | 5336 } |
5337 AddInstruction(store); | 5337 AddInstruction(store); |
5338 if (store->HasObservableSideEffects()) { | 5338 if (store->HasObservableSideEffects()) { |
5339 Add<HSimulate>(key->id(), REMOVABLE_SIMULATE); | 5339 Add<HSimulate>(key->id(), REMOVABLE_SIMULATE); |
5340 } | 5340 } |
5341 } else { | 5341 } else { |
5342 CHECK_ALIVE(VisitForEffect(value)); | 5342 CHECK_ALIVE(VisitForEffect(value)); |
5343 } | 5343 } |
5344 break; | 5344 break; |
5345 } | 5345 } |
5346 // Fall through. | 5346 // Fall through. |
| 5347 case ObjectLiteral::Property::COMPUTED_NAME: |
5347 case ObjectLiteral::Property::PROTOTYPE: | 5348 case ObjectLiteral::Property::PROTOTYPE: |
5348 case ObjectLiteral::Property::SETTER: | 5349 case ObjectLiteral::Property::SETTER: |
5349 case ObjectLiteral::Property::GETTER: | 5350 case ObjectLiteral::Property::GETTER: |
5350 return Bailout(kObjectLiteralWithComplexProperty); | 5351 return Bailout(kObjectLiteralWithComplexProperty); |
5351 default: UNREACHABLE(); | 5352 default: UNREACHABLE(); |
5352 } | 5353 } |
5353 } | 5354 } |
5354 | 5355 |
5355 if (expr->has_function()) { | 5356 if (expr->has_function()) { |
5356 // Return the result of the transformation to fast properties | 5357 // Return the result of the transformation to fast properties |
(...skipping 6791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12148 if (ShouldProduceTraceOutput()) { | 12149 if (ShouldProduceTraceOutput()) { |
12149 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12150 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12150 } | 12151 } |
12151 | 12152 |
12152 #ifdef DEBUG | 12153 #ifdef DEBUG |
12153 graph_->Verify(false); // No full verify. | 12154 graph_->Verify(false); // No full verify. |
12154 #endif | 12155 #endif |
12155 } | 12156 } |
12156 | 12157 |
12157 } } // namespace v8::internal | 12158 } } // namespace v8::internal |
OLD | NEW |