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

Side by Side Diff: test/cctest/test-unboxed-doubles.cc

Issue 2595893002: [runtime] Remove specific Descriptor subclasses and add respective factory methods instead. (Closed)
Patch Set: Created 4 years 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 | « test/cctest/test-field-type-tracking.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 <stdlib.h> 5 #include <stdlib.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 int next_field_offset = 0; 100 int next_field_offset = 0;
101 for (int i = 0; i < kPropsCount; i++) { 101 for (int i = 0; i < kPropsCount; i++) {
102 EmbeddedVector<char, 64> buffer; 102 EmbeddedVector<char, 64> buffer;
103 SNPrintF(buffer, "prop%d", i); 103 SNPrintF(buffer, "prop%d", i);
104 Handle<String> name = factory->InternalizeUtf8String(buffer.start()); 104 Handle<String> name = factory->InternalizeUtf8String(buffer.start());
105 105
106 TestPropertyKind kind = props[i]; 106 TestPropertyKind kind = props[i];
107 107
108 if (kind == PROP_CONSTANT) { 108 if (kind == PROP_CONSTANT) {
109 DataConstantDescriptor d(name, func, NONE); 109 Descriptor d = Descriptor::DataConstant(name, func, NONE);
110 descriptors->Append(&d); 110 descriptors->Append(&d);
111 111
112 } else { 112 } else {
113 DataDescriptor f(name, next_field_offset, NONE, representations[kind]); 113 Descriptor d = Descriptor::DataField(name, next_field_offset, NONE,
114 next_field_offset += f.GetDetails().field_width_in_words(); 114 representations[kind]);
115 descriptors->Append(&f); 115 next_field_offset += d.GetDetails().field_width_in_words();
116 descriptors->Append(&d);
116 } 117 }
117 } 118 }
118 return descriptors; 119 return descriptors;
119 } 120 }
120 121
121 122
122 TEST(LayoutDescriptorBasicFast) { 123 TEST(LayoutDescriptorBasicFast) {
123 CcTest::InitializeVM(); 124 CcTest::InitializeVM();
124 v8::HandleScope scope(CcTest::isolate()); 125 v8::HandleScope scope(CcTest::isolate());
125 126
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 622
622 int next_field_offset = 0; 623 int next_field_offset = 0;
623 for (int i = 0; i < kPropsCount; i++) { 624 for (int i = 0; i < kPropsCount; i++) {
624 EmbeddedVector<char, 64> buffer; 625 EmbeddedVector<char, 64> buffer;
625 SNPrintF(buffer, "prop%d", i); 626 SNPrintF(buffer, "prop%d", i);
626 Handle<String> name = factory->InternalizeUtf8String(buffer.start()); 627 Handle<String> name = factory->InternalizeUtf8String(buffer.start());
627 628
628 Handle<LayoutDescriptor> layout_descriptor; 629 Handle<LayoutDescriptor> layout_descriptor;
629 TestPropertyKind kind = props[i]; 630 TestPropertyKind kind = props[i];
630 if (kind == PROP_CONSTANT) { 631 if (kind == PROP_CONSTANT) {
631 DataConstantDescriptor d(name, func, NONE); 632 Descriptor d = Descriptor::DataConstant(name, func, NONE);
632 layout_descriptor = LayoutDescriptor::ShareAppend(map, d.GetDetails()); 633 layout_descriptor = LayoutDescriptor::ShareAppend(map, d.GetDetails());
633 descriptors->Append(&d); 634 descriptors->Append(&d);
634 635
635 } else { 636 } else {
636 DataDescriptor f(name, next_field_offset, NONE, representations[kind]); 637 Descriptor d = Descriptor::DataField(name, next_field_offset, NONE,
637 int field_width_in_words = f.GetDetails().field_width_in_words(); 638 representations[kind]);
639 int field_width_in_words = d.GetDetails().field_width_in_words();
638 next_field_offset += field_width_in_words; 640 next_field_offset += field_width_in_words;
639 layout_descriptor = LayoutDescriptor::ShareAppend(map, f.GetDetails()); 641 layout_descriptor = LayoutDescriptor::ShareAppend(map, d.GetDetails());
640 descriptors->Append(&f); 642 descriptors->Append(&d);
641 643
642 int field_index = f.GetDetails().field_index(); 644 int field_index = d.GetDetails().field_index();
643 bool is_inobject = field_index < map->GetInObjectProperties(); 645 bool is_inobject = field_index < map->GetInObjectProperties();
644 for (int bit = 0; bit < field_width_in_words; bit++) { 646 for (int bit = 0; bit < field_width_in_words; bit++) {
645 CHECK_EQ(is_inobject && (kind == PROP_DOUBLE), 647 CHECK_EQ(is_inobject && (kind == PROP_DOUBLE),
646 !layout_descriptor->IsTagged(field_index + bit)); 648 !layout_descriptor->IsTagged(field_index + bit));
647 } 649 }
648 CHECK(layout_descriptor->IsTagged(next_field_offset)); 650 CHECK(layout_descriptor->IsTagged(next_field_offset));
649 } 651 }
650 map->InitializeDescriptors(*descriptors, *layout_descriptor); 652 map->InitializeDescriptors(*descriptors, *layout_descriptor);
651 } 653 }
652 Handle<LayoutDescriptor> layout_descriptor(map->layout_descriptor(), isolate); 654 Handle<LayoutDescriptor> layout_descriptor(map->layout_descriptor(), isolate);
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 1556
1555 // TODO(ishell): add respective tests for property kind reconfiguring from 1557 // TODO(ishell): add respective tests for property kind reconfiguring from
1556 // accessor field to double, once accessor fields are supported by 1558 // accessor field to double, once accessor fields are supported by
1557 // Map::ReconfigureProperty(). 1559 // Map::ReconfigureProperty().
1558 1560
1559 1561
1560 // TODO(ishell): add respective tests for fast property removal case once 1562 // TODO(ishell): add respective tests for fast property removal case once
1561 // Map::ReconfigureProperty() supports that. 1563 // Map::ReconfigureProperty() supports that.
1562 1564
1563 #endif 1565 #endif
OLDNEW
« no previous file with comments | « test/cctest/test-field-type-tracking.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698