X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fv8%2Fsrc%2Funique.h;h=619c3c9c36fc6ee1feab8cfabd8990dc0c33419a;hb=3545e9f2671f595d2a2f3ee75ca0393b01e35ef6;hp=373a5bea8a5584f1172a7c1ebad7b1c4dbf83e1c;hpb=7d210d4c7e9ba36e635eabc5b5780495f8a63292;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/v8/src/unique.h b/src/v8/src/unique.h index 373a5be..619c3c9 100644 --- a/src/v8/src/unique.h +++ b/src/v8/src/unique.h @@ -5,8 +5,8 @@ #ifndef V8_HYDROGEN_UNIQUE_H_ #define V8_HYDROGEN_UNIQUE_H_ -#include "src/handles.h" -#include "src/objects.h" +#include "src/handles-inl.h" // TODO(everyone): Fix our inl.h crap +#include "src/objects-inl.h" // TODO(everyone): Fix our inl.h crap #include "src/string-stream.h" #include "src/utils.h" #include "src/zone.h" @@ -32,6 +32,8 @@ class UniqueSet; template class Unique { public: + Unique() : raw_address_(NULL) {} + // TODO(titzer): make private and introduce a uniqueness scope. explicit Unique(Handle handle) { if (handle.is_null()) { @@ -118,12 +120,8 @@ class Unique { friend class UniqueSet; // Uses internal details for speed. template friend class Unique; // For comparing raw_address values. - template - friend class PrintableUnique; // For automatic up casting. protected: - Unique() : raw_address_(NULL) { } - Address raw_address_; Handle handle_; @@ -131,72 +129,8 @@ class Unique { }; -// TODO(danno): At some point if all of the uses of Unique end up using -// PrintableUnique, then we should merge PrintableUnique into Unique and -// predicate generating the printable string on a "am I tracing" check. -template -class PrintableUnique : public Unique { - public: - // TODO(titzer): make private and introduce a uniqueness scope. - explicit PrintableUnique(Zone* zone, Handle handle) : Unique(handle) { - InitializeString(zone); - } - - // TODO(titzer): this is a hack to migrate to Unique incrementally. - PrintableUnique(Zone* zone, Address raw_address, Handle handle) - : Unique(raw_address, handle) { - InitializeString(zone); - } - - // Constructor for handling automatic up casting. - // Eg. PrintableUnique can be passed when PrintableUnique - // is expected. - template - PrintableUnique(PrintableUnique uniq) // NOLINT - : Unique(Handle()) { -#ifdef DEBUG - T* a = NULL; - S* b = NULL; - a = b; // Fake assignment to enforce type checks. - USE(a); -#endif - this->raw_address_ = uniq.raw_address_; - this->handle_ = uniq.handle_; - string_ = uniq.string(); - } - - // TODO(titzer): this is a hack to migrate to Unique incrementally. - static PrintableUnique CreateUninitialized(Zone* zone, Handle handle) { - return PrintableUnique(zone, reinterpret_cast
(NULL), handle); - } - - static PrintableUnique CreateImmovable(Zone* zone, Handle handle) { - return PrintableUnique(zone, reinterpret_cast
(*handle), handle); - } - - const char* string() { return string_; } - - private: - const char* string_; - - void InitializeString(Zone* zone) { - // The stringified version of the parameter must be calculated when the - // Operator is constructed to avoid accessing the heap. - HeapStringAllocator temp_allocator; - StringStream stream(&temp_allocator); - this->handle_->ShortPrint(&stream); - SmartArrayPointer desc_string = stream.ToCString(); - const char* desc_chars = desc_string.get(); - int length = static_cast(strlen(desc_chars)); - char* desc_copy = zone->NewArray(length + 1); - memcpy(desc_copy, desc_chars, length + 1); - string_ = desc_copy; - } -}; - - template -class UniqueSet V8_FINAL : public ZoneObject { +class UniqueSet FINAL : public ZoneObject { public: // Constructor. A new set will be empty. UniqueSet() : size_(0), capacity_(0), array_(NULL) { }