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

Side by Side Diff: src/property.cc

Issue 733253004: PropertyDetails cleanup: NORMAL property type merged with FIELD. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup Created 6 years, 1 month 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/property.h ('k') | src/property-details.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 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 "src/property.h" 5 #include "src/property.h"
6 6
7 #include "src/handles-inl.h" 7 #include "src/handles-inl.h"
8 #include "src/ostreams.h" 8 #include "src/ostreams.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 24 matching lines...) Expand all
35 const PropertyAttributes& attributes) { 35 const PropertyAttributes& attributes) {
36 os << "["; 36 os << "[";
37 os << (((attributes & READ_ONLY) == 0) ? "W" : "_"); // writable 37 os << (((attributes & READ_ONLY) == 0) ? "W" : "_"); // writable
38 os << (((attributes & DONT_ENUM) == 0) ? "E" : "_"); // enumerable 38 os << (((attributes & DONT_ENUM) == 0) ? "E" : "_"); // enumerable
39 os << (((attributes & DONT_DELETE) == 0) ? "C" : "_"); // configurable 39 os << (((attributes & DONT_DELETE) == 0) ? "C" : "_"); // configurable
40 os << "]"; 40 os << "]";
41 return os; 41 return os;
42 } 42 }
43 43
44 44
45 struct FastPropertyDetails {
46 explicit FastPropertyDetails(const PropertyDetails& v) : details(v) {}
47 const PropertyDetails details;
48 };
49
50
51 // Outputs PropertyDetails as a dictionary details.
45 std::ostream& operator<<(std::ostream& os, const PropertyDetails& details) { 52 std::ostream& operator<<(std::ostream& os, const PropertyDetails& details) {
46 os << "("; 53 os << "(";
47 switch (details.type()) { 54 switch (details.type()) {
48 case NORMAL: 55 case FIELD:
49 os << "normal: dictionary_index: " << details.dictionary_index(); 56 os << "normal: ";
50 break; 57 break;
51 case CONSTANT: 58 case CONSTANT:
59 os << "constant: ";
60 break;
61 case CALLBACKS:
62 UNREACHABLE();
63 break;
64 }
65 return os << " dictionary_index: " << details.dictionary_index()
66 << ", attrs: " << details.attributes() << ")";
67 }
68
69
70 // Outputs PropertyDetails as a descriptor array details.
71 std::ostream& operator<<(std::ostream& os,
72 const FastPropertyDetails& details_fast) {
73 const PropertyDetails& details = details_fast.details;
74 os << "(";
75 switch (details.type()) {
76 case CONSTANT:
52 os << "constant: p: " << details.pointer(); 77 os << "constant: p: " << details.pointer();
53 break; 78 break;
54 case FIELD: 79 case FIELD:
55 os << "field: " << details.representation().Mnemonic() 80 os << "field: " << details.representation().Mnemonic()
56 << ", field_index: " << details.field_index() 81 << ", field_index: " << details.field_index()
57 << ", p: " << details.pointer(); 82 << ", p: " << details.pointer();
58 break; 83 break;
59 case CALLBACKS: 84 case CALLBACKS:
60 os << "callbacks: p: " << details.pointer(); 85 os << "callbacks: p: " << details.pointer();
61 break; 86 break;
62 } 87 }
63 os << ", attrs: " << details.attributes() << ")"; 88 return os << ", attrs: " << details.attributes() << ")";
64 return os;
65 } 89 }
66 90
67 91
92 #ifdef OBJECT_PRINT
93 void PropertyDetails::Print(bool dictionary_mode) {
94 OFStream os(stdout);
95 if (dictionary_mode) {
96 os << *this;
97 } else {
98 os << FastPropertyDetails(*this);
99 }
100 os << "\n" << std::flush;
101 }
102 #endif
103
104
68 std::ostream& operator<<(std::ostream& os, const Descriptor& d) { 105 std::ostream& operator<<(std::ostream& os, const Descriptor& d) {
69 return os << "Descriptor " << Brief(*d.GetKey()) << " @ " 106 return os << "Descriptor " << Brief(*d.GetKey()) << " @ "
70 << Brief(*d.GetValue()) << " " << d.GetDetails(); 107 << Brief(*d.GetValue()) << " "
108 << FastPropertyDetails(d.GetDetails());
71 } 109 }
72 110
73 } } // namespace v8::internal 111 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/property.h ('k') | src/property-details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698