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

Side by Side Diff: src/objects.cc

Issue 1255173006: Introduce safe interface to "copy and grow" FixedArray. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed nits. Created 5 years, 4 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
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-heap.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 9521 matching lines...) Expand 10 before | Expand all | Expand 10 after
9532 int old_length; 9532 int old_length;
9533 if (value->IsSmi()) { 9533 if (value->IsSmi()) {
9534 // No optimized code map. 9534 // No optimized code map.
9535 DCHECK_EQ(0, Smi::cast(*value)->value()); 9535 DCHECK_EQ(0, Smi::cast(*value)->value());
9536 new_code_map = isolate->factory()->NewFixedArray(kInitialLength); 9536 new_code_map = isolate->factory()->NewFixedArray(kInitialLength);
9537 old_length = kEntriesStart; 9537 old_length = kEntriesStart;
9538 } else { 9538 } else {
9539 // Copy old map and append one new entry. 9539 // Copy old map and append one new entry.
9540 Handle<FixedArray> old_code_map = Handle<FixedArray>::cast(value); 9540 Handle<FixedArray> old_code_map = Handle<FixedArray>::cast(value);
9541 DCHECK(!shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code); 9541 DCHECK(!shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code);
9542 new_code_map =
9543 isolate->factory()->CopyFixedArrayAndGrow(old_code_map, kEntryLength);
9542 old_length = old_code_map->length(); 9544 old_length = old_code_map->length();
9543 new_code_map = FixedArray::CopySize(
9544 old_code_map, old_length + kEntryLength);
9545 // Zap the old map for the sake of the heap verifier. 9545 // Zap the old map for the sake of the heap verifier.
9546 if (Heap::ShouldZapGarbage()) { 9546 if (Heap::ShouldZapGarbage()) {
9547 Object** data = old_code_map->data_start(); 9547 Object** data = old_code_map->data_start();
9548 MemsetPointer(data, isolate->heap()->the_hole_value(), old_length); 9548 MemsetPointer(data, isolate->heap()->the_hole_value(), old_length);
9549 } 9549 }
9550 } 9550 }
9551 new_code_map->set(old_length + kContextOffset, *native_context); 9551 new_code_map->set(old_length + kContextOffset, *native_context);
9552 new_code_map->set(old_length + kCachedCodeOffset, *code); 9552 new_code_map->set(old_length + kCachedCodeOffset, *code);
9553 new_code_map->set(old_length + kLiteralsOffset, *literals); 9553 new_code_map->set(old_length + kLiteralsOffset, *literals);
9554 new_code_map->set(old_length + kOsrAstIdOffset, 9554 new_code_map->set(old_length + kOsrAstIdOffset,
(...skipping 6323 matching lines...) Expand 10 before | Expand all | Expand 10 after
15878 if (cell->value() != *new_value) { 15878 if (cell->value() != *new_value) {
15879 cell->set_value(*new_value); 15879 cell->set_value(*new_value);
15880 Isolate* isolate = cell->GetIsolate(); 15880 Isolate* isolate = cell->GetIsolate();
15881 cell->dependent_code()->DeoptimizeDependentCodeGroup( 15881 cell->dependent_code()->DeoptimizeDependentCodeGroup(
15882 isolate, DependentCode::kPropertyCellChangedGroup); 15882 isolate, DependentCode::kPropertyCellChangedGroup);
15883 } 15883 }
15884 } 15884 }
15885 15885
15886 } // namespace internal 15886 } // namespace internal
15887 } // namespace v8 15887 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698