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

Side by Side Diff: src/objects.cc

Issue 39183004: Define DEBUG for v8_optimized_debug=2 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More tweaks Created 7 years, 2 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 default: 1189 default:
1190 return this; 1190 return this;
1191 } 1191 }
1192 } 1192 }
1193 1193
1194 1194
1195 bool String::MakeExternal(v8::String::ExternalStringResource* resource) { 1195 bool String::MakeExternal(v8::String::ExternalStringResource* resource) {
1196 // Externalizing twice leaks the external resource, so it's 1196 // Externalizing twice leaks the external resource, so it's
1197 // prohibited by the API. 1197 // prohibited by the API.
1198 ASSERT(!this->IsExternalString()); 1198 ASSERT(!this->IsExternalString());
1199 #ifdef DEBUG 1199 #ifdef ENABLE_SLOW_ASSERTS
1200 if (FLAG_enable_slow_asserts) { 1200 if (FLAG_enable_slow_asserts) {
1201 // Assert that the resource and the string are equivalent. 1201 // Assert that the resource and the string are equivalent.
1202 ASSERT(static_cast<size_t>(this->length()) == resource->length()); 1202 ASSERT(static_cast<size_t>(this->length()) == resource->length());
1203 ScopedVector<uc16> smart_chars(this->length()); 1203 ScopedVector<uc16> smart_chars(this->length());
1204 String::WriteToFlat(this, smart_chars.start(), 0, this->length()); 1204 String::WriteToFlat(this, smart_chars.start(), 0, this->length());
1205 ASSERT(memcmp(smart_chars.start(), 1205 ASSERT(memcmp(smart_chars.start(),
1206 resource->data(), 1206 resource->data(),
1207 resource->length() * sizeof(smart_chars[0])) == 0); 1207 resource->length() * sizeof(smart_chars[0])) == 0);
1208 } 1208 }
1209 #endif // DEBUG 1209 #endif // DEBUG
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); 1246 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size);
1247 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { 1247 if (Marking::IsBlack(Marking::MarkBitFrom(this))) {
1248 MemoryChunk::IncrementLiveBytesFromMutator(this->address(), 1248 MemoryChunk::IncrementLiveBytesFromMutator(this->address(),
1249 new_size - size); 1249 new_size - size);
1250 } 1250 }
1251 return true; 1251 return true;
1252 } 1252 }
1253 1253
1254 1254
1255 bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) { 1255 bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) {
1256 #ifdef DEBUG 1256 #ifdef ENABLE_SLOW_ASSERTS
1257 if (FLAG_enable_slow_asserts) { 1257 if (FLAG_enable_slow_asserts) {
1258 // Assert that the resource and the string are equivalent. 1258 // Assert that the resource and the string are equivalent.
1259 ASSERT(static_cast<size_t>(this->length()) == resource->length()); 1259 ASSERT(static_cast<size_t>(this->length()) == resource->length());
1260 if (this->IsTwoByteRepresentation()) { 1260 if (this->IsTwoByteRepresentation()) {
1261 ScopedVector<uint16_t> smart_chars(this->length()); 1261 ScopedVector<uint16_t> smart_chars(this->length());
1262 String::WriteToFlat(this, smart_chars.start(), 0, this->length()); 1262 String::WriteToFlat(this, smart_chars.start(), 0, this->length());
1263 ASSERT(String::IsOneByte(smart_chars.start(), this->length())); 1263 ASSERT(String::IsOneByte(smart_chars.start(), this->length()));
1264 } 1264 }
1265 ScopedVector<char> smart_chars(this->length()); 1265 ScopedVector<char> smart_chars(this->length());
1266 String::WriteToFlat(this, smart_chars.start(), 0, this->length()); 1266 String::WriteToFlat(this, smart_chars.start(), 0, this->length());
(...skipping 3209 matching lines...) Expand 10 before | Expand all | Expand 10 after
4476 Map* fast = obj->map(); 4476 Map* fast = obj->map();
4477 int index = fast->Hash() % kEntries; 4477 int index = fast->Hash() % kEntries;
4478 Object* result = cache->get(index); 4478 Object* result = cache->get(index);
4479 if (result->IsMap() && 4479 if (result->IsMap() &&
4480 Map::cast(result)->EquivalentToForNormalization(fast, mode)) { 4480 Map::cast(result)->EquivalentToForNormalization(fast, mode)) {
4481 #ifdef VERIFY_HEAP 4481 #ifdef VERIFY_HEAP
4482 if (FLAG_verify_heap) { 4482 if (FLAG_verify_heap) {
4483 Map::cast(result)->SharedMapVerify(); 4483 Map::cast(result)->SharedMapVerify();
4484 } 4484 }
4485 #endif 4485 #endif
4486 #ifdef DEBUG 4486 #ifdef ENABLE_SLOW_ASSERTS
4487 if (FLAG_enable_slow_asserts) { 4487 if (FLAG_enable_slow_asserts) {
4488 // The cached map should match newly created normalized map bit-by-bit, 4488 // The cached map should match newly created normalized map bit-by-bit,
4489 // except for the code cache, which can contain some ics which can be 4489 // except for the code cache, which can contain some ics which can be
4490 // applied to the shared map. 4490 // applied to the shared map.
4491 Object* fresh; 4491 Object* fresh;
4492 MaybeObject* maybe_fresh = 4492 MaybeObject* maybe_fresh =
4493 fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP); 4493 fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP);
4494 if (maybe_fresh->ToObject(&fresh)) { 4494 if (maybe_fresh->ToObject(&fresh)) {
4495 ASSERT(memcmp(Map::cast(fresh)->address(), 4495 ASSERT(memcmp(Map::cast(fresh)->address(),
4496 Map::cast(result)->address(), 4496 Map::cast(result)->address(),
(...skipping 3340 matching lines...) Expand 10 before | Expand all | Expand 10 after
7837 return cache; 7837 return cache;
7838 } 7838 }
7839 7839
7840 7840
7841 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { 7841 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) {
7842 ElementsAccessor* accessor = array->GetElementsAccessor(); 7842 ElementsAccessor* accessor = array->GetElementsAccessor();
7843 MaybeObject* maybe_result = 7843 MaybeObject* maybe_result =
7844 accessor->AddElementsToFixedArray(array, array, this); 7844 accessor->AddElementsToFixedArray(array, array, this);
7845 FixedArray* result; 7845 FixedArray* result;
7846 if (!maybe_result->To<FixedArray>(&result)) return maybe_result; 7846 if (!maybe_result->To<FixedArray>(&result)) return maybe_result;
7847 #ifdef DEBUG 7847 #ifdef ENABLE_SLOW_ASSERTS
7848 if (FLAG_enable_slow_asserts) { 7848 if (FLAG_enable_slow_asserts) {
7849 for (int i = 0; i < result->length(); i++) { 7849 for (int i = 0; i < result->length(); i++) {
7850 Object* current = result->get(i); 7850 Object* current = result->get(i);
7851 ASSERT(current->IsNumber() || current->IsName()); 7851 ASSERT(current->IsNumber() || current->IsName());
7852 } 7852 }
7853 } 7853 }
7854 #endif 7854 #endif
7855 return result; 7855 return result;
7856 } 7856 }
7857 7857
7858 7858
7859 MaybeObject* FixedArray::UnionOfKeys(FixedArray* other) { 7859 MaybeObject* FixedArray::UnionOfKeys(FixedArray* other) {
7860 ElementsAccessor* accessor = ElementsAccessor::ForArray(other); 7860 ElementsAccessor* accessor = ElementsAccessor::ForArray(other);
7861 MaybeObject* maybe_result = 7861 MaybeObject* maybe_result =
7862 accessor->AddElementsToFixedArray(NULL, NULL, this, other); 7862 accessor->AddElementsToFixedArray(NULL, NULL, this, other);
7863 FixedArray* result; 7863 FixedArray* result;
7864 if (!maybe_result->To(&result)) return maybe_result; 7864 if (!maybe_result->To(&result)) return maybe_result;
7865 #ifdef DEBUG 7865 #ifdef ENABLE_SLOW_ASSERTS
7866 if (FLAG_enable_slow_asserts) { 7866 if (FLAG_enable_slow_asserts) {
7867 for (int i = 0; i < result->length(); i++) { 7867 for (int i = 0; i < result->length(); i++) {
7868 Object* current = result->get(i); 7868 Object* current = result->get(i);
7869 ASSERT(current->IsNumber() || current->IsName()); 7869 ASSERT(current->IsNumber() || current->IsName());
7870 } 7870 }
7871 } 7871 }
7872 #endif 7872 #endif
7873 return result; 7873 return result;
7874 } 7874 }
7875 7875
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
8910 8910
8911 bool String::SlowEquals(String* other) { 8911 bool String::SlowEquals(String* other) {
8912 // Fast check: negative check with lengths. 8912 // Fast check: negative check with lengths.
8913 int len = length(); 8913 int len = length();
8914 if (len != other->length()) return false; 8914 if (len != other->length()) return false;
8915 if (len == 0) return true; 8915 if (len == 0) return true;
8916 8916
8917 // Fast check: if hash code is computed for both strings 8917 // Fast check: if hash code is computed for both strings
8918 // a fast negative check can be performed. 8918 // a fast negative check can be performed.
8919 if (HasHashCode() && other->HasHashCode()) { 8919 if (HasHashCode() && other->HasHashCode()) {
8920 #ifdef DEBUG 8920 #ifdef ENABLE_SLOW_ASSERTS
8921 if (FLAG_enable_slow_asserts) { 8921 if (FLAG_enable_slow_asserts) {
8922 if (Hash() != other->Hash()) { 8922 if (Hash() != other->Hash()) {
8923 bool found_difference = false; 8923 bool found_difference = false;
8924 for (int i = 0; i < len; i++) { 8924 for (int i = 0; i < len; i++) {
8925 if (Get(i) != other->Get(i)) { 8925 if (Get(i) != other->Get(i)) {
8926 found_difference = true; 8926 found_difference = true;
8927 break; 8927 break;
8928 } 8928 }
8929 } 8929 }
8930 ASSERT(found_difference); 8930 ASSERT(found_difference);
(...skipping 7483 matching lines...) Expand 10 before | Expand all | Expand 10 after
16414 #define ERROR_MESSAGES_TEXTS(C, T) T, 16414 #define ERROR_MESSAGES_TEXTS(C, T) T,
16415 static const char* error_messages_[] = { 16415 static const char* error_messages_[] = {
16416 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16416 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16417 }; 16417 };
16418 #undef ERROR_MESSAGES_TEXTS 16418 #undef ERROR_MESSAGES_TEXTS
16419 return error_messages_[reason]; 16419 return error_messages_[reason];
16420 } 16420 }
16421 16421
16422 16422
16423 } } // namespace v8::internal 16423 } } // namespace v8::internal
OLDNEW
« src/incremental-marking.cc ('K') | « src/list.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698