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

Side by Side Diff: src/objects.cc

Issue 1942163002: Remove some dead code in src/objects.cc (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 8154 matching lines...) Expand 10 before | Expand all | Expand 10 after
8165 return true; 8165 return true;
8166 } 8166 }
8167 return object->elements()->length() > 0; 8167 return object->elements()->length() > 0;
8168 case NO_ELEMENTS: 8168 case NO_ELEMENTS:
8169 return false; 8169 return false;
8170 } 8170 }
8171 UNREACHABLE(); 8171 UNREACHABLE();
8172 return true; 8172 return true;
8173 } 8173 }
8174 8174
8175 // Tests for the fast common case for property enumeration:
8176 // - This object and all prototypes has an enum cache (which means that
8177 // it is no proxy, has no interceptors and needs no access checks).
8178 // - This object has no elements.
8179 // - No prototype has enumerable properties/elements.
8180 bool JSReceiver::IsSimpleEnum() {
8181 for (PrototypeIterator iter(GetIsolate(), this,
8182 PrototypeIterator::START_AT_RECEIVER);
8183 !iter.IsAtEnd(); iter.Advance()) {
8184 if (!iter.GetCurrent()->IsJSObject()) return false;
8185 JSObject* current = iter.GetCurrent<JSObject>();
8186 int enum_length = current->map()->EnumLength();
8187 if (enum_length == kInvalidEnumCacheSentinel) return false;
8188 if (current->IsAccessCheckNeeded()) return false;
8189 DCHECK(!current->HasNamedInterceptor());
8190 DCHECK(!current->HasIndexedInterceptor());
8191 if (current->HasEnumerableElements()) return false;
8192 if (current != this && enum_length != 0) return false;
8193 }
8194 return true;
8195 }
8196
8197 8175
8198 int Map::NumberOfDescribedProperties(DescriptorFlag which, 8176 int Map::NumberOfDescribedProperties(DescriptorFlag which,
8199 PropertyFilter filter) { 8177 PropertyFilter filter) {
8200 int result = 0; 8178 int result = 0;
8201 DescriptorArray* descs = instance_descriptors(); 8179 DescriptorArray* descs = instance_descriptors();
8202 int limit = which == ALL_DESCRIPTORS 8180 int limit = which == ALL_DESCRIPTORS
8203 ? descs->number_of_descriptors() 8181 ? descs->number_of_descriptors()
8204 : NumberOfOwnDescriptors(); 8182 : NumberOfOwnDescriptors();
8205 for (int i = 0; i < limit; i++) { 8183 for (int i = 0; i < limit; i++) {
8206 if ((descs->GetDetails(i).attributes() & filter) == 0 && 8184 if ((descs->GetDetails(i).attributes() & filter) == 0 &&
(...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after
10685 } 10663 }
10686 case kConsStringTag: 10664 case kConsStringTag:
10687 UNREACHABLE(); 10665 UNREACHABLE();
10688 return NULL; 10666 return NULL;
10689 } 10667 }
10690 UNREACHABLE(); 10668 UNREACHABLE();
10691 return NULL; 10669 return NULL;
10692 } 10670 }
10693 10671
10694 10672
10695 base::SmartArrayPointer<uc16> String::ToWideCString(
10696 RobustnessFlag robust_flag) {
10697 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) {
10698 return base::SmartArrayPointer<uc16>();
10699 }
10700 StringCharacterStream stream(this);
10701
10702 uc16* result = NewArray<uc16>(length() + 1);
10703
10704 int i = 0;
10705 while (stream.HasMore()) {
10706 uint16_t character = stream.GetNext();
10707 result[i++] = character;
10708 }
10709 result[i] = 0;
10710 return base::SmartArrayPointer<uc16>(result);
10711 }
10712
10713
10714 const uc16* SeqTwoByteString::SeqTwoByteStringGetData(unsigned start) { 10673 const uc16* SeqTwoByteString::SeqTwoByteStringGetData(unsigned start) {
10715 return reinterpret_cast<uc16*>( 10674 return reinterpret_cast<uc16*>(
10716 reinterpret_cast<char*>(this) - kHeapObjectTag + kHeaderSize) + start; 10675 reinterpret_cast<char*>(this) - kHeapObjectTag + kHeaderSize) + start;
10717 } 10676 }
10718 10677
10719 10678
10720 void Relocatable::PostGarbageCollectionProcessing(Isolate* isolate) { 10679 void Relocatable::PostGarbageCollectionProcessing(Isolate* isolate) {
10721 Relocatable* current = isolate->relocatable_top(); 10680 Relocatable* current = isolate->relocatable_top();
10722 while (current != NULL) { 10681 while (current != NULL) {
10723 current->PostGarbageCollection(); 10682 current->PostGarbageCollection();
(...skipping 5226 matching lines...) Expand 10 before | Expand all | Expand 10 after
15950 Isolate* isolate = pattern->GetIsolate(); 15909 Isolate* isolate = pattern->GetIsolate();
15951 Handle<JSFunction> constructor = isolate->regexp_function(); 15910 Handle<JSFunction> constructor = isolate->regexp_function();
15952 Handle<JSRegExp> regexp = 15911 Handle<JSRegExp> regexp =
15953 Handle<JSRegExp>::cast(isolate->factory()->NewJSObject(constructor)); 15912 Handle<JSRegExp>::cast(isolate->factory()->NewJSObject(constructor));
15954 15913
15955 return JSRegExp::Initialize(regexp, pattern, flags); 15914 return JSRegExp::Initialize(regexp, pattern, flags);
15956 } 15915 }
15957 15916
15958 15917
15959 // static 15918 // static
15960 MaybeHandle<JSRegExp> JSRegExp::New(Handle<String> pattern,
15961 Handle<String> flags_string) {
15962 Isolate* isolate = pattern->GetIsolate();
15963 bool success = false;
15964 Flags flags = RegExpFlagsFromString(flags_string, &success);
15965 if (!success) {
15966 THROW_NEW_ERROR(
15967 isolate,
15968 NewSyntaxError(MessageTemplate::kInvalidRegExpFlags, flags_string),
15969 JSRegExp);
15970 }
15971 return New(pattern, flags);
15972 }
15973
15974
15975 // static
15976 Handle<JSRegExp> JSRegExp::Copy(Handle<JSRegExp> regexp) { 15919 Handle<JSRegExp> JSRegExp::Copy(Handle<JSRegExp> regexp) {
15977 Isolate* const isolate = regexp->GetIsolate(); 15920 Isolate* const isolate = regexp->GetIsolate();
15978 return Handle<JSRegExp>::cast(isolate->factory()->CopyJSObject(regexp)); 15921 return Handle<JSRegExp>::cast(isolate->factory()->CopyJSObject(regexp));
15979 } 15922 }
15980 15923
15981 15924
15982 template <typename Char> 15925 template <typename Char>
15983 inline int CountRequiredEscapes(Handle<String> source) { 15926 inline int CountRequiredEscapes(Handle<String> source) {
15984 DisallowHeapAllocation no_gc; 15927 DisallowHeapAllocation no_gc;
15985 int escapes = 0; 15928 int escapes = 0;
(...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after
18889 if (cell->value() != *new_value) { 18832 if (cell->value() != *new_value) {
18890 cell->set_value(*new_value); 18833 cell->set_value(*new_value);
18891 Isolate* isolate = cell->GetIsolate(); 18834 Isolate* isolate = cell->GetIsolate();
18892 cell->dependent_code()->DeoptimizeDependentCodeGroup( 18835 cell->dependent_code()->DeoptimizeDependentCodeGroup(
18893 isolate, DependentCode::kPropertyCellChangedGroup); 18836 isolate, DependentCode::kPropertyCellChangedGroup);
18894 } 18837 }
18895 } 18838 }
18896 18839
18897 } // namespace internal 18840 } // namespace internal
18898 } // namespace v8 18841 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698