| OLD | NEW |
| 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 8319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8330 } | 8330 } |
| 8331 casted_result->set_last_used_index(target_index - 1 - kFirstIndex); | 8331 casted_result->set_last_used_index(target_index - 1 - kFirstIndex); |
| 8332 for (; target_index < result->length(); ++target_index) { | 8332 for (; target_index < result->length(); ++target_index) { |
| 8333 result->set(target_index, Smi::FromInt(0)); | 8333 result->set(target_index, Smi::FromInt(0)); |
| 8334 } | 8334 } |
| 8335 } | 8335 } |
| 8336 return casted_result; | 8336 return casted_result; |
| 8337 } | 8337 } |
| 8338 | 8338 |
| 8339 | 8339 |
| 8340 Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj) { |
| 8341 int length = array->Length(); |
| 8342 array = EnsureSpace(array, length + 1); |
| 8343 array->Set(length, *obj); |
| 8344 array->SetLength(length + 1); |
| 8345 return array; |
| 8346 } |
| 8347 |
| 8348 |
| 8349 Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj1, |
| 8350 Handle<Object> obj2) { |
| 8351 int length = array->Length(); |
| 8352 array = EnsureSpace(array, length + 2); |
| 8353 array->Set(length, *obj1); |
| 8354 array->Set(length + 1, *obj2); |
| 8355 array->SetLength(length + 2); |
| 8356 return array; |
| 8357 } |
| 8358 |
| 8359 |
| 8360 Handle<ArrayList> ArrayList::EnsureSpace(Handle<ArrayList> array, int length) { |
| 8361 int capacity = array->length(); |
| 8362 if (capacity < kFirstIndex + length) { |
| 8363 capacity = kFirstIndex + length; |
| 8364 capacity = capacity + Max(capacity / 2, 2); |
| 8365 array = Handle<ArrayList>::cast(FixedArray::CopySize(array, capacity)); |
| 8366 } |
| 8367 return array; |
| 8368 } |
| 8369 |
| 8370 |
| 8340 Handle<DescriptorArray> DescriptorArray::Allocate(Isolate* isolate, | 8371 Handle<DescriptorArray> DescriptorArray::Allocate(Isolate* isolate, |
| 8341 int number_of_descriptors, | 8372 int number_of_descriptors, |
| 8342 int slack) { | 8373 int slack) { |
| 8343 DCHECK(0 <= number_of_descriptors); | 8374 DCHECK(0 <= number_of_descriptors); |
| 8344 Factory* factory = isolate->factory(); | 8375 Factory* factory = isolate->factory(); |
| 8345 // Do not use DescriptorArray::cast on incomplete object. | 8376 // Do not use DescriptorArray::cast on incomplete object. |
| 8346 int size = number_of_descriptors + slack; | 8377 int size = number_of_descriptors + slack; |
| 8347 if (size == 0) return factory->empty_descriptor_array(); | 8378 if (size == 0) return factory->empty_descriptor_array(); |
| 8348 // Allocate the array of keys. | 8379 // Allocate the array of keys. |
| 8349 Handle<FixedArray> result = factory->NewFixedArray(LengthFor(size)); | 8380 Handle<FixedArray> result = factory->NewFixedArray(LengthFor(size)); |
| (...skipping 8814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17164 CompilationInfo* info) { | 17195 CompilationInfo* info) { |
| 17165 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17196 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
| 17166 handle(cell->dependent_code(), info->isolate()), | 17197 handle(cell->dependent_code(), info->isolate()), |
| 17167 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17198 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
| 17168 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17199 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
| 17169 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17200 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
| 17170 cell, info->zone()); | 17201 cell, info->zone()); |
| 17171 } | 17202 } |
| 17172 | 17203 |
| 17173 } } // namespace v8::internal | 17204 } } // namespace v8::internal |
| OLD | NEW |