Reviewers: Søren Gjesse,
Description:
Mark single-argument inline constructors as 'explicit'.
There is currently a bug in cpplint.py hiding this problem.
[email protected]
BUG=1304
TEST=none
Please review this at http://codereview.chromium.org/6820028/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M include/v8.h
M src/api.h
M src/heap.cc
M src/jsregexp.h
M src/mips/virtual-frame-mips.h
M src/objects-inl.h
M src/objects.h
M src/objects.cc
M src/property.h
M src/scopeinfo.h
M src/x64/lithium-codegen-x64.h
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index
a990fc2e25373f4daadd1f4e6fe32f15bf9fd3ce..d15d024dc3ce11164f9b28eb026f8fa2c74e93d7
100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -3296,7 +3296,7 @@ class V8EXPORT Context {
*/
class Scope {
public:
- inline Scope(Handle<Context> context) : context_(context) {
+ explicit inline Scope(Handle<Context> context) : context_(context) {
context_->Enter();
}
inline ~Scope() { context_->Exit(); }
Index: src/api.h
diff --git a/src/api.h b/src/api.h
index
6d46713eff10a511e000735c625995192953c54e..7423d28e2f807d9947604f7dc1503bb72d7aaf36
100644
--- a/src/api.h
+++ b/src/api.h
@@ -53,8 +53,8 @@ class Consts {
class NeanderObject {
public:
explicit NeanderObject(int size);
- inline NeanderObject(v8::internal::Handle<v8::internal::Object> obj);
- inline NeanderObject(v8::internal::Object* obj);
+ explicit inline NeanderObject(v8::internal::Handle<v8::internal::Object>
obj);
+ explicit inline NeanderObject(v8::internal::Object* obj);
inline v8::internal::Object* get(int index);
inline void set(int index, v8::internal::Object* value);
inline v8::internal::Handle<v8::internal::JSObject> value() { return
value_; }
@@ -69,7 +69,7 @@ class NeanderObject {
class NeanderArray {
public:
NeanderArray();
- inline NeanderArray(v8::internal::Handle<v8::internal::Object> obj);
+ explicit inline NeanderArray(v8::internal::Handle<v8::internal::Object>
obj);
inline v8::internal::Handle<v8::internal::JSObject> value() {
return obj_.value();
}
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
b2e09b40db5131dc56b46b619c844891028455db..c77364b55305019dffc757d789442bc5c9eca0ac
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -3231,7 +3231,7 @@ MaybeObject* Heap::AllocateGlobalObject(JSFunction*
constructor) {
// Fill these accessors into the dictionary.
DescriptorArray* descs = map->instance_descriptors();
for (int i = 0; i < descs->number_of_descriptors(); i++) {
- PropertyDetails details = descs->GetDetails(i);
+ PropertyDetails details(descs->GetDetails(i));
ASSERT(details.type() == CALLBACKS); // Only accessors are expected.
PropertyDetails d =
PropertyDetails(details.attributes(), CALLBACKS, details.index());
Index: src/jsregexp.h
diff --git a/src/jsregexp.h b/src/jsregexp.h
index
3ed5a7e43da743b3c4101d72a2e6192fff0755e6..b9b2f60406d9c68c4c823cdd6f452879ffdc3ea5
100644
--- a/src/jsregexp.h
+++ b/src/jsregexp.h
@@ -1447,7 +1447,7 @@ class RegExpEngine: public AllStatic {
class OffsetsVector {
public:
- inline OffsetsVector(int num_registers)
+ explicit inline OffsetsVector(int num_registers)
: offsets_vector_length_(num_registers) {
if (offsets_vector_length_ >
Isolate::kJSRegexpStaticOffsetsVectorSize) {
vector_ = NewArray<int>(offsets_vector_length_);
Index: src/mips/virtual-frame-mips.h
diff --git a/src/mips/virtual-frame-mips.h b/src/mips/virtual-frame-mips.h
index
be8b74e84a2f9ec5af70b27c47ca951b9ed16257..cf30b09326a5a372f10c139285e288fc559d0480
100644
--- a/src/mips/virtual-frame-mips.h
+++ b/src/mips/virtual-frame-mips.h
@@ -106,7 +106,7 @@ class VirtualFrame : public ZoneObject {
inline VirtualFrame();
// Construct an invalid virtual frame, used by JumpTargets.
- inline VirtualFrame(InvalidVirtualFrameInitializer* dummy);
+ explicit inline VirtualFrame(InvalidVirtualFrameInitializer* dummy);
// Construct a virtual frame as a clone of an existing one.
explicit inline VirtualFrame(VirtualFrame* original);
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
37c51d703db1679ba037990d411533734bfa9de5..a23198a2ec1d3f111a1f725f3aa6b52126bd8e83
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1774,7 +1774,7 @@ bool DescriptorArray::IsDontEnum(int
descriptor_number) {
void DescriptorArray::Get(int descriptor_number, Descriptor* desc) {
desc->Init(GetKey(descriptor_number),
GetValue(descriptor_number),
- GetDetails(descriptor_number));
+ PropertyDetails(GetDetails(descriptor_number)));
}
@@ -3953,6 +3953,15 @@ void
AccessorInfo::set_property_attributes(PropertyAttributes attributes) {
set_flag(Smi::FromInt(rest_value | AttributesField::encode(attributes)));
}
+
+template<typename Shape, typename Key>
+void Dictionary<Shape, Key>::SetEntry(int entry,
+ Object* key,
+ Object* value) {
+ SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0)));
+}
+
+
template<typename Shape, typename Key>
void Dictionary<Shape, Key>::SetEntry(int entry,
Object* key,
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
47ba64dce0e49c2003525403a3ecbb8b9434c7d7..24a7ce8010df9375892fc926b206c07acaf6afee
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2518,7 +2518,7 @@ MaybeObject*
JSObject::NormalizeProperties(PropertyNormalizationMode mode,
DescriptorArray* descs = map_of_this->instance_descriptors();
for (int i = 0; i < descs->number_of_descriptors(); i++) {
- PropertyDetails details = descs->GetDetails(i);
+ PropertyDetails details(descs->GetDetails(i));
switch (details.type()) {
case CONSTANT_FUNCTION: {
PropertyDetails d =
@@ -8102,7 +8102,7 @@ int
JSObject::NumberOfLocalProperties(PropertyAttributes filter) {
DescriptorArray* descs = map()->instance_descriptors();
int result = 0;
for (int i = 0; i < descs->number_of_descriptors(); i++) {
- PropertyDetails details = descs->GetDetails(i);
+ PropertyDetails details(descs->GetDetails(i));
if (details.IsProperty() && (details.attributes() & filter) == 0) {
result++;
}
@@ -9669,7 +9669,7 @@ void NumberDictionary::RemoveNumberEntries(uint32_t
from, uint32_t to) {
if (key->IsNumber()) {
uint32_t number = static_cast<uint32_t>(key->Number());
if (from <= number && number < to) {
- SetEntry(i, sentinel, sentinel, Smi::FromInt(0));
+ SetEntry(i, sentinel, sentinel);
removed_entries++;
}
}
@@ -9689,7 +9689,7 @@ Object* Dictionary<Shape, Key>::DeleteProperty(int
entry,
if (details.IsDontDelete() && mode != JSObject::FORCE_DELETION) {
return heap->false_value();
}
- SetEntry(entry, heap->null_value(), heap->null_value(), Smi::FromInt(0));
+ SetEntry(entry, heap->null_value(), heap->null_value());
HashTable<Shape, Key>::ElementRemoved();
return heap->true_value();
}
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
874dcbc902ea0111d5f49b756f774df7c4b35af4..fa48f4a960e1761590efdb90cc7776e72f29b330
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -167,7 +167,7 @@ class PropertyDetails BASE_EMBEDDED {
}
// Conversion for storing details as Object*.
- inline PropertyDetails(Smi* smi);
+ explicit inline PropertyDetails(Smi* smi);
inline Smi* AsSmi();
PropertyType type() { return TypeField::decode(value_); }
@@ -2576,9 +2576,12 @@ class Dictionary: public HashTable<Shape, Key> {
// Sets the entry to (key, value) pair.
inline void SetEntry(int entry,
Object* key,
+ Object* value);
+ inline void SetEntry(int entry,
+ Object* key,
Object* value,
PropertyDetails details);
-
+
MUST_USE_RESULT MaybeObject* Add(Key key,
Object* value,
PropertyDetails details);
@@ -5158,7 +5161,7 @@ enum RobustnessFlag {ROBUST_STRING_TRAVERSAL,
FAST_STRING_TRAVERSAL};
class StringHasher {
public:
- inline StringHasher(int length);
+ explicit inline StringHasher(int length);
// Returns true if the hash of this string can be computed without
// looking at the contents.
@@ -5905,7 +5908,7 @@ class StringInputBuffer: public
unibrow::InputBuffer<String, String*, 1024> {
public:
virtual void Seek(unsigned pos);
inline StringInputBuffer(): unibrow::InputBuffer<String, String*,
1024>() {}
- inline StringInputBuffer(String* backing):
+ explicit inline StringInputBuffer(String* backing):
unibrow::InputBuffer<String, String*, 1024>(backing) {}
};
@@ -5916,7 +5919,7 @@ class SafeStringInputBuffer
virtual void Seek(unsigned pos);
inline SafeStringInputBuffer()
: unibrow::InputBuffer<String, String**, 256>() {}
- inline SafeStringInputBuffer(String** backing)
+ explicit inline SafeStringInputBuffer(String** backing)
: unibrow::InputBuffer<String, String**, 256>(backing) {}
};
Index: src/property.h
diff --git a/src/property.h b/src/property.h
index
fa3916eb144825205559e5e8e691718749729897..ee95ca217a28b42b7916b3d36dceef2a2843a41c
100644
--- a/src/property.h
+++ b/src/property.h
@@ -185,6 +185,13 @@ class LookupResult BASE_EMBEDDED {
number_ = number;
}
+ void DescriptorResult(JSObject* holder, Smi* details, int number) {
+ lookup_type_ = DESCRIPTOR_TYPE;
+ holder_ = holder;
+ details_ = PropertyDetails(details);
+ number_ = number;
+ }
+
void ConstantResult(JSObject* holder) {
lookup_type_ = CONSTANT_TYPE;
holder_ = holder;
Index: src/scopeinfo.h
diff --git a/src/scopeinfo.h b/src/scopeinfo.h
index
cc9f8165a260eecf57260f644327c26e956285f3..2552af22f57bc099227cd575937eded7654a0721
100644
--- a/src/scopeinfo.h
+++ b/src/scopeinfo.h
@@ -220,7 +220,7 @@ class ContextSlotCache {
ASSERT(index == this->index());
}
- inline Value(uint32_t value) : value_(value) {}
+ explicit inline Value(uint32_t value) : value_(value) {}
uint32_t raw() { return value_; }
Index: src/x64/lithium-codegen-x64.h
diff --git a/src/x64/lithium-codegen-x64.h b/src/x64/lithium-codegen-x64.h
index
d82379595ef24608f52267002a2170cee10bf429..34277f6ed490f50d6f673ba857013622f22c1a3f
100644
--- a/src/x64/lithium-codegen-x64.h
+++ b/src/x64/lithium-codegen-x64.h
@@ -272,7 +272,7 @@ class LCodeGen BASE_EMBEDDED {
void EmitPushConstantOperand(LOperand* operand);
struct JumpTableEntry {
- inline JumpTableEntry(Address entry)
+ explicit inline JumpTableEntry(Address entry)
: label(),
address(entry) { }
Label label;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev