| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 7595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7606 if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) { | 7606 if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) { |
| 7607 AddCheckConstantFunction(expr->holder(), receiver, receiver_map); | 7607 AddCheckConstantFunction(expr->holder(), receiver, receiver_map); |
| 7608 HValue* right = Pop(); | 7608 HValue* right = Pop(); |
| 7609 HValue* left = Pop(); | 7609 HValue* left = Pop(); |
| 7610 Drop(1); // Receiver. | 7610 Drop(1); // Receiver. |
| 7611 HInstruction* result = HMul::NewImul(zone(), context(), left, right); | 7611 HInstruction* result = HMul::NewImul(zone(), context(), left, right); |
| 7612 ast_context()->ReturnInstruction(result, expr->id()); | 7612 ast_context()->ReturnInstruction(result, expr->id()); |
| 7613 return true; | 7613 return true; |
| 7614 } | 7614 } |
| 7615 break; | 7615 break; |
| 7616 case kArrayPop: { | |
| 7617 if (!expr->IsMonomorphic() || expr->check_type() != RECEIVER_MAP_CHECK) { | |
| 7618 return false; | |
| 7619 } | |
| 7620 if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false; | |
| 7621 ElementsKind elements_kind = receiver_map->elements_kind(); | |
| 7622 if (!IsFastElementsKind(elements_kind)) return false; | |
| 7623 AddCheckConstantFunction(expr->holder(), receiver, receiver_map); | |
| 7624 | |
| 7625 Drop(expr->arguments()->length()); | |
| 7626 HValue* result; | |
| 7627 HValue* checked_object; | |
| 7628 HValue* reduced_length; | |
| 7629 HValue* receiver = Pop(); | |
| 7630 { NoObservableSideEffectsScope scope(this); | |
| 7631 checked_object = AddCheckMap(receiver, receiver_map); | |
| 7632 HValue* elements = AddLoadElements(checked_object); | |
| 7633 // Ensure that we aren't popping from a copy-on-write array. | |
| 7634 if (IsFastSmiOrObjectElementsKind(elements_kind)) { | |
| 7635 Add<HCheckMaps>( | |
| 7636 elements, isolate()->factory()->fixed_array_map(), top_info()); | |
| 7637 } | |
| 7638 HValue* length = Add<HLoadNamedField>( | |
| 7639 checked_object, HObjectAccess::ForArrayLength(elements_kind)); | |
| 7640 reduced_length = AddUncasted<HSub>(length, graph()->GetConstant1()); | |
| 7641 HValue* bounds_check = Add<HBoundsCheck>( | |
| 7642 graph()->GetConstant0(), length); | |
| 7643 result = AddElementAccess(elements, reduced_length, NULL, | |
| 7644 bounds_check, elements_kind, false); | |
| 7645 Factory* factory = isolate()->factory(); | |
| 7646 double nan_double = FixedDoubleArray::hole_nan_as_double(); | |
| 7647 HValue* hole = IsFastSmiOrObjectElementsKind(elements_kind) | |
| 7648 ? Add<HConstant>(factory->the_hole_value()) | |
| 7649 : Add<HConstant>(nan_double); | |
| 7650 if (IsFastSmiOrObjectElementsKind(elements_kind)) { | |
| 7651 elements_kind = FAST_HOLEY_ELEMENTS; | |
| 7652 } | |
| 7653 AddElementAccess( | |
| 7654 elements, reduced_length, hole, bounds_check, elements_kind, true); | |
| 7655 } | |
| 7656 Add<HStoreNamedField>( | |
| 7657 checked_object, HObjectAccess::ForArrayLength(elements_kind), | |
| 7658 reduced_length); | |
| 7659 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); | |
| 7660 ast_context()->ReturnValue(result); | |
| 7661 return true; | |
| 7662 } | |
| 7663 default: | 7616 default: |
| 7664 // Not yet supported for inlining. | 7617 // Not yet supported for inlining. |
| 7665 break; | 7618 break; |
| 7666 } | 7619 } |
| 7667 return false; | 7620 return false; |
| 7668 } | 7621 } |
| 7669 | 7622 |
| 7670 | 7623 |
| 7671 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) { | 7624 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) { |
| 7672 Expression* callee = expr->expression(); | 7625 Expression* callee = expr->expression(); |
| (...skipping 3377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11050 if (ShouldProduceTraceOutput()) { | 11003 if (ShouldProduceTraceOutput()) { |
| 11051 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11004 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11052 } | 11005 } |
| 11053 | 11006 |
| 11054 #ifdef DEBUG | 11007 #ifdef DEBUG |
| 11055 graph_->Verify(false); // No full verify. | 11008 graph_->Verify(false); // No full verify. |
| 11056 #endif | 11009 #endif |
| 11057 } | 11010 } |
| 11058 | 11011 |
| 11059 } } // namespace v8::internal | 11012 } } // namespace v8::internal |
| OLD | NEW |