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.cc

Issue 980523004: Retain maps embedded in optimized code for several garbage collections. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Check constructor. Created 5 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
« no previous file with comments | « src/objects.h ('k') | src/objects-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 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 8294 matching lines...) Expand 10 before | Expand all | Expand 10 after
8305 } 8305 }
8306 casted_result->set_last_used_index(target_index - 1 - kFirstIndex); 8306 casted_result->set_last_used_index(target_index - 1 - kFirstIndex);
8307 for (; target_index < result->length(); ++target_index) { 8307 for (; target_index < result->length(); ++target_index) {
8308 result->set(target_index, Smi::FromInt(0)); 8308 result->set(target_index, Smi::FromInt(0));
8309 } 8309 }
8310 } 8310 }
8311 return casted_result; 8311 return casted_result;
8312 } 8312 }
8313 8313
8314 8314
8315 Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj) {
8316 int length = array->Length();
8317 array = EnsureSpace(array, length + 1);
8318 array->Set(length, *obj);
8319 array->SetLength(length + 1);
8320 return array;
8321 }
8322
8323
8324 Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj1,
8325 Handle<Object> obj2) {
8326 int length = array->Length();
8327 array = EnsureSpace(array, length + 2);
8328 array->Set(length, *obj1);
8329 array->Set(length + 1, *obj2);
8330 array->SetLength(length + 2);
8331 return array;
8332 }
8333
8334
8335 Handle<ArrayList> ArrayList::EnsureSpace(Handle<ArrayList> array, int length) {
8336 int capacity = array->length();
8337 if (capacity < kFirstIndex + length) {
8338 capacity = kFirstIndex + length;
8339 capacity = capacity + Max(capacity / 2, 2);
8340 array = Handle<ArrayList>::cast(FixedArray::CopySize(array, capacity));
8341 }
8342 return array;
8343 }
8344
8345
8315 Handle<DescriptorArray> DescriptorArray::Allocate(Isolate* isolate, 8346 Handle<DescriptorArray> DescriptorArray::Allocate(Isolate* isolate,
8316 int number_of_descriptors, 8347 int number_of_descriptors,
8317 int slack) { 8348 int slack) {
8318 DCHECK(0 <= number_of_descriptors); 8349 DCHECK(0 <= number_of_descriptors);
8319 Factory* factory = isolate->factory(); 8350 Factory* factory = isolate->factory();
8320 // Do not use DescriptorArray::cast on incomplete object. 8351 // Do not use DescriptorArray::cast on incomplete object.
8321 int size = number_of_descriptors + slack; 8352 int size = number_of_descriptors + slack;
8322 if (size == 0) return factory->empty_descriptor_array(); 8353 if (size == 0) return factory->empty_descriptor_array();
8323 // Allocate the array of keys. 8354 // Allocate the array of keys.
8324 Handle<FixedArray> result = factory->NewFixedArray(LengthFor(size)); 8355 Handle<FixedArray> result = factory->NewFixedArray(LengthFor(size));
(...skipping 8816 matching lines...) Expand 10 before | Expand all | Expand 10 after
17141 CompilationInfo* info) { 17172 CompilationInfo* info) {
17142 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( 17173 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo(
17143 handle(cell->dependent_code(), info->isolate()), 17174 handle(cell->dependent_code(), info->isolate()),
17144 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); 17175 DependentCode::kPropertyCellChangedGroup, info->object_wrapper());
17145 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 17176 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
17146 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 17177 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
17147 cell, info->zone()); 17178 cell, info->zone());
17148 } 17179 }
17149 17180
17150 } } // namespace v8::internal 17181 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698