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

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: Ni 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
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 2418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 } 2429 }
2430 2430
2431 2431
2432 HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* old_capacity) { 2432 HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* old_capacity) {
2433 HValue* half_old_capacity = AddUncasted<HShr>(old_capacity, 2433 HValue* half_old_capacity = AddUncasted<HShr>(old_capacity,
2434 graph_->GetConstant1()); 2434 graph_->GetConstant1());
2435 2435
2436 HValue* new_capacity = AddUncasted<HAdd>(half_old_capacity, old_capacity); 2436 HValue* new_capacity = AddUncasted<HAdd>(half_old_capacity, old_capacity);
2437 new_capacity->ClearFlag(HValue::kCanOverflow); 2437 new_capacity->ClearFlag(HValue::kCanOverflow);
2438 2438
2439 HValue* min_growth = Add<HConstant>(16); 2439 HValue* min_growth = Add<HConstant>(4);
2440 2440
2441 new_capacity = AddUncasted<HAdd>(new_capacity, min_growth); 2441 new_capacity = AddUncasted<HAdd>(new_capacity, min_growth);
2442 new_capacity->ClearFlag(HValue::kCanOverflow); 2442 new_capacity->ClearFlag(HValue::kCanOverflow);
2443 2443
2444 return new_capacity; 2444 return new_capacity;
2445 } 2445 }
2446 2446
2447 2447
2448 void HGraphBuilder::BuildNewSpaceArrayCheck(HValue* length, ElementsKind kind) { 2448 void HGraphBuilder::BuildNewSpaceArrayCheck(HValue* length, ElementsKind kind) {
2449 int element_size = IsFastDoubleElementsKind(kind) ? kDoubleSize 2449 int element_size = IsFastDoubleElementsKind(kind) ? kDoubleSize
(...skipping 5203 matching lines...) Expand 10 before | Expand all | Expand 10 after
7653 } 7653 }
7654 result = ast_context()->IsEffect() ? graph()->GetConstant0() : Top(); 7654 result = ast_context()->IsEffect() ? graph()->GetConstant0() : Top();
7655 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); 7655 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE);
7656 if (!ast_context()->IsEffect()) Drop(1); 7656 if (!ast_context()->IsEffect()) Drop(1);
7657 7657
7658 ast_context()->ReturnValue(result); 7658 ast_context()->ReturnValue(result);
7659 return true; 7659 return true;
7660 } 7660 }
7661 case kArrayPush: { 7661 case kArrayPush: {
7662 if (receiver_map.is_null()) return false; 7662 if (receiver_map.is_null()) return false;
7663 if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false;
Toon Verwaest 2014/04/11 13:06:57 This is invalid, since .push is spec'ed as reading
danno 2014/04/16 14:34:38 Done.
7664 ElementsKind elements_kind = receiver_map->elements_kind(); 7663 ElementsKind elements_kind = receiver_map->elements_kind();
7665 if (!IsFastElementsKind(elements_kind)) return false; 7664 if (!IsFastElementsKind(elements_kind)) return false;
7665 if (receiver_map->is_observed()) return false;
7666 if (!receiver_map->is_extensible()) return false;
Toon Verwaest 2014/04/11 13:06:57 I think is_extensible isn't necessary cause we gua
danno 2014/04/16 14:34:38 I changed these into ASSERTs and added them to pop
7666 7667
7667 // If there may be elements accessors in the prototype chain, the fast 7668 // If there may be elements accessors in the prototype chain, the fast
7668 // inlined version can't be used. 7669 // inlined version can't be used.
7669 if (receiver_map->DictionaryElementsInPrototypeChainOnly()) return false; 7670 if (receiver_map->DictionaryElementsInPrototypeChainOnly()) return false;
7670 // If there currently can be no elements accessors on the prototype chain, 7671 // If there currently can be no elements accessors on the prototype chain,
7671 // it doesn't mean that there won't be any later. Install a full prototype 7672 // it doesn't mean that there won't be any later. Install a full prototype
7672 // chain check to trap element accessors being installed on the prototype 7673 // chain check to trap element accessors being installed on the prototype
7673 // chain, which would cause elements to go to dictionary mode and result 7674 // chain, which would cause elements to go to dictionary mode and result
7674 // in a map change. 7675 // in a map change.
7675 Handle<JSObject> prototype(JSObject::cast(receiver_map->prototype())); 7676 Handle<JSObject> prototype(JSObject::cast(receiver_map->prototype()));
7676 BuildCheckPrototypeMaps(prototype, Handle<JSObject>()); 7677 BuildCheckPrototypeMaps(prototype, Handle<JSObject>());
7677 7678
7678 HValue* op_vals[] = { 7679 const int argc = expr->arguments()->length();
7679 context(), 7680 if (argc != 1) return false;
7680 // Receiver.
7681 environment()->ExpressionStackAt(expr->arguments()->length())
7682 };
7683 7681
7684 const int argc = expr->arguments()->length(); 7682 HValue* value_to_push = Pop();
7685 // Includes receiver. 7683 HValue* array = Pop();
7686 PushArgumentsFromEnvironment(argc + 1);
7687 7684
7688 CallInterfaceDescriptor* descriptor = 7685 HValue* length = Add<HLoadNamedField>(array, static_cast<HValue*>(NULL),
7689 isolate()->call_descriptor(Isolate::CallHandler); 7686 HObjectAccess::ForArrayLength(elements_kind));
7690 7687
7691 ArrayPushStub stub(receiver_map->elements_kind(), argc); 7688 {
7692 Handle<Code> code = stub.GetCode(isolate()); 7689 NoObservableSideEffectsScope scope(this);
7693 HConstant* code_value = Add<HConstant>(code);
7694 7690
7695 ASSERT((sizeof(op_vals) / kPointerSize) == 7691 bool is_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
7696 descriptor->environment_length()); 7692 BuildUncheckedMonomorphicElementAccess(array, length,
7693 value_to_push, is_array,
7694 elements_kind, STORE,
7695 NEVER_RETURN_HOLE,
7696 STORE_AND_GROW_NO_TRANSITION);
7697 }
7697 7698
7698 HInstruction* call = New<HCallWithDescriptor>( 7699 HInstruction* new_size = NewUncasted<HAdd>(length, Add<HConstant>(argc));
7699 code_value, argc + 1, descriptor,
7700 Vector<HValue*>(op_vals, descriptor->environment_length()));
7701 Drop(1); // Drop function. 7700 Drop(1); // Drop function.
7702 ast_context()->ReturnInstruction(call, expr->id()); 7701 ast_context()->ReturnInstruction(new_size, expr->id());
7703 return true; 7702 return true;
7704 } 7703 }
7705 default: 7704 default:
7706 // Not yet supported for inlining. 7705 // Not yet supported for inlining.
7707 break; 7706 break;
7708 } 7707 }
7709 return false; 7708 return false;
7710 } 7709 }
7711 7710
7712 7711
(...skipping 3825 matching lines...) Expand 10 before | Expand all | Expand 10 after
11538 if (ShouldProduceTraceOutput()) { 11537 if (ShouldProduceTraceOutput()) {
11539 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11538 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11540 } 11539 }
11541 11540
11542 #ifdef DEBUG 11541 #ifdef DEBUG
11543 graph_->Verify(false); // No full verify. 11542 graph_->Verify(false); // No full verify.
11544 #endif 11543 #endif
11545 } 11544 }
11546 11545
11547 } } // namespace v8::internal 11546 } } // namespace v8::internal
OLDNEW
« src/array.js ('K') | « 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