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

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

Issue 216873004: Move FillWithHoles FixedArray and FixedDoubleArray functions to the given classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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/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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); 2201 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double());
2202 } 2202 }
2203 2203
2204 2204
2205 bool FixedDoubleArray::is_the_hole(int index) { 2205 bool FixedDoubleArray::is_the_hole(int index) {
2206 int offset = kHeaderSize + index * kDoubleSize; 2206 int offset = kHeaderSize + index * kDoubleSize;
2207 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset)); 2207 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset));
2208 } 2208 }
2209 2209
2210 2210
2211 double* FixedDoubleArray::data_start() {
2212 return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize));
2213 }
2214
2215
2216 void FixedDoubleArray::FillWithHoles(int from, int to) {
2217 for (int i = from; i < to; i++) {
2218 set_the_hole(i);
2219 }
2220 }
2221
2222
2211 SMI_ACCESSORS( 2223 SMI_ACCESSORS(
2212 ConstantPoolArray, first_code_ptr_index, kFirstCodePointerIndexOffset) 2224 ConstantPoolArray, first_code_ptr_index, kFirstCodePointerIndexOffset)
2213 SMI_ACCESSORS( 2225 SMI_ACCESSORS(
2214 ConstantPoolArray, first_heap_ptr_index, kFirstHeapPointerIndexOffset) 2226 ConstantPoolArray, first_heap_ptr_index, kFirstHeapPointerIndexOffset)
2215 SMI_ACCESSORS( 2227 SMI_ACCESSORS(
2216 ConstantPoolArray, first_int32_index, kFirstInt32IndexOffset) 2228 ConstantPoolArray, first_int32_index, kFirstInt32IndexOffset)
2217 2229
2218 2230
2219 int ConstantPoolArray::first_int64_index() { 2231 int ConstantPoolArray::first_int64_index() {
2220 return 0; 2232 return 0;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2394 void FixedArray::set_the_hole(int index) { 2406 void FixedArray::set_the_hole(int index) {
2395 ASSERT(map() != GetHeap()->fixed_cow_array_map()); 2407 ASSERT(map() != GetHeap()->fixed_cow_array_map());
2396 ASSERT(index >= 0 && index < this->length()); 2408 ASSERT(index >= 0 && index < this->length());
2397 ASSERT(!GetHeap()->InNewSpace(GetHeap()->the_hole_value())); 2409 ASSERT(!GetHeap()->InNewSpace(GetHeap()->the_hole_value()));
2398 WRITE_FIELD(this, 2410 WRITE_FIELD(this,
2399 kHeaderSize + index * kPointerSize, 2411 kHeaderSize + index * kPointerSize,
2400 GetHeap()->the_hole_value()); 2412 GetHeap()->the_hole_value());
2401 } 2413 }
2402 2414
2403 2415
2404 double* FixedDoubleArray::data_start() { 2416 void FixedArray::FillWithHoles(int from, int to) {
2405 return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize)); 2417 for (int i = from; i < to; i++) {
2418 set_the_hole(i);
2419 }
2406 } 2420 }
2407 2421
2408 2422
2409 Object** FixedArray::data_start() { 2423 Object** FixedArray::data_start() {
2410 return HeapObject::RawField(this, kHeaderSize); 2424 return HeapObject::RawField(this, kHeaderSize);
2411 } 2425 }
2412 2426
2413 2427
2414 bool DescriptorArray::IsEmpty() { 2428 bool DescriptorArray::IsEmpty() {
2415 ASSERT(length() >= kFirstIndex || 2429 ASSERT(length() >= kFirstIndex ||
(...skipping 4373 matching lines...) Expand 10 before | Expand all | Expand 10 after
6789 #undef READ_UINT32_FIELD 6803 #undef READ_UINT32_FIELD
6790 #undef WRITE_UINT32_FIELD 6804 #undef WRITE_UINT32_FIELD
6791 #undef READ_SHORT_FIELD 6805 #undef READ_SHORT_FIELD
6792 #undef WRITE_SHORT_FIELD 6806 #undef WRITE_SHORT_FIELD
6793 #undef READ_BYTE_FIELD 6807 #undef READ_BYTE_FIELD
6794 #undef WRITE_BYTE_FIELD 6808 #undef WRITE_BYTE_FIELD
6795 6809
6796 } } // namespace v8::internal 6810 } } // namespace v8::internal
6797 6811
6798 #endif // V8_OBJECTS_INL_H_ 6812 #endif // V8_OBJECTS_INL_H_
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