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

Side by Side Diff: src/hydrogen.cc

Issue 233293005: Remove hand-written assembly ArrayPush stubs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix test comments Created 6 years, 8 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/code-stubs.h ('k') | src/ia32/code-stubs-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 7678 matching lines...) Expand 10 before | Expand all | Expand 10 after
7689 HInstruction* result = HMul::NewImul(zone(), context(), left, right); 7689 HInstruction* result = HMul::NewImul(zone(), context(), left, right);
7690 ast_context()->ReturnInstruction(result, expr->id()); 7690 ast_context()->ReturnInstruction(result, expr->id());
7691 return true; 7691 return true;
7692 } 7692 }
7693 break; 7693 break;
7694 case kArrayPop: { 7694 case kArrayPop: {
7695 if (receiver_map.is_null()) return false; 7695 if (receiver_map.is_null()) return false;
7696 if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false; 7696 if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false;
7697 ElementsKind elements_kind = receiver_map->elements_kind(); 7697 ElementsKind elements_kind = receiver_map->elements_kind();
7698 if (!IsFastElementsKind(elements_kind)) return false; 7698 if (!IsFastElementsKind(elements_kind)) return false;
7699 if (receiver_map->is_observed()) return false;
7700 ASSERT(receiver_map->is_extensible());
7699 7701
7700 Drop(expr->arguments()->length()); 7702 Drop(expr->arguments()->length());
7701 HValue* result; 7703 HValue* result;
7702 HValue* reduced_length; 7704 HValue* reduced_length;
7703 HValue* receiver = Pop(); 7705 HValue* receiver = Pop();
7704 7706
7705 HValue* checked_object = AddCheckMap(receiver, receiver_map); 7707 HValue* checked_object = AddCheckMap(receiver, receiver_map);
7706 HValue* length = Add<HLoadNamedField>( 7708 HValue* length = Add<HLoadNamedField>(
7707 checked_object, static_cast<HValue*>(NULL), 7709 checked_object, static_cast<HValue*>(NULL),
7708 HObjectAccess::ForArrayLength(elements_kind)); 7710 HObjectAccess::ForArrayLength(elements_kind));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
7751 if (!ast_context()->IsEffect()) Drop(1); 7753 if (!ast_context()->IsEffect()) Drop(1);
7752 7754
7753 ast_context()->ReturnValue(result); 7755 ast_context()->ReturnValue(result);
7754 return true; 7756 return true;
7755 } 7757 }
7756 case kArrayPush: { 7758 case kArrayPush: {
7757 if (receiver_map.is_null()) return false; 7759 if (receiver_map.is_null()) return false;
7758 if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false; 7760 if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false;
7759 ElementsKind elements_kind = receiver_map->elements_kind(); 7761 ElementsKind elements_kind = receiver_map->elements_kind();
7760 if (!IsFastElementsKind(elements_kind)) return false; 7762 if (!IsFastElementsKind(elements_kind)) return false;
7763 if (receiver_map->is_observed()) return false;
7764 ASSERT(receiver_map->is_extensible());
7761 7765
7762 // If there may be elements accessors in the prototype chain, the fast 7766 // If there may be elements accessors in the prototype chain, the fast
7763 // inlined version can't be used. 7767 // inlined version can't be used.
7764 if (receiver_map->DictionaryElementsInPrototypeChainOnly()) return false; 7768 if (receiver_map->DictionaryElementsInPrototypeChainOnly()) return false;
7765 // If there currently can be no elements accessors on the prototype chain, 7769 // If there currently can be no elements accessors on the prototype chain,
7766 // it doesn't mean that there won't be any later. Install a full prototype 7770 // it doesn't mean that there won't be any later. Install a full prototype
7767 // chain check to trap element accessors being installed on the prototype 7771 // chain check to trap element accessors being installed on the prototype
7768 // chain, which would cause elements to go to dictionary mode and result 7772 // chain, which would cause elements to go to dictionary mode and result
7769 // in a map change. 7773 // in a map change.
7770 Handle<JSObject> prototype(JSObject::cast(receiver_map->prototype())); 7774 Handle<JSObject> prototype(JSObject::cast(receiver_map->prototype()));
7771 BuildCheckPrototypeMaps(prototype, Handle<JSObject>()); 7775 BuildCheckPrototypeMaps(prototype, Handle<JSObject>());
7772 7776
7773 HValue* op_vals[] = { 7777 const int argc = expr->arguments()->length();
7774 context(), 7778 if (argc != 1) return false;
7775 // Receiver.
7776 environment()->ExpressionStackAt(expr->arguments()->length())
7777 };
7778 7779
7779 const int argc = expr->arguments()->length(); 7780 HValue* value_to_push = Pop();
7780 // Includes receiver. 7781 HValue* array = Pop();
7781 PushArgumentsFromEnvironment(argc + 1);
7782 7782
7783 CallInterfaceDescriptor* descriptor = 7783 HValue* length = Add<HLoadNamedField>(array, static_cast<HValue*>(NULL),
7784 isolate()->call_descriptor(Isolate::CallHandler); 7784 HObjectAccess::ForArrayLength(elements_kind));
7785 7785
7786 ArrayPushStub stub(receiver_map->elements_kind(), argc); 7786 {
7787 Handle<Code> code = stub.GetCode(isolate()); 7787 NoObservableSideEffectsScope scope(this);
7788 HConstant* code_value = Add<HConstant>(code);
7789 7788
7790 ASSERT((sizeof(op_vals) / kPointerSize) == 7789 bool is_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
7791 descriptor->environment_length()); 7790 BuildUncheckedMonomorphicElementAccess(array, length,
7791 value_to_push, is_array,
7792 elements_kind, STORE,
7793 NEVER_RETURN_HOLE,
7794 STORE_AND_GROW_NO_TRANSITION);
7795 }
7792 7796
7793 HInstruction* call = New<HCallWithDescriptor>( 7797 HInstruction* new_size = NewUncasted<HAdd>(length, Add<HConstant>(argc));
7794 code_value, argc + 1, descriptor,
7795 Vector<HValue*>(op_vals, descriptor->environment_length()));
7796 Drop(1); // Drop function. 7798 Drop(1); // Drop function.
7797 ast_context()->ReturnInstruction(call, expr->id()); 7799 ast_context()->ReturnInstruction(new_size, expr->id());
7798 return true; 7800 return true;
7799 } 7801 }
7800 default: 7802 default:
7801 // Not yet supported for inlining. 7803 // Not yet supported for inlining.
7802 break; 7804 break;
7803 } 7805 }
7804 return false; 7806 return false;
7805 } 7807 }
7806 7808
7807 7809
(...skipping 3825 matching lines...) Expand 10 before | Expand all | Expand 10 after
11633 if (ShouldProduceTraceOutput()) { 11635 if (ShouldProduceTraceOutput()) {
11634 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11636 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11635 } 11637 }
11636 11638
11637 #ifdef DEBUG 11639 #ifdef DEBUG
11638 graph_->Verify(false); // No full verify. 11640 graph_->Verify(false); // No full verify.
11639 #endif 11641 #endif
11640 } 11642 }
11641 11643
11642 } } // namespace v8::internal 11644 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698