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

Side by Side Diff: src/objects.cc

Issue 249993002: *NumberDictionary::AddNumberEntry() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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
« 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 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 15996 matching lines...) Expand 10 before | Expand all | Expand 10 after
16007 } 16007 }
16008 SetEntry(entry, k, value, details); 16008 SetEntry(entry, k, value, details);
16009 ASSERT((Dictionary::KeyAt(entry)->IsNumber() || 16009 ASSERT((Dictionary::KeyAt(entry)->IsNumber() ||
16010 Dictionary::KeyAt(entry)->IsName())); 16010 Dictionary::KeyAt(entry)->IsName()));
16011 DerivedHashTable::ElementAdded(); 16011 DerivedHashTable::ElementAdded();
16012 return this; 16012 return this;
16013 } 16013 }
16014 16014
16015 16015
16016 void SeededNumberDictionary::UpdateMaxNumberKey(uint32_t key) { 16016 void SeededNumberDictionary::UpdateMaxNumberKey(uint32_t key) {
16017 DisallowHeapAllocation no_allocation;
16017 // If the dictionary requires slow elements an element has already 16018 // If the dictionary requires slow elements an element has already
16018 // been added at a high index. 16019 // been added at a high index.
16019 if (requires_slow_elements()) return; 16020 if (requires_slow_elements()) return;
16020 // Check if this index is high enough that we should require slow 16021 // Check if this index is high enough that we should require slow
16021 // elements. 16022 // elements.
16022 if (key > kRequiresSlowElementsLimit) { 16023 if (key > kRequiresSlowElementsLimit) {
16023 set_requires_slow_elements(); 16024 set_requires_slow_elements();
16024 return; 16025 return;
16025 } 16026 }
16026 // Update max key value. 16027 // Update max key value.
16027 Object* max_index_object = get(kMaxNumberKeyIndex); 16028 Object* max_index_object = get(kMaxNumberKeyIndex);
16028 if (!max_index_object->IsSmi() || max_number_key() < key) { 16029 if (!max_index_object->IsSmi() || max_number_key() < key) {
16029 FixedArray::set(kMaxNumberKeyIndex, 16030 FixedArray::set(kMaxNumberKeyIndex,
16030 Smi::FromInt(key << kRequiresSlowElementsTagSize)); 16031 Smi::FromInt(key << kRequiresSlowElementsTagSize));
16031 } 16032 }
16032 } 16033 }
16033 16034
16035
16034 Handle<SeededNumberDictionary> SeededNumberDictionary::AddNumberEntry( 16036 Handle<SeededNumberDictionary> SeededNumberDictionary::AddNumberEntry(
16035 Handle<SeededNumberDictionary> dictionary, 16037 Handle<SeededNumberDictionary> dictionary,
16036 uint32_t key, 16038 uint32_t key,
16037 Handle<Object> value, 16039 Handle<Object> value,
16038 PropertyDetails details) { 16040 PropertyDetails details) {
16041 dictionary->UpdateMaxNumberKey(key);
16042 SLOW_ASSERT(dictionary->FindEntry(key) == kNotFound);
16039 CALL_HEAP_FUNCTION(dictionary->GetIsolate(), 16043 CALL_HEAP_FUNCTION(dictionary->GetIsolate(),
16040 dictionary->AddNumberEntry(key, *value, details), 16044 dictionary->Add(key, *value, details),
16041 SeededNumberDictionary); 16045 SeededNumberDictionary);
16042 } 16046 }
16043 16047
16044 MaybeObject* SeededNumberDictionary::AddNumberEntry(uint32_t key,
16045 Object* value,
16046 PropertyDetails details) {
16047 UpdateMaxNumberKey(key);
16048 SLOW_ASSERT(this->FindEntry(key) == kNotFound);
16049 return Add(key, value, details);
16050 }
16051
16052
16053 MaybeObject* UnseededNumberDictionary::AddNumberEntry(uint32_t key,
16054 Object* value) {
16055 SLOW_ASSERT(this->FindEntry(key) == kNotFound);
16056 return Add(key, value, PropertyDetails(NONE, NORMAL, 0));
16057 }
16058
16059 16048
16060 Handle<UnseededNumberDictionary> UnseededNumberDictionary::AddNumberEntry( 16049 Handle<UnseededNumberDictionary> UnseededNumberDictionary::AddNumberEntry(
16061 Handle<UnseededNumberDictionary> dictionary, 16050 Handle<UnseededNumberDictionary> dictionary,
16062 uint32_t key, 16051 uint32_t key,
16063 Handle<Object> value) { 16052 Handle<Object> value) {
16053 SLOW_ASSERT(dictionary->FindEntry(key) == kNotFound);
16064 CALL_HEAP_FUNCTION(dictionary->GetIsolate(), 16054 CALL_HEAP_FUNCTION(dictionary->GetIsolate(),
16065 dictionary->AddNumberEntry(key, *value), 16055 dictionary->Add(
16056 key, *value, PropertyDetails(NONE, NORMAL, 0)),
16066 UnseededNumberDictionary); 16057 UnseededNumberDictionary);
16067 } 16058 }
16068 16059
16069 16060
16070 MaybeObject* SeededNumberDictionary::AtNumberPut(uint32_t key, Object* value) { 16061 MaybeObject* SeededNumberDictionary::AtNumberPut(uint32_t key, Object* value) {
16071 UpdateMaxNumberKey(key); 16062 UpdateMaxNumberKey(key);
16072 return AtPut(key, value); 16063 return AtPut(key, value);
16073 } 16064 }
16074 16065
16075 16066
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
17417 #define ERROR_MESSAGES_TEXTS(C, T) T, 17408 #define ERROR_MESSAGES_TEXTS(C, T) T,
17418 static const char* error_messages_[] = { 17409 static const char* error_messages_[] = {
17419 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17410 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17420 }; 17411 };
17421 #undef ERROR_MESSAGES_TEXTS 17412 #undef ERROR_MESSAGES_TEXTS
17422 return error_messages_[reason]; 17413 return error_messages_[reason];
17423 } 17414 }
17424 17415
17425 17416
17426 } } // namespace v8::internal 17417 } } // namespace v8::internal
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