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 <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 3338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3349 function_state_(NULL), | 3349 function_state_(NULL), |
3350 initial_function_state_(this, info, NORMAL_RETURN, 0), | 3350 initial_function_state_(this, info, NORMAL_RETURN, 0), |
3351 ast_context_(NULL), | 3351 ast_context_(NULL), |
3352 break_scope_(NULL), | 3352 break_scope_(NULL), |
3353 inlined_count_(0), | 3353 inlined_count_(0), |
3354 globals_(10, info->zone()), | 3354 globals_(10, info->zone()), |
3355 osr_(new(info->zone()) HOsrBuilder(this)) { | 3355 osr_(new(info->zone()) HOsrBuilder(this)) { |
3356 // This is not initialized in the initializer list because the | 3356 // This is not initialized in the initializer list because the |
3357 // constructor for the initial state relies on function_state_ == NULL | 3357 // constructor for the initial state relies on function_state_ == NULL |
3358 // to know it's the initial state. | 3358 // to know it's the initial state. |
3359 function_state_= &initial_function_state_; | 3359 function_state_ = &initial_function_state_; |
3360 InitializeAstVisitor(info->zone()); | 3360 InitializeAstVisitor(info->zone()); |
3361 if (FLAG_hydrogen_track_positions) { | 3361 if (FLAG_hydrogen_track_positions) { |
3362 SetSourcePosition(info->shared_info()->start_position()); | 3362 SetSourcePosition(info->shared_info()->start_position()); |
3363 } | 3363 } |
3364 } | 3364 } |
3365 | 3365 |
3366 | 3366 |
3367 HBasicBlock* HOptimizedGraphBuilder::CreateJoin(HBasicBlock* first, | 3367 HBasicBlock* HOptimizedGraphBuilder::CreateJoin(HBasicBlock* first, |
3368 HBasicBlock* second, | 3368 HBasicBlock* second, |
3369 BailoutId join_id) { | 3369 BailoutId join_id) { |
(...skipping 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 4663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10338 shr = HShr::cast(left); | 10341 shr = HShr::cast(left); |
10339 } else { | 10342 } else { |
10340 return false; | 10343 return false; |
10341 } | 10344 } |
10342 if (shl->left() != shr->left()) return false; | 10345 if (shl->left() != shr->left()) return false; |
10343 | 10346 |
10344 if (!ShiftAmountsAllowReplaceByRotate(shl->right(), shr->right()) && | 10347 if (!ShiftAmountsAllowReplaceByRotate(shl->right(), shr->right()) && |
10345 !ShiftAmountsAllowReplaceByRotate(shr->right(), shl->right())) { | 10348 !ShiftAmountsAllowReplaceByRotate(shr->right(), shl->right())) { |
10346 return false; | 10349 return false; |
10347 } | 10350 } |
10348 *operand= shr->left(); | 10351 *operand = shr->left(); |
10349 *shift_amount = shr->right(); | 10352 *shift_amount = shr->right(); |
10350 return true; | 10353 return true; |
10351 } | 10354 } |
10352 | 10355 |
10353 | 10356 |
10354 bool CanBeZero(HValue* right) { | 10357 bool CanBeZero(HValue* right) { |
10355 if (right->IsConstant()) { | 10358 if (right->IsConstant()) { |
10356 HConstant* right_const = HConstant::cast(right); | 10359 HConstant* right_const = HConstant::cast(right); |
10357 if (right_const->HasInteger32Value() && | 10360 if (right_const->HasInteger32Value() && |
10358 (right_const->Integer32Value() & 0x1f) != 0) { | 10361 (right_const->Integer32Value() & 0x1f) != 0) { |
(...skipping 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13364 if (ShouldProduceTraceOutput()) { | 13367 if (ShouldProduceTraceOutput()) { |
13365 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13368 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13366 } | 13369 } |
13367 | 13370 |
13368 #ifdef DEBUG | 13371 #ifdef DEBUG |
13369 graph_->Verify(false); // No full verify. | 13372 graph_->Verify(false); // No full verify. |
13370 #endif | 13373 #endif |
13371 } | 13374 } |
13372 | 13375 |
13373 } } // namespace v8::internal | 13376 } } // namespace v8::internal |
OLD | NEW |