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
This commit is contained in:
parent
544a436425
commit
690093effe
@ -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(); }
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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_);
|
||||
|
@ -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);
|
||||
|
@ -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)));
|
||||
}
|
||||
|
||||
|
||||
@ -3939,6 +3939,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,
|
||||
|
@ -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 =
|
||||
@ -8101,7 +8101,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++;
|
||||
}
|
||||
@ -9668,7 +9668,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++;
|
||||
}
|
||||
}
|
||||
@ -9688,7 +9688,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();
|
||||
}
|
||||
|
@ -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_); }
|
||||
@ -2569,6 +2569,9 @@ class Dictionary: public HashTable<Shape, Key> {
|
||||
Object* SlowReverseLookup(Object* value);
|
||||
|
||||
// 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,
|
||||
@ -5147,7 +5150,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.
|
||||
@ -5894,7 +5897,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) {}
|
||||
};
|
||||
|
||||
@ -5905,7 +5908,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) {}
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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_; }
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user