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

Side by Side Diff: src/objects.cc

Issue 197043004: Don't fast RemoveArrayHoles in case of arguments arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 6 years, 9 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/array.js ('k') | src/runtime.cc » ('j') | 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 14424 matching lines...) Expand 10 before | Expand all | Expand 10 after
14435 } 14435 }
14436 14436
14437 14437
14438 // Collects all defined (non-hole) and non-undefined (array) elements at 14438 // Collects all defined (non-hole) and non-undefined (array) elements at
14439 // the start of the elements array. 14439 // the start of the elements array.
14440 // If the object is in dictionary mode, it is converted to fast elements 14440 // If the object is in dictionary mode, it is converted to fast elements
14441 // mode. 14441 // mode.
14442 Handle<Object> JSObject::PrepareElementsForSort(Handle<JSObject> object, 14442 Handle<Object> JSObject::PrepareElementsForSort(Handle<JSObject> object,
14443 uint32_t limit) { 14443 uint32_t limit) {
14444 Isolate* isolate = object->GetIsolate(); 14444 Isolate* isolate = object->GetIsolate();
14445 if (object->HasSloppyArgumentsElements() ||
14446 object->map()->is_observed()) {
14447 return handle(Smi::FromInt(-1), isolate);
14448 }
14445 14449
14446 ASSERT(!object->map()->is_observed());
14447 if (object->HasDictionaryElements()) { 14450 if (object->HasDictionaryElements()) {
14448 // Convert to fast elements containing only the existing properties. 14451 // Convert to fast elements containing only the existing properties.
14449 // Ordering is irrelevant, since we are going to sort anyway. 14452 // Ordering is irrelevant, since we are going to sort anyway.
14450 Handle<SeededNumberDictionary> dict(object->element_dictionary()); 14453 Handle<SeededNumberDictionary> dict(object->element_dictionary());
14451 if (object->IsJSArray() || dict->requires_slow_elements() || 14454 if (object->IsJSArray() || dict->requires_slow_elements() ||
14452 dict->max_number_key() >= limit) { 14455 dict->max_number_key() >= limit) {
14453 return JSObject::PrepareSlowElementsForSort(object, limit); 14456 return JSObject::PrepareSlowElementsForSort(object, limit);
14454 } 14457 }
14455 // Convert to fast elements. 14458 // Convert to fast elements.
14456 14459
(...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after
16481 #define ERROR_MESSAGES_TEXTS(C, T) T, 16484 #define ERROR_MESSAGES_TEXTS(C, T) T,
16482 static const char* error_messages_[] = { 16485 static const char* error_messages_[] = {
16483 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16486 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16484 }; 16487 };
16485 #undef ERROR_MESSAGES_TEXTS 16488 #undef ERROR_MESSAGES_TEXTS
16486 return error_messages_[reason]; 16489 return error_messages_[reason];
16487 } 16490 }
16488 16491
16489 16492
16490 } } // namespace v8::internal 16493 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/array.js ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698