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

Side by Side Diff: src/objects.cc

Issue 225623004: Callers of ElementsAccessor::AddElementsToFixedArray(), ElementsAccessor::HasElement() and Elements… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: HasElement() polishing 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') | 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 7888 matching lines...) Expand 10 before | Expand all | Expand 10 after
7899 7899
7900 void FixedArray::Shrink(int new_length) { 7900 void FixedArray::Shrink(int new_length) {
7901 ASSERT(0 <= new_length && new_length <= length()); 7901 ASSERT(0 <= new_length && new_length <= length());
7902 if (new_length < length()) { 7902 if (new_length < length()) {
7903 RightTrimFixedArray<Heap::FROM_MUTATOR>( 7903 RightTrimFixedArray<Heap::FROM_MUTATOR>(
7904 GetHeap(), this, length() - new_length); 7904 GetHeap(), this, length() - new_length);
7905 } 7905 }
7906 } 7906 }
7907 7907
7908 7908
7909 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { 7909 Handle<FixedArray> FixedArray::AddKeysFromJSArray(Handle<FixedArray> content,
7910 Handle<JSArray> array) {
7910 ElementsAccessor* accessor = array->GetElementsAccessor(); 7911 ElementsAccessor* accessor = array->GetElementsAccessor();
7911 MaybeObject* maybe_result = 7912 Handle<FixedArray> result =
7912 accessor->AddElementsToFixedArray(array, array, this); 7913 accessor->AddElementsToFixedArray(array, array, content);
7913 FixedArray* result; 7914
7914 if (!maybe_result->To<FixedArray>(&result)) return maybe_result;
7915 #ifdef ENABLE_SLOW_ASSERTS 7915 #ifdef ENABLE_SLOW_ASSERTS
7916 if (FLAG_enable_slow_asserts) { 7916 if (FLAG_enable_slow_asserts) {
7917 DisallowHeapAllocation no_allocation;
7917 for (int i = 0; i < result->length(); i++) { 7918 for (int i = 0; i < result->length(); i++) {
7918 Object* current = result->get(i); 7919 Object* current = result->get(i);
7919 ASSERT(current->IsNumber() || current->IsName()); 7920 ASSERT(current->IsNumber() || current->IsName());
7920 } 7921 }
7921 } 7922 }
7922 #endif 7923 #endif
7923 return result; 7924 return result;
7924 } 7925 }
7925 7926
7926 7927
7927 MaybeObject* FixedArray::UnionOfKeys(FixedArray* other) { 7928 Handle<FixedArray> FixedArray::UnionOfKeys(Handle<FixedArray> first,
7928 ElementsAccessor* accessor = ElementsAccessor::ForArray(other); 7929 Handle<FixedArray> second) {
7929 MaybeObject* maybe_result = 7930 ElementsAccessor* accessor = ElementsAccessor::ForArray(second);
7930 accessor->AddElementsToFixedArray(NULL, NULL, this, other); 7931 Handle<FixedArray> result =
7931 FixedArray* result; 7932 accessor->AddElementsToFixedArray(
7932 if (!maybe_result->To(&result)) return maybe_result; 7933 Handle<Object>::null(), // receiver
7934 Handle<JSObject>::null(), // holder
7935 first,
7936 Handle<FixedArrayBase>::cast(second));
7937
7933 #ifdef ENABLE_SLOW_ASSERTS 7938 #ifdef ENABLE_SLOW_ASSERTS
7934 if (FLAG_enable_slow_asserts) { 7939 if (FLAG_enable_slow_asserts) {
7940 DisallowHeapAllocation no_allocation;
7935 for (int i = 0; i < result->length(); i++) { 7941 for (int i = 0; i < result->length(); i++) {
7936 Object* current = result->get(i); 7942 Object* current = result->get(i);
7937 ASSERT(current->IsNumber() || current->IsName()); 7943 ASSERT(current->IsNumber() || current->IsName());
7938 } 7944 }
7939 } 7945 }
7940 #endif 7946 #endif
7941 return result; 7947 return result;
7942 } 7948 }
7943 7949
7944 7950
(...skipping 8535 matching lines...) Expand 10 before | Expand all | Expand 10 after
16480 #define ERROR_MESSAGES_TEXTS(C, T) T, 16486 #define ERROR_MESSAGES_TEXTS(C, T) T,
16481 static const char* error_messages_[] = { 16487 static const char* error_messages_[] = {
16482 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16488 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16483 }; 16489 };
16484 #undef ERROR_MESSAGES_TEXTS 16490 #undef ERROR_MESSAGES_TEXTS
16485 return error_messages_[reason]; 16491 return error_messages_[reason];
16486 } 16492 }
16487 16493
16488 16494
16489 } } // namespace v8::internal 16495 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698