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

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

Issue 2397573004: [stubs] Reduce number of StoreTransitionStub instances. (Closed)
Patch Set: Cleanup Created 4 years, 2 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
« no previous file with comments | « src/code-stubs.h ('k') | src/ic/arm/handler-compiler-arm.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 Node* value = assembler->Parameter(Descriptor::kValue); 522 Node* value = assembler->Parameter(Descriptor::kValue);
523 Node* slot = assembler->Parameter(Descriptor::kSlot); 523 Node* slot = assembler->Parameter(Descriptor::kSlot);
524 Node* vector = assembler->Parameter(Descriptor::kVector); 524 Node* vector = assembler->Parameter(Descriptor::kVector);
525 Node* context = assembler->Parameter(Descriptor::kContext); 525 Node* context = assembler->Parameter(Descriptor::kContext);
526 526
527 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, 527 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot,
528 vector); 528 vector);
529 assembler->StoreIC(&p); 529 assembler->StoreIC(&p);
530 } 530 }
531 531
532 void StoreMapStub::GenerateAssembly(CodeStubAssembler* assembler) const {
533 typedef compiler::Node Node;
534
535 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
536 Node* map = assembler->Parameter(Descriptor::kMap);
537 Node* value = assembler->Parameter(Descriptor::kValue);
538
539 assembler->StoreObjectField(receiver, JSObject::kMapOffset, map);
540 assembler->Return(value);
541 }
542
532 void StoreTransitionStub::GenerateAssembly(CodeStubAssembler* assembler) const { 543 void StoreTransitionStub::GenerateAssembly(CodeStubAssembler* assembler) const {
533 typedef CodeStubAssembler::Label Label; 544 typedef CodeStubAssembler::Label Label;
534 typedef compiler::Node Node; 545 typedef compiler::Node Node;
535 546
536 Node* receiver = assembler->Parameter(Descriptor::kReceiver); 547 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
537 Node* name = assembler->Parameter(Descriptor::kName); 548 Node* name = assembler->Parameter(Descriptor::kName);
549 Node* offset =
550 assembler->SmiUntag(assembler->Parameter(Descriptor::kFieldOffset));
538 Node* value = assembler->Parameter(Descriptor::kValue); 551 Node* value = assembler->Parameter(Descriptor::kValue);
539 Node* map = assembler->Parameter(Descriptor::kMap); 552 Node* map = assembler->Parameter(Descriptor::kMap);
540 Node* slot = assembler->Parameter(Descriptor::kSlot); 553 Node* slot = assembler->Parameter(Descriptor::kSlot);
541 Node* vector = assembler->Parameter(Descriptor::kVector); 554 Node* vector = assembler->Parameter(Descriptor::kVector);
542 Node* context = assembler->Parameter(Descriptor::kContext); 555 Node* context = assembler->Parameter(Descriptor::kContext);
543 556
544 StoreMode store_mode = this->store_mode(); 557 Label miss(assembler);
545 Node* prepared_value = value;
546 558
547 Label miss(assembler); 559 Representation representation = this->representation();
548 bool needs_miss_case = false; 560 assembler->Comment("StoreTransitionStub: is_inobject: %d: representation: %s",
561 is_inobject(), representation.Mnemonic());
549 562
550 if (store_mode != StoreTransitionStub::StoreMapOnly) { 563 Node* prepared_value =
551 Representation representation = this->representation(); 564 assembler->PrepareValueForWrite(value, representation, &miss);
552 FieldIndex index = this->index(); 565
553 assembler->Comment( 566 if (store_mode() == StoreTransitionStub::ExtendStorageAndStoreMapAndValue) {
554 "Prepare value for write: representation: %s, index.is_inobject: %d, " 567 assembler->Comment("Extend storage");
555 "index.offset: %d", 568 assembler->ExtendPropertiesBackingStore(receiver);
556 representation.Mnemonic(), index.is_inobject(), index.offset()); 569 } else {
557 prepared_value = 570 DCHECK(store_mode() == StoreTransitionStub::StoreMapAndValue);
558 assembler->PrepareValueForWrite(prepared_value, representation, &miss);
559 // Only store to tagged field never bails out.
560 needs_miss_case |= !representation.IsTagged();
561 } 571 }
562 572
563 switch (store_mode) { 573 // Store the new value into the "extended" object.
564 case StoreTransitionStub::ExtendStorageAndStoreMapAndValue: 574 assembler->Comment("Store value");
565 assembler->Comment("Extend storage"); 575 assembler->StoreNamedField(receiver, offset, is_inobject(), representation,
566 assembler->ExtendPropertiesBackingStore(receiver); 576 prepared_value, true);
567 // Fall through. 577
568 case StoreTransitionStub::StoreMapAndValue: 578 // And finally update the map.
569 assembler->Comment("Store value"); 579 assembler->Comment("Store map");
570 // Store the new value into the "extended" object. 580 assembler->StoreObjectField(receiver, JSObject::kMapOffset, map);
571 assembler->StoreNamedField(receiver, index(), representation(),
572 prepared_value, true);
573 // Fall through.
574 case StoreTransitionStub::StoreMapOnly:
575 assembler->Comment("Store map");
576 // And finally update the map.
577 assembler->StoreObjectField(receiver, JSObject::kMapOffset, map);
578 break;
579 }
580 assembler->Return(value); 581 assembler->Return(value);
581 582
582 if (needs_miss_case) { 583 // Only store to tagged field never bails out.
584 if (!representation.IsTagged()) {
583 assembler->Bind(&miss); 585 assembler->Bind(&miss);
584 { 586 {
585 assembler->Comment("Miss"); 587 assembler->Comment("Miss");
586 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, 588 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot,
587 vector, receiver, name); 589 vector, receiver, name);
588 } 590 }
589 } 591 }
590 } 592 }
591 593
592 void ElementsTransitionAndStoreStub::GenerateAssembly( 594 void ElementsTransitionAndStoreStub::GenerateAssembly(
(...skipping 5279 matching lines...) Expand 10 before | Expand all | Expand 10 after
5872 5874
5873 if (type == MachineType::Pointer()) { 5875 if (type == MachineType::Pointer()) {
5874 return Representation::External(); 5876 return Representation::External();
5875 } 5877 }
5876 5878
5877 return Representation::Tagged(); 5879 return Representation::Tagged();
5878 } 5880 }
5879 5881
5880 } // namespace internal 5882 } // namespace internal
5881 } // namespace v8 5883 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/ic/arm/handler-compiler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698