Mark single-argument inline constructors as 'explicit'.

There is currently a bug in cpplint.py hiding this problem.

R=sgjesse@chromium.org
BUG=1304
TEST=none

Review URL: http://codereview.chromium.org/6820028

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7567 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 544a4364
...@@ -3296,7 +3296,7 @@ class V8EXPORT Context { ...@@ -3296,7 +3296,7 @@ class V8EXPORT Context {
*/ */
class Scope { class Scope {
public: public:
inline Scope(Handle<Context> context) : context_(context) { explicit inline Scope(Handle<Context> context) : context_(context) {
context_->Enter(); context_->Enter();
} }
inline ~Scope() { context_->Exit(); } inline ~Scope() { context_->Exit(); }
......
...@@ -53,8 +53,8 @@ class Consts { ...@@ -53,8 +53,8 @@ class Consts {
class NeanderObject { class NeanderObject {
public: public:
explicit NeanderObject(int size); explicit NeanderObject(int size);
inline NeanderObject(v8::internal::Handle<v8::internal::Object> obj); explicit inline NeanderObject(v8::internal::Handle<v8::internal::Object> obj);
inline NeanderObject(v8::internal::Object* obj); explicit inline NeanderObject(v8::internal::Object* obj);
inline v8::internal::Object* get(int index); inline v8::internal::Object* get(int index);
inline void set(int index, v8::internal::Object* value); inline void set(int index, v8::internal::Object* value);
inline v8::internal::Handle<v8::internal::JSObject> value() { return value_; } inline v8::internal::Handle<v8::internal::JSObject> value() { return value_; }
...@@ -69,7 +69,7 @@ class NeanderObject { ...@@ -69,7 +69,7 @@ class NeanderObject {
class NeanderArray { class NeanderArray {
public: public:
NeanderArray(); 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() { inline v8::internal::Handle<v8::internal::JSObject> value() {
return obj_.value(); return obj_.value();
} }
......
...@@ -3231,7 +3231,7 @@ MaybeObject* Heap::AllocateGlobalObject(JSFunction* constructor) { ...@@ -3231,7 +3231,7 @@ MaybeObject* Heap::AllocateGlobalObject(JSFunction* constructor) {
// Fill these accessors into the dictionary. // Fill these accessors into the dictionary.
DescriptorArray* descs = map->instance_descriptors(); DescriptorArray* descs = map->instance_descriptors();
for (int i = 0; i < descs->number_of_descriptors(); i++) { 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. ASSERT(details.type() == CALLBACKS); // Only accessors are expected.
PropertyDetails d = PropertyDetails d =
PropertyDetails(details.attributes(), CALLBACKS, details.index()); PropertyDetails(details.attributes(), CALLBACKS, details.index());
......
...@@ -1447,7 +1447,7 @@ class RegExpEngine: public AllStatic { ...@@ -1447,7 +1447,7 @@ class RegExpEngine: public AllStatic {
class OffsetsVector { class OffsetsVector {
public: public:
inline OffsetsVector(int num_registers) explicit inline OffsetsVector(int num_registers)
: offsets_vector_length_(num_registers) { : offsets_vector_length_(num_registers) {
if (offsets_vector_length_ > Isolate::kJSRegexpStaticOffsetsVectorSize) { if (offsets_vector_length_ > Isolate::kJSRegexpStaticOffsetsVectorSize) {
vector_ = NewArray<int>(offsets_vector_length_); vector_ = NewArray<int>(offsets_vector_length_);
......
...@@ -106,7 +106,7 @@ class VirtualFrame : public ZoneObject { ...@@ -106,7 +106,7 @@ class VirtualFrame : public ZoneObject {
inline VirtualFrame(); inline VirtualFrame();
// Construct an invalid virtual frame, used by JumpTargets. // 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. // Construct a virtual frame as a clone of an existing one.
explicit inline VirtualFrame(VirtualFrame* original); explicit inline VirtualFrame(VirtualFrame* original);
......
...@@ -1774,7 +1774,7 @@ bool DescriptorArray::IsDontEnum(int descriptor_number) { ...@@ -1774,7 +1774,7 @@ bool DescriptorArray::IsDontEnum(int descriptor_number) {
void DescriptorArray::Get(int descriptor_number, Descriptor* desc) { void DescriptorArray::Get(int descriptor_number, Descriptor* desc) {
desc->Init(GetKey(descriptor_number), desc->Init(GetKey(descriptor_number),
GetValue(descriptor_number), GetValue(descriptor_number),
GetDetails(descriptor_number)); PropertyDetails(GetDetails(descriptor_number)));
} }
...@@ -3939,6 +3939,15 @@ void AccessorInfo::set_property_attributes(PropertyAttributes attributes) { ...@@ -3939,6 +3939,15 @@ void AccessorInfo::set_property_attributes(PropertyAttributes attributes) {
set_flag(Smi::FromInt(rest_value | AttributesField::encode(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> template<typename Shape, typename Key>
void Dictionary<Shape, Key>::SetEntry(int entry, void Dictionary<Shape, Key>::SetEntry(int entry,
Object* key, Object* key,
......
...@@ -2518,7 +2518,7 @@ MaybeObject* JSObject::NormalizeProperties(PropertyNormalizationMode mode, ...@@ -2518,7 +2518,7 @@ MaybeObject* JSObject::NormalizeProperties(PropertyNormalizationMode mode,
DescriptorArray* descs = map_of_this->instance_descriptors(); DescriptorArray* descs = map_of_this->instance_descriptors();
for (int i = 0; i < descs->number_of_descriptors(); i++) { for (int i = 0; i < descs->number_of_descriptors(); i++) {
PropertyDetails details = descs->GetDetails(i); PropertyDetails details(descs->GetDetails(i));
switch (details.type()) { switch (details.type()) {
case CONSTANT_FUNCTION: { case CONSTANT_FUNCTION: {
PropertyDetails d = PropertyDetails d =
...@@ -8101,7 +8101,7 @@ int JSObject::NumberOfLocalProperties(PropertyAttributes filter) { ...@@ -8101,7 +8101,7 @@ int JSObject::NumberOfLocalProperties(PropertyAttributes filter) {
DescriptorArray* descs = map()->instance_descriptors(); DescriptorArray* descs = map()->instance_descriptors();
int result = 0; int result = 0;
for (int i = 0; i < descs->number_of_descriptors(); i++) { 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) { if (details.IsProperty() && (details.attributes() & filter) == 0) {
result++; result++;
} }
...@@ -9668,7 +9668,7 @@ void NumberDictionary::RemoveNumberEntries(uint32_t from, uint32_t to) { ...@@ -9668,7 +9668,7 @@ void NumberDictionary::RemoveNumberEntries(uint32_t from, uint32_t to) {
if (key->IsNumber()) { if (key->IsNumber()) {
uint32_t number = static_cast<uint32_t>(key->Number()); uint32_t number = static_cast<uint32_t>(key->Number());
if (from <= number && number < to) { if (from <= number && number < to) {
SetEntry(i, sentinel, sentinel, Smi::FromInt(0)); SetEntry(i, sentinel, sentinel);
removed_entries++; removed_entries++;
} }
} }
...@@ -9688,7 +9688,7 @@ Object* Dictionary<Shape, Key>::DeleteProperty(int entry, ...@@ -9688,7 +9688,7 @@ Object* Dictionary<Shape, Key>::DeleteProperty(int entry,
if (details.IsDontDelete() && mode != JSObject::FORCE_DELETION) { if (details.IsDontDelete() && mode != JSObject::FORCE_DELETION) {
return heap->false_value(); 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(); HashTable<Shape, Key>::ElementRemoved();
return heap->true_value(); return heap->true_value();
} }
......
...@@ -167,7 +167,7 @@ class PropertyDetails BASE_EMBEDDED { ...@@ -167,7 +167,7 @@ class PropertyDetails BASE_EMBEDDED {
} }
// Conversion for storing details as Object*. // Conversion for storing details as Object*.
inline PropertyDetails(Smi* smi); explicit inline PropertyDetails(Smi* smi);
inline Smi* AsSmi(); inline Smi* AsSmi();
PropertyType type() { return TypeField::decode(value_); } PropertyType type() { return TypeField::decode(value_); }
...@@ -2569,6 +2569,9 @@ class Dictionary: public HashTable<Shape, Key> { ...@@ -2569,6 +2569,9 @@ class Dictionary: public HashTable<Shape, Key> {
Object* SlowReverseLookup(Object* value); Object* SlowReverseLookup(Object* value);
// Sets the entry to (key, value) pair. // Sets the entry to (key, value) pair.
inline void SetEntry(int entry,
Object* key,
Object* value);
inline void SetEntry(int entry, inline void SetEntry(int entry,
Object* key, Object* key,
Object* value, Object* value,
...@@ -5147,7 +5150,7 @@ enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; ...@@ -5147,7 +5150,7 @@ enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL};
class StringHasher { class StringHasher {
public: public:
inline StringHasher(int length); explicit inline StringHasher(int length);
// Returns true if the hash of this string can be computed without // Returns true if the hash of this string can be computed without
// looking at the contents. // looking at the contents.
...@@ -5894,7 +5897,7 @@ class StringInputBuffer: public unibrow::InputBuffer<String, String*, 1024> { ...@@ -5894,7 +5897,7 @@ class StringInputBuffer: public unibrow::InputBuffer<String, String*, 1024> {
public: public:
virtual void Seek(unsigned pos); virtual void Seek(unsigned pos);
inline StringInputBuffer(): unibrow::InputBuffer<String, String*, 1024>() {} inline StringInputBuffer(): unibrow::InputBuffer<String, String*, 1024>() {}
inline StringInputBuffer(String* backing): explicit inline StringInputBuffer(String* backing):
unibrow::InputBuffer<String, String*, 1024>(backing) {} unibrow::InputBuffer<String, String*, 1024>(backing) {}
}; };
...@@ -5905,7 +5908,7 @@ class SafeStringInputBuffer ...@@ -5905,7 +5908,7 @@ class SafeStringInputBuffer
virtual void Seek(unsigned pos); virtual void Seek(unsigned pos);
inline SafeStringInputBuffer() inline SafeStringInputBuffer()
: unibrow::InputBuffer<String, String**, 256>() {} : unibrow::InputBuffer<String, String**, 256>() {}
inline SafeStringInputBuffer(String** backing) explicit inline SafeStringInputBuffer(String** backing)
: unibrow::InputBuffer<String, String**, 256>(backing) {} : unibrow::InputBuffer<String, String**, 256>(backing) {}
}; };
......
...@@ -185,6 +185,13 @@ class LookupResult BASE_EMBEDDED { ...@@ -185,6 +185,13 @@ class LookupResult BASE_EMBEDDED {
number_ = number; 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) { void ConstantResult(JSObject* holder) {
lookup_type_ = CONSTANT_TYPE; lookup_type_ = CONSTANT_TYPE;
holder_ = holder; holder_ = holder;
......
...@@ -220,7 +220,7 @@ class ContextSlotCache { ...@@ -220,7 +220,7 @@ class ContextSlotCache {
ASSERT(index == this->index()); ASSERT(index == this->index());
} }
inline Value(uint32_t value) : value_(value) {} explicit inline Value(uint32_t value) : value_(value) {}
uint32_t raw() { return value_; } uint32_t raw() { return value_; }
......
...@@ -272,7 +272,7 @@ class LCodeGen BASE_EMBEDDED { ...@@ -272,7 +272,7 @@ class LCodeGen BASE_EMBEDDED {
void EmitPushConstantOperand(LOperand* operand); void EmitPushConstantOperand(LOperand* operand);
struct JumpTableEntry { struct JumpTableEntry {
inline JumpTableEntry(Address entry) explicit inline JumpTableEntry(Address entry)
: label(), : label(),
address(entry) { } address(entry) { }
Label label; Label label;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment