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

Side by Side Diff: src/hydrogen.cc

Issue 144913003: Reland (and fix) "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 7595 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ast_context()->ReturnValue(result);
7660 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE);
Jakob Kummerow 2014/01/24 08:34:46 This line causes a NULL deref every time it is exe
7661 return true;
7662 }
7616 default: 7663 default:
7617 // Not yet supported for inlining. 7664 // Not yet supported for inlining.
7618 break; 7665 break;
7619 } 7666 }
7620 return false; 7667 return false;
7621 } 7668 }
7622 7669
7623 7670
7624 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) { 7671 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) {
7625 Expression* callee = expr->expression(); 7672 Expression* callee = expr->expression();
(...skipping 3374 matching lines...) Expand 10 before | Expand all | Expand 10 after
11000 if (ShouldProduceTraceOutput()) { 11047 if (ShouldProduceTraceOutput()) {
11001 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11048 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11002 } 11049 }
11003 11050
11004 #ifdef DEBUG 11051 #ifdef DEBUG
11005 graph_->Verify(false); // No full verify. 11052 graph_->Verify(false); // No full verify.
11006 #endif 11053 #endif
11007 } 11054 }
11008 11055
11009 } } // namespace v8::internal 11056 } } // 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