Chromium Code Reviews

Side by Side Diff: src/heap.cc

Issue 9310117: Implement KeyedStoreICs to grow arrays on out-of-bound stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: nits Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
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 4541 matching lines...)
4552 reinterpret_cast<FixedDoubleArray*>(result)->set_map_no_write_barrier( 4552 reinterpret_cast<FixedDoubleArray*>(result)->set_map_no_write_barrier(
4553 fixed_double_array_map()); 4553 fixed_double_array_map());
4554 reinterpret_cast<FixedDoubleArray*>(result)->set_length(0); 4554 reinterpret_cast<FixedDoubleArray*>(result)->set_length(0);
4555 return result; 4555 return result;
4556 } 4556 }
4557 4557
4558 4558
4559 MaybeObject* Heap::AllocateUninitializedFixedDoubleArray( 4559 MaybeObject* Heap::AllocateUninitializedFixedDoubleArray(
4560 int length, 4560 int length,
4561 PretenureFlag pretenure) { 4561 PretenureFlag pretenure) {
4562 if (length == 0) return empty_fixed_double_array(); 4562 if (length == 0) return empty_fixed_array();
4563 4563
4564 Object* elements_object; 4564 Object* elements_object;
4565 MaybeObject* maybe_obj = AllocateRawFixedDoubleArray(length, pretenure); 4565 MaybeObject* maybe_obj = AllocateRawFixedDoubleArray(length, pretenure);
4566 if (!maybe_obj->ToObject(&elements_object)) return maybe_obj; 4566 if (!maybe_obj->ToObject(&elements_object)) return maybe_obj;
4567 FixedDoubleArray* elements = 4567 FixedDoubleArray* elements =
4568 reinterpret_cast<FixedDoubleArray*>(elements_object); 4568 reinterpret_cast<FixedDoubleArray*>(elements_object);
4569 4569
4570 elements->set_map_no_write_barrier(fixed_double_array_map()); 4570 elements->set_map_no_write_barrier(fixed_double_array_map());
4571 elements->set_length(length); 4571 elements->set_length(length);
4572 return elements; 4572 return elements;
4573 } 4573 }
4574 4574
4575 4575
4576 MaybeObject* Heap::AllocateFixedDoubleArrayWithHoles( 4576 MaybeObject* Heap::AllocateFixedDoubleArrayWithHoles(
4577 int length, 4577 int length,
4578 PretenureFlag pretenure) { 4578 PretenureFlag pretenure) {
4579 if (length == 0) return empty_fixed_double_array(); 4579 if (length == 0) return empty_fixed_array();
4580 4580
4581 Object* elements_object; 4581 Object* elements_object;
4582 MaybeObject* maybe_obj = AllocateRawFixedDoubleArray(length, pretenure); 4582 MaybeObject* maybe_obj = AllocateRawFixedDoubleArray(length, pretenure);
4583 if (!maybe_obj->ToObject(&elements_object)) return maybe_obj; 4583 if (!maybe_obj->ToObject(&elements_object)) return maybe_obj;
4584 FixedDoubleArray* elements = 4584 FixedDoubleArray* elements =
4585 reinterpret_cast<FixedDoubleArray*>(elements_object); 4585 reinterpret_cast<FixedDoubleArray*>(elements_object);
4586 4586
4587 for (int i = 0; i < length; ++i) { 4587 for (int i = 0; i < length; ++i) {
4588 elements->set_the_hole(i); 4588 elements->set_the_hole(i);
4589 } 4589 }
(...skipping 2291 matching lines...)
6881 isolate_->heap()->store_buffer()->Compact(); 6881 isolate_->heap()->store_buffer()->Compact();
6882 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); 6882 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED);
6883 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { 6883 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) {
6884 next = chunk->next_chunk(); 6884 next = chunk->next_chunk();
6885 isolate_->memory_allocator()->Free(chunk); 6885 isolate_->memory_allocator()->Free(chunk);
6886 } 6886 }
6887 chunks_queued_for_free_ = NULL; 6887 chunks_queued_for_free_ = NULL;
6888 } 6888 }
6889 6889
6890 } } // namespace v8::internal 6890 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine