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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 19367003: Reland "Turn ElementsTransitionAndStore stub into a HydrogenCodeStub". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test case. Created 7 years, 5 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.cc ('k') | src/hydrogen.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 521 }
522 522
523 523
524 Handle<Code> KeyedStoreFastElementStub::GenerateCode() { 524 Handle<Code> KeyedStoreFastElementStub::GenerateCode() {
525 return DoGenerateCode(this); 525 return DoGenerateCode(this);
526 } 526 }
527 527
528 528
529 template <> 529 template <>
530 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { 530 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {
531 TransitionElementsKindStub* stub = casted_stub();
532 ElementsKind from_kind = stub->from_kind();
533 ElementsKind to_kind = stub->to_kind();
534
535 HValue* js_array = GetParameter(0);
536 HValue* map = GetParameter(1);
537
538 info()->MarkAsSavesCallerDoubles(); 531 info()->MarkAsSavesCallerDoubles();
539 532
540 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) { 533 BuildTransitionElementsKind(GetParameter(0),
541 Add<HTrapAllocationMemento>(js_array); 534 GetParameter(1),
542 } 535 casted_stub()->from_kind(),
536 casted_stub()->to_kind(),
537 true);
543 538
544 HInstruction* elements = AddLoadElements(js_array); 539 return GetParameter(0);
545
546 HInstruction* empty_fixed_array = Add<HConstant>(
547 isolate()->factory()->empty_fixed_array(), Representation::Tagged());
548
549 IfBuilder if_builder(this);
550
551 if_builder.IfNot<HCompareObjectEqAndBranch>(elements, empty_fixed_array);
552
553 if_builder.Then();
554
555 HInstruction* elements_length = AddLoadFixedArrayLength(elements);
556
557 HInstruction* array_length = AddLoad(
558 js_array, HObjectAccess::ForArrayLength(), NULL, Representation::Smi());
559 array_length->set_type(HType::Smi());
560
561 BuildGrowElementsCapacity(js_array, elements, from_kind, to_kind,
562 array_length, elements_length);
563
564 if_builder.End();
565
566 AddStore(js_array, HObjectAccess::ForMap(), map);
567
568 return js_array;
569 } 540 }
570 541
571 542
572 Handle<Code> TransitionElementsKindStub::GenerateCode() { 543 Handle<Code> TransitionElementsKindStub::GenerateCode() {
573 return DoGenerateCode(this); 544 return DoGenerateCode(this);
574 } 545 }
575 546
576 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor( 547 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor(
577 ElementsKind kind, 548 ElementsKind kind,
578 ContextCheckMode context_mode, 549 ContextCheckMode context_mode,
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 } 874 }
904 return value; 875 return value;
905 } 876 }
906 877
907 878
908 Handle<Code> StoreGlobalStub::GenerateCode() { 879 Handle<Code> StoreGlobalStub::GenerateCode() {
909 return DoGenerateCode(this); 880 return DoGenerateCode(this);
910 } 881 }
911 882
912 883
884 template<>
885 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() {
886 HValue* value = GetParameter(0);
887 HValue* map = GetParameter(1);
888 HValue* key = GetParameter(2);
889 HValue* object = GetParameter(3);
890
891 if (FLAG_trace_elements_transitions) {
892 // Tracing elements transitions is the job of the runtime.
893 current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll);
894 set_current_block(NULL);
895 } else {
896 info()->MarkAsSavesCallerDoubles();
897
898 BuildTransitionElementsKind(object, map,
899 casted_stub()->from_kind(),
900 casted_stub()->to_kind(),
901 casted_stub()->is_jsarray());
902
903 BuildUncheckedMonomorphicElementAccess(object, key, value, NULL,
904 casted_stub()->is_jsarray(),
905 casted_stub()->to_kind(),
906 true, ALLOW_RETURN_HOLE,
907 casted_stub()->store_mode());
908 }
909
910 return value;
911 }
912
913
914 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() {
915 return DoGenerateCode(this);
916 }
917
918
913 } } // namespace v8::internal 919 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698