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

Side by Side Diff: src/objects-inl.h

Issue 409007: Some optimizations for packer.js. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 3085 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 // No write barrier is needed since empty_fixed_array is not in new space. 3096 // No write barrier is needed since empty_fixed_array is not in new space.
3097 // Please note this function is used during marking: 3097 // Please note this function is used during marking:
3098 // - MarkCompactCollector::MarkUnmarkedObject 3098 // - MarkCompactCollector::MarkUnmarkedObject
3099 ASSERT(!Heap::InNewSpace(Heap::raw_unchecked_empty_fixed_array())); 3099 ASSERT(!Heap::InNewSpace(Heap::raw_unchecked_empty_fixed_array()));
3100 WRITE_FIELD(this, kCodeCacheOffset, Heap::raw_unchecked_empty_fixed_array()); 3100 WRITE_FIELD(this, kCodeCacheOffset, Heap::raw_unchecked_empty_fixed_array());
3101 } 3101 }
3102 3102
3103 3103
3104 void JSArray::EnsureSize(int required_size) { 3104 void JSArray::EnsureSize(int required_size) {
3105 ASSERT(HasFastElements()); 3105 ASSERT(HasFastElements());
3106 if (elements()->length() >= required_size) return; 3106 Array* elts = elements();
3107 Expand(required_size); 3107 if (elts->length() < required_size) {
3108 // Doubling in size would be overkill, but leave some slack to avoid
3109 // constantly growing.
3110 Expand(required_size + (required_size >> 3));
3111 } else if (!Heap::new_space()->Contains(elts)) {
3112 // It's a performance benefit to keep a frequently used array in new-space.
3113 const int kArraySizeThatFitsComfortablyInNewSpace = 128;
Søren Thygesen Gjesse 2009/11/19 21:42:57 This does not take the calculation required_size +
Erik Corry 2009/11/20 10:12:46 Since it's a number I pulled out of my backside I
3114 if (required_size < kArraySizeThatFitsComfortablyInNewSpace) {
Søren Thygesen Gjesse 2009/11/19 21:42:57 Maybe combine these two if's into one if condition
Erik Corry 2009/11/20 10:12:46 Done.
3115 Expand(required_size);
3116 }
3117 }
3108 } 3118 }
3109 3119
3110 3120
3111 void JSArray::SetContent(FixedArray* storage) { 3121 void JSArray::SetContent(FixedArray* storage) {
3112 set_length(Smi::FromInt(storage->length()), SKIP_WRITE_BARRIER); 3122 set_length(Smi::FromInt(storage->length()), SKIP_WRITE_BARRIER);
3113 set_elements(storage); 3123 set_elements(storage);
3114 } 3124 }
3115 3125
3116 3126
3117 Object* FixedArray::Copy() { 3127 Object* FixedArray::Copy() {
(...skipping 19 matching lines...) Expand all
3137 #undef WRITE_INT_FIELD 3147 #undef WRITE_INT_FIELD
3138 #undef READ_SHORT_FIELD 3148 #undef READ_SHORT_FIELD
3139 #undef WRITE_SHORT_FIELD 3149 #undef WRITE_SHORT_FIELD
3140 #undef READ_BYTE_FIELD 3150 #undef READ_BYTE_FIELD
3141 #undef WRITE_BYTE_FIELD 3151 #undef WRITE_BYTE_FIELD
3142 3152
3143 3153
3144 } } // namespace v8::internal 3154 } } // namespace v8::internal
3145 3155
3146 #endif // V8_OBJECTS_INL_H_ 3156 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698