| OLD | NEW |
| 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 6566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6577 int old_size = descriptors->number_of_descriptors(); | 6577 int old_size = descriptors->number_of_descriptors(); |
| 6578 | 6578 |
| 6579 DescriptorArray* new_descriptors; | 6579 DescriptorArray* new_descriptors; |
| 6580 | 6580 |
| 6581 if (descriptors->NumberOfSlackDescriptors() > 0) { | 6581 if (descriptors->NumberOfSlackDescriptors() > 0) { |
| 6582 new_descriptors = descriptors; | 6582 new_descriptors = descriptors; |
| 6583 new_descriptors->Append(descriptor); | 6583 new_descriptors->Append(descriptor); |
| 6584 } else { | 6584 } else { |
| 6585 // Descriptor arrays grow by 50%. | 6585 // Descriptor arrays grow by 50%. |
| 6586 MaybeObject* maybe_descriptors = DescriptorArray::Allocate( | 6586 MaybeObject* maybe_descriptors = DescriptorArray::Allocate( |
| 6587 old_size, old_size < 4 ? 1 : old_size / 2); | 6587 GetIsolate(), old_size, old_size < 4 ? 1 : old_size / 2); |
| 6588 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; | 6588 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; |
| 6589 | 6589 |
| 6590 DescriptorArray::WhitenessWitness witness(new_descriptors); | 6590 DescriptorArray::WhitenessWitness witness(new_descriptors); |
| 6591 | 6591 |
| 6592 // Copy the descriptors, inserting a descriptor. | 6592 // Copy the descriptors, inserting a descriptor. |
| 6593 for (int i = 0; i < old_size; ++i) { | 6593 for (int i = 0; i < old_size; ++i) { |
| 6594 new_descriptors->CopyFrom(i, descriptors, i, witness); | 6594 new_descriptors->CopyFrom(i, descriptors, i, witness); |
| 6595 } | 6595 } |
| 6596 | 6596 |
| 6597 new_descriptors->Append(descriptor, witness); | 6597 new_descriptors->Append(descriptor, witness); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6827 int old_size = NumberOfOwnDescriptors(); | 6827 int old_size = NumberOfOwnDescriptors(); |
| 6828 int new_size = old_size + 1; | 6828 int new_size = old_size + 1; |
| 6829 | 6829 |
| 6830 if (flag == INSERT_TRANSITION && | 6830 if (flag == INSERT_TRANSITION && |
| 6831 owns_descriptors() && | 6831 owns_descriptors() && |
| 6832 CanHaveMoreTransitions()) { | 6832 CanHaveMoreTransitions()) { |
| 6833 return ShareDescriptor(descriptors, descriptor); | 6833 return ShareDescriptor(descriptors, descriptor); |
| 6834 } | 6834 } |
| 6835 | 6835 |
| 6836 DescriptorArray* new_descriptors; | 6836 DescriptorArray* new_descriptors; |
| 6837 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(old_size, 1); | 6837 MaybeObject* maybe_descriptors = |
| 6838 DescriptorArray::Allocate(GetIsolate(), old_size, 1); |
| 6838 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; | 6839 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; |
| 6839 | 6840 |
| 6840 DescriptorArray::WhitenessWitness witness(new_descriptors); | 6841 DescriptorArray::WhitenessWitness witness(new_descriptors); |
| 6841 | 6842 |
| 6842 // Copy the descriptors, inserting a descriptor. | 6843 // Copy the descriptors, inserting a descriptor. |
| 6843 for (int i = 0; i < old_size; ++i) { | 6844 for (int i = 0; i < old_size; ++i) { |
| 6844 new_descriptors->CopyFrom(i, descriptors, i, witness); | 6845 new_descriptors->CopyFrom(i, descriptors, i, witness); |
| 6845 } | 6846 } |
| 6846 | 6847 |
| 6847 if (old_size != descriptors->number_of_descriptors()) { | 6848 if (old_size != descriptors->number_of_descriptors()) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 6874 } | 6875 } |
| 6875 | 6876 |
| 6876 | 6877 |
| 6877 MaybeObject* DescriptorArray::CopyUpToAddAttributes( | 6878 MaybeObject* DescriptorArray::CopyUpToAddAttributes( |
| 6878 int enumeration_index, PropertyAttributes attributes) { | 6879 int enumeration_index, PropertyAttributes attributes) { |
| 6879 if (enumeration_index == 0) return GetHeap()->empty_descriptor_array(); | 6880 if (enumeration_index == 0) return GetHeap()->empty_descriptor_array(); |
| 6880 | 6881 |
| 6881 int size = enumeration_index; | 6882 int size = enumeration_index; |
| 6882 | 6883 |
| 6883 DescriptorArray* descriptors; | 6884 DescriptorArray* descriptors; |
| 6884 MaybeObject* maybe_descriptors = Allocate(size); | 6885 MaybeObject* maybe_descriptors = Allocate(GetIsolate(), size); |
| 6885 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; | 6886 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; |
| 6886 DescriptorArray::WhitenessWitness witness(descriptors); | 6887 DescriptorArray::WhitenessWitness witness(descriptors); |
| 6887 | 6888 |
| 6888 if (attributes != NONE) { | 6889 if (attributes != NONE) { |
| 6889 for (int i = 0; i < size; ++i) { | 6890 for (int i = 0; i < size; ++i) { |
| 6890 Object* value = GetValue(i); | 6891 Object* value = GetValue(i); |
| 6891 PropertyDetails details = GetDetails(i); | 6892 PropertyDetails details = GetDetails(i); |
| 6892 int mask = DONT_DELETE | DONT_ENUM; | 6893 int mask = DONT_DELETE | DONT_ENUM; |
| 6893 // READ_ONLY is an invalid attribute for JS setters/getters. | 6894 // READ_ONLY is an invalid attribute for JS setters/getters. |
| 6894 if (details.type() != CALLBACKS || !value->IsAccessorPair()) { | 6895 if (details.type() != CALLBACKS || !value->IsAccessorPair()) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 6921 | 6922 |
| 6922 Name* key = descriptor->GetKey(); | 6923 Name* key = descriptor->GetKey(); |
| 6923 ASSERT(key == descriptors->GetKey(insertion_index)); | 6924 ASSERT(key == descriptors->GetKey(insertion_index)); |
| 6924 | 6925 |
| 6925 int new_size = NumberOfOwnDescriptors(); | 6926 int new_size = NumberOfOwnDescriptors(); |
| 6926 ASSERT(0 <= insertion_index && insertion_index < new_size); | 6927 ASSERT(0 <= insertion_index && insertion_index < new_size); |
| 6927 | 6928 |
| 6928 ASSERT_LT(insertion_index, new_size); | 6929 ASSERT_LT(insertion_index, new_size); |
| 6929 | 6930 |
| 6930 DescriptorArray* new_descriptors; | 6931 DescriptorArray* new_descriptors; |
| 6931 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(new_size); | 6932 MaybeObject* maybe_descriptors = |
| 6933 DescriptorArray::Allocate(GetIsolate(), new_size); |
| 6932 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; | 6934 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; |
| 6933 DescriptorArray::WhitenessWitness witness(new_descriptors); | 6935 DescriptorArray::WhitenessWitness witness(new_descriptors); |
| 6934 | 6936 |
| 6935 for (int i = 0; i < new_size; ++i) { | 6937 for (int i = 0; i < new_size; ++i) { |
| 6936 if (i == insertion_index) { | 6938 if (i == insertion_index) { |
| 6937 new_descriptors->Set(i, descriptor, witness); | 6939 new_descriptors->Set(i, descriptor, witness); |
| 6938 } else { | 6940 } else { |
| 6939 new_descriptors->CopyFrom(i, descriptors, i, witness); | 6941 new_descriptors->CopyFrom(i, descriptors, i, witness); |
| 6940 } | 6942 } |
| 6941 } | 6943 } |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7711 bool FixedArray::IsEqualTo(FixedArray* other) { | 7713 bool FixedArray::IsEqualTo(FixedArray* other) { |
| 7712 if (length() != other->length()) return false; | 7714 if (length() != other->length()) return false; |
| 7713 for (int i = 0 ; i < length(); ++i) { | 7715 for (int i = 0 ; i < length(); ++i) { |
| 7714 if (get(i) != other->get(i)) return false; | 7716 if (get(i) != other->get(i)) return false; |
| 7715 } | 7717 } |
| 7716 return true; | 7718 return true; |
| 7717 } | 7719 } |
| 7718 #endif | 7720 #endif |
| 7719 | 7721 |
| 7720 | 7722 |
| 7721 MaybeObject* DescriptorArray::Allocate(int number_of_descriptors, int slack) { | 7723 MaybeObject* DescriptorArray::Allocate(Isolate* isolate, |
| 7722 Heap* heap = Isolate::Current()->heap(); | 7724 int number_of_descriptors, |
| 7725 int slack) { |
| 7726 Heap* heap = isolate->heap(); |
| 7723 // Do not use DescriptorArray::cast on incomplete object. | 7727 // Do not use DescriptorArray::cast on incomplete object. |
| 7724 int size = number_of_descriptors + slack; | 7728 int size = number_of_descriptors + slack; |
| 7725 if (size == 0) return heap->empty_descriptor_array(); | 7729 if (size == 0) return heap->empty_descriptor_array(); |
| 7726 FixedArray* result; | 7730 FixedArray* result; |
| 7727 // Allocate the array of keys. | 7731 // Allocate the array of keys. |
| 7728 MaybeObject* maybe_array = heap->AllocateFixedArray(LengthFor(size)); | 7732 MaybeObject* maybe_array = heap->AllocateFixedArray(LengthFor(size)); |
| 7729 if (!maybe_array->To(&result)) return maybe_array; | 7733 if (!maybe_array->To(&result)) return maybe_array; |
| 7730 | 7734 |
| 7731 result->set(kDescriptorLengthIndex, Smi::FromInt(number_of_descriptors)); | 7735 result->set(kDescriptorLengthIndex, Smi::FromInt(number_of_descriptors)); |
| 7732 result->set(kEnumCacheIndex, Smi::FromInt(0)); | 7736 result->set(kEnumCacheIndex, Smi::FromInt(0)); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7780 int modify_index, | 7784 int modify_index, |
| 7781 StoreMode store_mode, | 7785 StoreMode store_mode, |
| 7782 DescriptorArray* other) { | 7786 DescriptorArray* other) { |
| 7783 ASSERT(verbatim <= valid); | 7787 ASSERT(verbatim <= valid); |
| 7784 ASSERT(valid <= new_size); | 7788 ASSERT(valid <= new_size); |
| 7785 | 7789 |
| 7786 DescriptorArray* result; | 7790 DescriptorArray* result; |
| 7787 // Allocate a new descriptor array large enough to hold the required | 7791 // Allocate a new descriptor array large enough to hold the required |
| 7788 // descriptors, with minimally the exact same size as this descriptor array. | 7792 // descriptors, with minimally the exact same size as this descriptor array. |
| 7789 MaybeObject* maybe_descriptors = DescriptorArray::Allocate( | 7793 MaybeObject* maybe_descriptors = DescriptorArray::Allocate( |
| 7790 new_size, Max(new_size, other->number_of_descriptors()) - new_size); | 7794 GetIsolate(), new_size, |
| 7795 Max(new_size, other->number_of_descriptors()) - new_size); |
| 7791 if (!maybe_descriptors->To(&result)) return maybe_descriptors; | 7796 if (!maybe_descriptors->To(&result)) return maybe_descriptors; |
| 7792 ASSERT(result->length() > length() || | 7797 ASSERT(result->length() > length() || |
| 7793 result->NumberOfSlackDescriptors() > 0 || | 7798 result->NumberOfSlackDescriptors() > 0 || |
| 7794 result->number_of_descriptors() == other->number_of_descriptors()); | 7799 result->number_of_descriptors() == other->number_of_descriptors()); |
| 7795 ASSERT(result->number_of_descriptors() == new_size); | 7800 ASSERT(result->number_of_descriptors() == new_size); |
| 7796 | 7801 |
| 7797 DescriptorArray::WhitenessWitness witness(result); | 7802 DescriptorArray::WhitenessWitness witness(result); |
| 7798 | 7803 |
| 7799 int descriptor; | 7804 int descriptor; |
| 7800 | 7805 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7996 | 8001 |
| 7997 | 8002 |
| 7998 bool Name::IsCacheable(Isolate* isolate) { | 8003 bool Name::IsCacheable(Isolate* isolate) { |
| 7999 return IsSymbol() || | 8004 return IsSymbol() || |
| 8000 IsIdentifier(isolate->unicode_cache(), this) || | 8005 IsIdentifier(isolate->unicode_cache(), this) || |
| 8001 this == isolate->heap()->hidden_string(); | 8006 this == isolate->heap()->hidden_string(); |
| 8002 } | 8007 } |
| 8003 | 8008 |
| 8004 | 8009 |
| 8005 bool String::LooksValid() { | 8010 bool String::LooksValid() { |
| 8006 if (!Isolate::Current()->heap()->Contains(this)) return false; | 8011 if (!GetIsolate()->heap()->Contains(this)) return false; |
| 8007 return true; | 8012 return true; |
| 8008 } | 8013 } |
| 8009 | 8014 |
| 8010 | 8015 |
| 8011 String::FlatContent String::GetFlatContent() { | 8016 String::FlatContent String::GetFlatContent() { |
| 8012 ASSERT(!AllowHeapAllocation::IsAllowed()); | 8017 ASSERT(!AllowHeapAllocation::IsAllowed()); |
| 8013 int length = this->length(); | 8018 int length = this->length(); |
| 8014 StringShape shape(this); | 8019 StringShape shape(this); |
| 8015 String* string = this; | 8020 String* string = this; |
| 8016 int offset = 0; | 8021 int offset = 0; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8156 return SmartArrayPointer<uc16>(result); | 8161 return SmartArrayPointer<uc16>(result); |
| 8157 } | 8162 } |
| 8158 | 8163 |
| 8159 | 8164 |
| 8160 const uc16* SeqTwoByteString::SeqTwoByteStringGetData(unsigned start) { | 8165 const uc16* SeqTwoByteString::SeqTwoByteStringGetData(unsigned start) { |
| 8161 return reinterpret_cast<uc16*>( | 8166 return reinterpret_cast<uc16*>( |
| 8162 reinterpret_cast<char*>(this) - kHeapObjectTag + kHeaderSize) + start; | 8167 reinterpret_cast<char*>(this) - kHeapObjectTag + kHeaderSize) + start; |
| 8163 } | 8168 } |
| 8164 | 8169 |
| 8165 | 8170 |
| 8166 void Relocatable::PostGarbageCollectionProcessing() { | 8171 void Relocatable::PostGarbageCollectionProcessing(Isolate* isolate) { |
| 8167 Isolate* isolate = Isolate::Current(); | |
| 8168 Relocatable* current = isolate->relocatable_top(); | 8172 Relocatable* current = isolate->relocatable_top(); |
| 8169 while (current != NULL) { | 8173 while (current != NULL) { |
| 8170 current->PostGarbageCollection(); | 8174 current->PostGarbageCollection(); |
| 8171 current = current->prev_; | 8175 current = current->prev_; |
| 8172 } | 8176 } |
| 8173 } | 8177 } |
| 8174 | 8178 |
| 8175 | 8179 |
| 8176 // Reserve space for statics needing saving and restoring. | 8180 // Reserve space for statics needing saving and restoring. |
| 8177 int Relocatable::ArchiveSpacePerThread() { | 8181 int Relocatable::ArchiveSpacePerThread(Isolate* isolate) { |
| 8178 return sizeof(Isolate::Current()->relocatable_top()); | 8182 return sizeof(isolate->relocatable_top()); |
| 8179 } | 8183 } |
| 8180 | 8184 |
| 8181 | 8185 |
| 8182 // Archive statics that are thread local. | 8186 // Archive statics that are thread local. |
| 8183 char* Relocatable::ArchiveState(Isolate* isolate, char* to) { | 8187 char* Relocatable::ArchiveState(Isolate* isolate, char* to) { |
| 8184 *reinterpret_cast<Relocatable**>(to) = isolate->relocatable_top(); | 8188 *reinterpret_cast<Relocatable**>(to) = isolate->relocatable_top(); |
| 8185 isolate->set_relocatable_top(NULL); | 8189 isolate->set_relocatable_top(NULL); |
| 8186 return to + ArchiveSpacePerThread(); | 8190 return to + ArchiveSpacePerThread(isolate); |
| 8187 } | 8191 } |
| 8188 | 8192 |
| 8189 | 8193 |
| 8190 // Restore statics that are thread local. | 8194 // Restore statics that are thread local. |
| 8191 char* Relocatable::RestoreState(Isolate* isolate, char* from) { | 8195 char* Relocatable::RestoreState(Isolate* isolate, char* from) { |
| 8192 isolate->set_relocatable_top(*reinterpret_cast<Relocatable**>(from)); | 8196 isolate->set_relocatable_top(*reinterpret_cast<Relocatable**>(from)); |
| 8193 return from + ArchiveSpacePerThread(); | 8197 return from + ArchiveSpacePerThread(isolate); |
| 8194 } | 8198 } |
| 8195 | 8199 |
| 8196 | 8200 |
| 8197 char* Relocatable::Iterate(ObjectVisitor* v, char* thread_storage) { | 8201 char* Relocatable::Iterate( |
| 8202 Isolate* isolate, ObjectVisitor* v, char* thread_storage) { |
| 8198 Relocatable* top = *reinterpret_cast<Relocatable**>(thread_storage); | 8203 Relocatable* top = *reinterpret_cast<Relocatable**>(thread_storage); |
| 8199 Iterate(v, top); | 8204 Iterate(v, top); |
| 8200 return thread_storage + ArchiveSpacePerThread(); | 8205 return thread_storage + ArchiveSpacePerThread(isolate); |
| 8201 } | 8206 } |
| 8202 | 8207 |
| 8203 | 8208 |
| 8204 void Relocatable::Iterate(ObjectVisitor* v) { | 8209 void Relocatable::Iterate(Isolate* isolate, ObjectVisitor* v) { |
| 8205 Isolate* isolate = Isolate::Current(); | |
| 8206 Iterate(v, isolate->relocatable_top()); | 8210 Iterate(v, isolate->relocatable_top()); |
| 8207 } | 8211 } |
| 8208 | 8212 |
| 8209 | 8213 |
| 8210 void Relocatable::Iterate(ObjectVisitor* v, Relocatable* top) { | 8214 void Relocatable::Iterate(ObjectVisitor* v, Relocatable* top) { |
| 8211 Relocatable* current = top; | 8215 Relocatable* current = top; |
| 8212 while (current != NULL) { | 8216 while (current != NULL) { |
| 8213 current->IterateInstance(v); | 8217 current->IterateInstance(v); |
| 8214 current = current->prev_; | 8218 current = current->prev_; |
| 8215 } | 8219 } |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9309 // No write barrier required, since the builtin is part of the root set. | 9313 // No write barrier required, since the builtin is part of the root set. |
| 9310 } | 9314 } |
| 9311 | 9315 |
| 9312 | 9316 |
| 9313 static bool CompileLazyHelper(CompilationInfo* info, | 9317 static bool CompileLazyHelper(CompilationInfo* info, |
| 9314 ClearExceptionFlag flag) { | 9318 ClearExceptionFlag flag) { |
| 9315 // Compile the source information to a code object. | 9319 // Compile the source information to a code object. |
| 9316 ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled()); | 9320 ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled()); |
| 9317 ASSERT(!info->isolate()->has_pending_exception()); | 9321 ASSERT(!info->isolate()->has_pending_exception()); |
| 9318 bool result = Compiler::CompileLazy(info); | 9322 bool result = Compiler::CompileLazy(info); |
| 9319 ASSERT(result != Isolate::Current()->has_pending_exception()); | 9323 ASSERT(result != info->isolate()->has_pending_exception()); |
| 9320 if (!result && flag == CLEAR_EXCEPTION) { | 9324 if (!result && flag == CLEAR_EXCEPTION) { |
| 9321 info->isolate()->clear_pending_exception(); | 9325 info->isolate()->clear_pending_exception(); |
| 9322 } | 9326 } |
| 9323 return result; | 9327 return result; |
| 9324 } | 9328 } |
| 9325 | 9329 |
| 9326 | 9330 |
| 9327 bool SharedFunctionInfo::CompileLazy(Handle<SharedFunctionInfo> shared, | 9331 bool SharedFunctionInfo::CompileLazy(Handle<SharedFunctionInfo> shared, |
| 9328 ClearExceptionFlag flag) { | 9332 ClearExceptionFlag flag) { |
| 9329 ASSERT(shared->allows_lazy_compilation_without_context()); | 9333 ASSERT(shared->allows_lazy_compilation_without_context()); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9699 return true; | 9703 return true; |
| 9700 } | 9704 } |
| 9701 if (filter[filter.length() - 1] == '*' && | 9705 if (filter[filter.length() - 1] == '*' && |
| 9702 name->IsUtf8EqualTo(filter.SubVector(0, filter.length() - 1), true)) { | 9706 name->IsUtf8EqualTo(filter.SubVector(0, filter.length() - 1), true)) { |
| 9703 return true; | 9707 return true; |
| 9704 } | 9708 } |
| 9705 return false; | 9709 return false; |
| 9706 } | 9710 } |
| 9707 | 9711 |
| 9708 | 9712 |
| 9709 MaybeObject* Oddball::Initialize(const char* to_string, | 9713 MaybeObject* Oddball::Initialize(Heap* heap, |
| 9714 const char* to_string, |
| 9710 Object* to_number, | 9715 Object* to_number, |
| 9711 byte kind) { | 9716 byte kind) { |
| 9712 String* internalized_to_string; | 9717 String* internalized_to_string; |
| 9713 { MaybeObject* maybe_string = | 9718 { MaybeObject* maybe_string = |
| 9714 Isolate::Current()->heap()->InternalizeUtf8String( | 9719 heap->InternalizeUtf8String( |
| 9715 CStrVector(to_string)); | 9720 CStrVector(to_string)); |
| 9716 if (!maybe_string->To(&internalized_to_string)) return maybe_string; | 9721 if (!maybe_string->To(&internalized_to_string)) return maybe_string; |
| 9717 } | 9722 } |
| 9718 set_to_string(internalized_to_string); | 9723 set_to_string(internalized_to_string); |
| 9719 set_to_number(to_number); | 9724 set_to_number(to_number); |
| 9720 set_kind(kind); | 9725 set_kind(kind); |
| 9721 return this; | 9726 return this; |
| 9722 } | 9727 } |
| 9723 | 9728 |
| 9724 | 9729 |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10425 } | 10430 } |
| 10426 Age age; | 10431 Age age; |
| 10427 MarkingParity parity; | 10432 MarkingParity parity; |
| 10428 GetCodeAgeAndParity(sequence, &age, &parity); | 10433 GetCodeAgeAndParity(sequence, &age, &parity); |
| 10429 return age; | 10434 return age; |
| 10430 } | 10435 } |
| 10431 | 10436 |
| 10432 | 10437 |
| 10433 void Code::GetCodeAgeAndParity(Code* code, Age* age, | 10438 void Code::GetCodeAgeAndParity(Code* code, Age* age, |
| 10434 MarkingParity* parity) { | 10439 MarkingParity* parity) { |
| 10435 Isolate* isolate = Isolate::Current(); | 10440 Isolate* isolate = code->GetIsolate(); |
| 10436 Builtins* builtins = isolate->builtins(); | 10441 Builtins* builtins = isolate->builtins(); |
| 10437 Code* stub = NULL; | 10442 Code* stub = NULL; |
| 10438 #define HANDLE_CODE_AGE(AGE) \ | 10443 #define HANDLE_CODE_AGE(AGE) \ |
| 10439 stub = *builtins->Make##AGE##CodeYoungAgainEvenMarking(); \ | 10444 stub = *builtins->Make##AGE##CodeYoungAgainEvenMarking(); \ |
| 10440 if (code == stub) { \ | 10445 if (code == stub) { \ |
| 10441 *age = k##AGE##CodeAge; \ | 10446 *age = k##AGE##CodeAge; \ |
| 10442 *parity = EVEN_MARKING_PARITY; \ | 10447 *parity = EVEN_MARKING_PARITY; \ |
| 10443 return; \ | 10448 return; \ |
| 10444 } \ | 10449 } \ |
| 10445 stub = *builtins->Make##AGE##CodeYoungAgainOddMarking(); \ | 10450 stub = *builtins->Make##AGE##CodeYoungAgainOddMarking(); \ |
| (...skipping 4810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15256 obj->set_map(new_map); | 15261 obj->set_map(new_map); |
| 15257 obj->set_properties(heap->empty_fixed_array()); | 15262 obj->set_properties(heap->empty_fixed_array()); |
| 15258 // Check that it really works. | 15263 // Check that it really works. |
| 15259 ASSERT(obj->HasFastProperties()); | 15264 ASSERT(obj->HasFastProperties()); |
| 15260 return obj; | 15265 return obj; |
| 15261 } | 15266 } |
| 15262 | 15267 |
| 15263 // Allocate the instance descriptor. | 15268 // Allocate the instance descriptor. |
| 15264 DescriptorArray* descriptors; | 15269 DescriptorArray* descriptors; |
| 15265 MaybeObject* maybe_descriptors = | 15270 MaybeObject* maybe_descriptors = |
| 15266 DescriptorArray::Allocate(instance_descriptor_length); | 15271 DescriptorArray::Allocate(GetIsolate(), instance_descriptor_length); |
| 15267 if (!maybe_descriptors->To(&descriptors)) { | 15272 if (!maybe_descriptors->To(&descriptors)) { |
| 15268 return maybe_descriptors; | 15273 return maybe_descriptors; |
| 15269 } | 15274 } |
| 15270 | 15275 |
| 15271 DescriptorArray::WhitenessWitness witness(descriptors); | 15276 DescriptorArray::WhitenessWitness witness(descriptors); |
| 15272 | 15277 |
| 15273 int number_of_allocated_fields = | 15278 int number_of_allocated_fields = |
| 15274 number_of_fields + unused_property_fields - inobject_props; | 15279 number_of_fields + unused_property_fields - inobject_props; |
| 15275 if (number_of_allocated_fields < 0) { | 15280 if (number_of_allocated_fields < 0) { |
| 15276 // There is enough inobject space for all fields (including unused). | 15281 // There is enough inobject space for all fields (including unused). |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15549 if (index == kNoBreakPointInfo) return GetHeap()->undefined_value(); | 15554 if (index == kNoBreakPointInfo) return GetHeap()->undefined_value(); |
| 15550 return BreakPointInfo::cast(break_points()->get(index)); | 15555 return BreakPointInfo::cast(break_points()->get(index)); |
| 15551 } | 15556 } |
| 15552 | 15557 |
| 15553 | 15558 |
| 15554 // Clear a break point at the specified code position. | 15559 // Clear a break point at the specified code position. |
| 15555 void DebugInfo::ClearBreakPoint(Handle<DebugInfo> debug_info, | 15560 void DebugInfo::ClearBreakPoint(Handle<DebugInfo> debug_info, |
| 15556 int code_position, | 15561 int code_position, |
| 15557 Handle<Object> break_point_object) { | 15562 Handle<Object> break_point_object) { |
| 15558 Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position), | 15563 Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position), |
| 15559 Isolate::Current()); | 15564 debug_info->GetIsolate()); |
| 15560 if (break_point_info->IsUndefined()) return; | 15565 if (break_point_info->IsUndefined()) return; |
| 15561 BreakPointInfo::ClearBreakPoint( | 15566 BreakPointInfo::ClearBreakPoint( |
| 15562 Handle<BreakPointInfo>::cast(break_point_info), | 15567 Handle<BreakPointInfo>::cast(break_point_info), |
| 15563 break_point_object); | 15568 break_point_object); |
| 15564 } | 15569 } |
| 15565 | 15570 |
| 15566 | 15571 |
| 15567 void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info, | 15572 void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info, |
| 15568 int code_position, | 15573 int code_position, |
| 15569 int source_position, | 15574 int source_position, |
| 15570 int statement_position, | 15575 int statement_position, |
| 15571 Handle<Object> break_point_object) { | 15576 Handle<Object> break_point_object) { |
| 15572 Isolate* isolate = Isolate::Current(); | 15577 Isolate* isolate = debug_info->GetIsolate(); |
| 15573 Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position), | 15578 Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position), |
| 15574 isolate); | 15579 isolate); |
| 15575 if (!break_point_info->IsUndefined()) { | 15580 if (!break_point_info->IsUndefined()) { |
| 15576 BreakPointInfo::SetBreakPoint( | 15581 BreakPointInfo::SetBreakPoint( |
| 15577 Handle<BreakPointInfo>::cast(break_point_info), | 15582 Handle<BreakPointInfo>::cast(break_point_info), |
| 15578 break_point_object); | 15583 break_point_object); |
| 15579 return; | 15584 return; |
| 15580 } | 15585 } |
| 15581 | 15586 |
| 15582 // Adding a new break point for a code position which did not have any | 15587 // Adding a new break point for a code position which did not have any |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15676 } | 15681 } |
| 15677 } | 15682 } |
| 15678 } | 15683 } |
| 15679 return kNoBreakPointInfo; | 15684 return kNoBreakPointInfo; |
| 15680 } | 15685 } |
| 15681 | 15686 |
| 15682 | 15687 |
| 15683 // Remove the specified break point object. | 15688 // Remove the specified break point object. |
| 15684 void BreakPointInfo::ClearBreakPoint(Handle<BreakPointInfo> break_point_info, | 15689 void BreakPointInfo::ClearBreakPoint(Handle<BreakPointInfo> break_point_info, |
| 15685 Handle<Object> break_point_object) { | 15690 Handle<Object> break_point_object) { |
| 15686 Isolate* isolate = Isolate::Current(); | 15691 Isolate* isolate = break_point_info->GetIsolate(); |
| 15687 // If there are no break points just ignore. | 15692 // If there are no break points just ignore. |
| 15688 if (break_point_info->break_point_objects()->IsUndefined()) return; | 15693 if (break_point_info->break_point_objects()->IsUndefined()) return; |
| 15689 // If there is a single break point clear it if it is the same. | 15694 // If there is a single break point clear it if it is the same. |
| 15690 if (!break_point_info->break_point_objects()->IsFixedArray()) { | 15695 if (!break_point_info->break_point_objects()->IsFixedArray()) { |
| 15691 if (break_point_info->break_point_objects() == *break_point_object) { | 15696 if (break_point_info->break_point_objects() == *break_point_object) { |
| 15692 break_point_info->set_break_point_objects( | 15697 break_point_info->set_break_point_objects( |
| 15693 isolate->heap()->undefined_value()); | 15698 isolate->heap()->undefined_value()); |
| 15694 } | 15699 } |
| 15695 return; | 15700 return; |
| 15696 } | 15701 } |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16016 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16021 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16017 static const char* error_messages_[] = { | 16022 static const char* error_messages_[] = { |
| 16018 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16023 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16019 }; | 16024 }; |
| 16020 #undef ERROR_MESSAGES_TEXTS | 16025 #undef ERROR_MESSAGES_TEXTS |
| 16021 return error_messages_[reason]; | 16026 return error_messages_[reason]; |
| 16022 } | 16027 } |
| 16023 | 16028 |
| 16024 | 16029 |
| 16025 } } // namespace v8::internal | 16030 } } // namespace v8::internal |
| OLD | NEW |