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

Side by Side Diff: src/hydrogen.cc

Issue 137783023: Add hydrogen support for ArrayPop, and remove the handwritten call stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/ia32/stub-cache-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 // 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 7596 matching lines...) Expand 10 before | Expand all | Expand 10 after
7607 if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) { 7607 if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) {
7608 AddCheckConstantFunction(expr->holder(), receiver, receiver_map); 7608 AddCheckConstantFunction(expr->holder(), receiver, receiver_map);
7609 HValue* right = Pop(); 7609 HValue* right = Pop();
7610 HValue* left = Pop(); 7610 HValue* left = Pop();
7611 Drop(1); // Receiver. 7611 Drop(1); // Receiver.
7612 HInstruction* result = HMul::NewImul(zone(), context(), left, right); 7612 HInstruction* result = HMul::NewImul(zone(), context(), left, right);
7613 ast_context()->ReturnInstruction(result, expr->id()); 7613 ast_context()->ReturnInstruction(result, expr->id());
7614 return true; 7614 return true;
7615 } 7615 }
7616 break; 7616 break;
7617 case kArrayPop: {
7618 if (!expr->IsMonomorphic() || expr->check_type() != RECEIVER_MAP_CHECK) {
7619 return false;
7620 }
7621 if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false;
7622 ElementsKind elements_kind = receiver_map->elements_kind();
7623 if (!IsFastElementsKind(elements_kind)) return false;
7624 AddCheckConstantFunction(expr->holder(), receiver, receiver_map);
7625
7626 Drop(expr->arguments()->length());
7627 HValue* result;
7628 HValue* checked_object;
7629 HValue* reduced_length;
7630 HValue* receiver = Pop();
7631 { NoObservableSideEffectsScope scope(this);
7632 checked_object = AddCheckMap(receiver, receiver_map);
7633 HValue* elements = AddLoadElements(checked_object);
7634 // Ensure that we aren't popping from a copy-on-write array.
7635 if (IsFastSmiOrObjectElementsKind(elements_kind)) {
7636 Add<HCheckMaps>(
7637 elements, isolate()->factory()->fixed_array_map(), top_info());
7638 }
7639 HValue* length = Add<HLoadNamedField>(
7640 checked_object, HObjectAccess::ForArrayLength(elements_kind));
7641 reduced_length = AddUncasted<HSub>(length, graph()->GetConstant1());
7642 HValue* bounds_check = Add<HBoundsCheck>(
7643 graph()->GetConstant0(), length);
7644 result = AddElementAccess(elements, reduced_length, NULL,
7645 bounds_check, elements_kind, false);
mvstanton 2014/01/20 12:45:39 Can we make the boolean parameter to AddElementAcc
Toon Verwaest 2014/01/20 13:28:09 Will do so. On 2014/01/20 12:45:39, mvstanton wro
7646 Factory* factory = isolate()->factory();
7647 double nan_double = FixedDoubleArray::hole_nan_as_double();
7648 HValue* hole = IsFastSmiOrObjectElementsKind(elements_kind)
7649 ? Add<HConstant>(factory->the_hole_value())
7650 : Add<HConstant>(nan_double);
7651 if (IsFastSmiOrObjectElementsKind(elements_kind)) {
7652 elements_kind = FAST_HOLEY_ELEMENTS;
mvstanton 2014/01/20 12:45:39 This line confuses me a bit. A) Why wouldn't the e
Toon Verwaest 2014/01/20 13:28:09 This is the standard way of storing holes into arr
7653 }
7654 AddElementAccess(
7655 elements, reduced_length, hole, bounds_check, elements_kind, true);
7656 }
7657 Add<HStoreNamedField>(
7658 checked_object, HObjectAccess::ForArrayLength(elements_kind),
7659 reduced_length);
7660 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE);
7661 ast_context()->ReturnValue(result);
7662 return true;
7663 }
7617 default: 7664 default:
7618 // Not yet supported for inlining. 7665 // Not yet supported for inlining.
7619 break; 7666 break;
7620 } 7667 }
7621 return false; 7668 return false;
7622 } 7669 }
7623 7670
7624 7671
7625 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) { 7672 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) {
7626 Expression* callee = expr->expression(); 7673 Expression* callee = expr->expression();
(...skipping 3379 matching lines...) Expand 10 before | Expand all | Expand 10 after
11006 if (ShouldProduceTraceOutput()) { 11053 if (ShouldProduceTraceOutput()) {
11007 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11054 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11008 } 11055 }
11009 11056
11010 #ifdef DEBUG 11057 #ifdef DEBUG
11011 graph_->Verify(false); // No full verify. 11058 graph_->Verify(false); // No full verify.
11012 #endif 11059 #endif
11013 } 11060 }
11014 11061
11015 } } // namespace v8::internal 11062 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698