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

Side by Side Diff: src/heap.cc

Issue 9356002: Remove unnecessary elements type check when allocating array in runtime. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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
« src/builtins.cc ('K') | « src/builtins.cc ('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 4343 matching lines...) Expand 10 before | Expand all | Expand 10 after
4354 return result; 4354 return result;
4355 } 4355 }
4356 4356
4357 4357
4358 MaybeObject* Heap::AllocateJSArray( 4358 MaybeObject* Heap::AllocateJSArray(
4359 ElementsKind elements_kind, 4359 ElementsKind elements_kind,
4360 PretenureFlag pretenure) { 4360 PretenureFlag pretenure) {
4361 Context* global_context = isolate()->context()->global_context(); 4361 Context* global_context = isolate()->context()->global_context();
4362 JSFunction* array_function = global_context->array_function(); 4362 JSFunction* array_function = global_context->array_function();
4363 Map* map = array_function->initial_map(); 4363 Map* map = array_function->initial_map();
4364 if (elements_kind == FAST_ELEMENTS || !FLAG_smi_only_arrays) { 4364 if (elements_kind == FAST_DOUBLE_ELEMENTS) {
4365 map = Map::cast(global_context->double_js_array_map());
4366 } else if (elements_kind == FAST_ELEMENTS || !FLAG_smi_only_arrays) {
4365 map = Map::cast(global_context->object_js_array_map()); 4367 map = Map::cast(global_context->object_js_array_map());
4366 } else if (elements_kind == FAST_DOUBLE_ELEMENTS) {
4367 map = Map::cast(global_context->double_js_array_map());
4368 } else { 4368 } else {
4369 ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS); 4369 ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS);
4370 ASSERT(map == global_context->smi_js_array_map()); 4370 ASSERT(map == global_context->smi_js_array_map());
4371 } 4371 }
4372 4372
4373 return AllocateJSObjectFromMap(map, pretenure); 4373 return AllocateJSObjectFromMap(map, pretenure);
4374 } 4374 }
4375 4375
4376 4376
4377 MaybeObject* Heap::AllocateEmptyFixedArray() { 4377 MaybeObject* Heap::AllocateEmptyFixedArray() {
(...skipping 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
« src/builtins.cc ('K') | « src/builtins.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698