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

Side by Side Diff: src/heap.cc

Issue 24202003: Delete obsolete JSArray allocation functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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/heap.h ('k') | src/heap-inl.h » ('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 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 4737 matching lines...) Expand 10 before | Expand all | Expand 10 after
4748 } 4748 }
4749 } 4749 }
4750 if (!maybe_elms->To(&elms)) return maybe_elms; 4750 if (!maybe_elms->To(&elms)) return maybe_elms;
4751 4751
4752 array->set_elements(elms); 4752 array->set_elements(elms);
4753 array->set_length(Smi::FromInt(length)); 4753 array->set_length(Smi::FromInt(length));
4754 return array; 4754 return array;
4755 } 4755 }
4756 4756
4757 4757
4758 MaybeObject* Heap::AllocateJSArrayAndStorageWithAllocationSite(
4759 ElementsKind elements_kind,
4760 int length,
4761 int capacity,
4762 Handle<AllocationSite> allocation_site,
4763 ArrayStorageAllocationMode mode) {
4764 MaybeObject* maybe_array = AllocateJSArrayWithAllocationSite(elements_kind,
4765 allocation_site);
4766 JSArray* array;
4767 if (!maybe_array->To(&array)) return maybe_array;
4768 return AllocateJSArrayStorage(array, length, capacity, mode);
4769 }
4770
4771
4772 MaybeObject* Heap::AllocateJSArrayStorage( 4758 MaybeObject* Heap::AllocateJSArrayStorage(
4773 JSArray* array, 4759 JSArray* array,
4774 int length, 4760 int length,
4775 int capacity, 4761 int capacity,
4776 ArrayStorageAllocationMode mode) { 4762 ArrayStorageAllocationMode mode) {
4777 ASSERT(capacity >= length); 4763 ASSERT(capacity >= length);
4778 4764
4779 if (capacity == 0) { 4765 if (capacity == 0) {
4780 array->set_length(Smi::FromInt(0)); 4766 array->set_length(Smi::FromInt(0));
4781 array->set_elements(empty_fixed_array()); 4767 array->set_elements(empty_fixed_array());
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
5479 PretenureFlag pretenure) { 5465 PretenureFlag pretenure) {
5480 Context* native_context = isolate()->context()->native_context(); 5466 Context* native_context = isolate()->context()->native_context();
5481 JSFunction* array_function = native_context->array_function(); 5467 JSFunction* array_function = native_context->array_function();
5482 Map* map = array_function->initial_map(); 5468 Map* map = array_function->initial_map();
5483 Map* transition_map = isolate()->get_initial_js_array_map(elements_kind); 5469 Map* transition_map = isolate()->get_initial_js_array_map(elements_kind);
5484 if (transition_map != NULL) map = transition_map; 5470 if (transition_map != NULL) map = transition_map;
5485 return AllocateJSObjectFromMap(map, pretenure); 5471 return AllocateJSObjectFromMap(map, pretenure);
5486 } 5472 }
5487 5473
5488 5474
5489 MaybeObject* Heap::AllocateJSArrayWithAllocationSite(
5490 ElementsKind elements_kind,
5491 Handle<AllocationSite> allocation_site) {
5492 Context* native_context = isolate()->context()->native_context();
5493 JSFunction* array_function = native_context->array_function();
5494 Map* map = array_function->initial_map();
5495 Object* maybe_map_array = native_context->js_array_maps();
5496 if (!maybe_map_array->IsUndefined()) {
5497 Object* maybe_transitioned_map =
5498 FixedArray::cast(maybe_map_array)->get(elements_kind);
5499 if (!maybe_transitioned_map->IsUndefined()) {
5500 map = Map::cast(maybe_transitioned_map);
5501 }
5502 }
5503 return AllocateJSObjectFromMapWithAllocationSite(map, allocation_site);
5504 }
5505
5506
5507 MaybeObject* Heap::AllocateEmptyFixedArray() { 5475 MaybeObject* Heap::AllocateEmptyFixedArray() {
5508 int size = FixedArray::SizeFor(0); 5476 int size = FixedArray::SizeFor(0);
5509 Object* result; 5477 Object* result;
5510 { MaybeObject* maybe_result = 5478 { MaybeObject* maybe_result =
5511 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); 5479 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE);
5512 if (!maybe_result->ToObject(&result)) return maybe_result; 5480 if (!maybe_result->ToObject(&result)) return maybe_result;
5513 } 5481 }
5514 // Initialize the object. 5482 // Initialize the object.
5515 reinterpret_cast<FixedArray*>(result)->set_map_no_write_barrier( 5483 reinterpret_cast<FixedArray*>(result)->set_map_no_write_barrier(
5516 fixed_array_map()); 5484 fixed_array_map());
(...skipping 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after
8117 if (FLAG_concurrent_recompilation) { 8085 if (FLAG_concurrent_recompilation) {
8118 heap_->relocation_mutex_->Lock(); 8086 heap_->relocation_mutex_->Lock();
8119 #ifdef DEBUG 8087 #ifdef DEBUG
8120 heap_->relocation_mutex_locked_by_optimizer_thread_ = 8088 heap_->relocation_mutex_locked_by_optimizer_thread_ =
8121 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 8089 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
8122 #endif // DEBUG 8090 #endif // DEBUG
8123 } 8091 }
8124 } 8092 }
8125 8093
8126 } } // namespace v8::internal 8094 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698