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

Side by Side Diff: src/elements.cc

Issue 2028983002: Introduce IsUndefined(Isolate*) and IsTheHole(Isolate*) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixing wrongly wrapped lines Created 4 years, 6 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/elements.h" 5 #include "src/elements.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 object->map()->is_prototype_map()); 1249 object->map()->is_prototype_map());
1250 if (attributes != NONE) object->RequireSlowElements(*new_dictionary); 1250 if (attributes != NONE) object->RequireSlowElements(*new_dictionary);
1251 if (dictionary.is_identical_to(new_dictionary)) return; 1251 if (dictionary.is_identical_to(new_dictionary)) return;
1252 object->set_elements(*new_dictionary); 1252 object->set_elements(*new_dictionary);
1253 } 1253 }
1254 1254
1255 static bool HasEntryImpl(FixedArrayBase* store, uint32_t entry) { 1255 static bool HasEntryImpl(FixedArrayBase* store, uint32_t entry) {
1256 DisallowHeapAllocation no_gc; 1256 DisallowHeapAllocation no_gc;
1257 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store); 1257 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store);
1258 Object* index = dict->KeyAt(entry); 1258 Object* index = dict->KeyAt(entry);
1259 return !index->IsTheHole(); 1259 return !index->IsTheHole(dict->GetIsolate());
1260 } 1260 }
1261 1261
1262 static uint32_t GetIndexForEntryImpl(FixedArrayBase* store, uint32_t entry) { 1262 static uint32_t GetIndexForEntryImpl(FixedArrayBase* store, uint32_t entry) {
1263 DisallowHeapAllocation no_gc; 1263 DisallowHeapAllocation no_gc;
1264 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store); 1264 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store);
1265 uint32_t result = 0; 1265 uint32_t result = 0;
1266 CHECK(dict->KeyAt(entry)->ToArrayIndex(&result)); 1266 CHECK(dict->KeyAt(entry)->ToArrayIndex(&result));
1267 return result; 1267 return result;
1268 } 1268 }
1269 1269
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 DCHECK(length > 0); 1813 DCHECK(length > 0);
1814 int new_length = length - 1; 1814 int new_length = length - 1;
1815 int remove_index = remove_position == AT_START ? 0 : new_length; 1815 int remove_index = remove_position == AT_START ? 0 : new_length;
1816 Handle<Object> result = Subclass::GetImpl(*backing_store, remove_index); 1816 Handle<Object> result = Subclass::GetImpl(*backing_store, remove_index);
1817 if (remove_position == AT_START) { 1817 if (remove_position == AT_START) {
1818 Subclass::MoveElements(isolate, receiver, backing_store, 0, 1, new_length, 1818 Subclass::MoveElements(isolate, receiver, backing_store, 0, 1, new_length,
1819 0, 0); 1819 0, 0);
1820 } 1820 }
1821 Subclass::SetLengthImpl(isolate, receiver, new_length, backing_store); 1821 Subclass::SetLengthImpl(isolate, receiver, new_length, backing_store);
1822 1822
1823 if (IsHoleyElementsKind(kind) && result->IsTheHole()) { 1823 if (IsHoleyElementsKind(kind) && result->IsTheHole(isolate)) {
1824 return isolate->factory()->undefined_value(); 1824 return isolate->factory()->undefined_value();
1825 } 1825 }
1826 return result; 1826 return result;
1827 } 1827 }
1828 1828
1829 static uint32_t AddArguments(Handle<JSArray> receiver, 1829 static uint32_t AddArguments(Handle<JSArray> receiver,
1830 Handle<FixedArrayBase> backing_store, 1830 Handle<FixedArrayBase> backing_store,
1831 Arguments* args, uint32_t add_size, 1831 Arguments* args, uint32_t add_size,
1832 Where add_position) { 1832 Where add_position) {
1833 uint32_t length = Smi::cast(receiver->length())->value(); 1833 uint32_t length = Smi::cast(receiver->length())->value();
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 2420
2421 static Handle<FixedArray> DirectCollectElementIndicesImpl( 2421 static Handle<FixedArray> DirectCollectElementIndicesImpl(
2422 Isolate* isolate, Handle<JSObject> object, 2422 Isolate* isolate, Handle<JSObject> object,
2423 Handle<FixedArrayBase> backing_store, GetKeysConversion convert, 2423 Handle<FixedArrayBase> backing_store, GetKeysConversion convert,
2424 PropertyFilter filter, Handle<FixedArray> list, uint32_t* nof_indices, 2424 PropertyFilter filter, Handle<FixedArray> list, uint32_t* nof_indices,
2425 uint32_t insertion_index = 0) { 2425 uint32_t insertion_index = 0) {
2426 FixedArray* parameter_map = FixedArray::cast(*backing_store); 2426 FixedArray* parameter_map = FixedArray::cast(*backing_store);
2427 uint32_t length = parameter_map->length() - 2; 2427 uint32_t length = parameter_map->length() - 2;
2428 2428
2429 for (uint32_t i = 0; i < length; ++i) { 2429 for (uint32_t i = 0; i < length; ++i) {
2430 if (parameter_map->get(i + 2)->IsTheHole()) continue; 2430 if (parameter_map->get(i + 2)->IsTheHole(isolate)) continue;
2431 if (convert == GetKeysConversion::kConvertToString) { 2431 if (convert == GetKeysConversion::kConvertToString) {
2432 Handle<String> index_string = isolate->factory()->Uint32ToString(i); 2432 Handle<String> index_string = isolate->factory()->Uint32ToString(i);
2433 list->set(insertion_index, *index_string); 2433 list->set(insertion_index, *index_string);
2434 } else { 2434 } else {
2435 list->set(insertion_index, Smi::FromInt(i), SKIP_WRITE_BARRIER); 2435 list->set(insertion_index, Smi::FromInt(i), SKIP_WRITE_BARRIER);
2436 } 2436 }
2437 insertion_index++; 2437 insertion_index++;
2438 } 2438 }
2439 2439
2440 Handle<FixedArrayBase> store(FixedArrayBase::cast(parameter_map->get(1))); 2440 Handle<FixedArrayBase> store(FixedArrayBase::cast(parameter_map->get(1)));
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
3042 insertion_index += len; 3042 insertion_index += len;
3043 } 3043 }
3044 3044
3045 DCHECK_EQ(insertion_index, result_len); 3045 DCHECK_EQ(insertion_index, result_len);
3046 return result_array; 3046 return result_array;
3047 } 3047 }
3048 3048
3049 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 3049 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
3050 } // namespace internal 3050 } // namespace internal
3051 } // namespace v8 3051 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698