| 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 8185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8196 } | 8196 } |
| 8197 | 8197 |
| 8198 | 8198 |
| 8199 MaybeHandle<FixedArray> FixedArray::AddKeysFromArrayLike( | 8199 MaybeHandle<FixedArray> FixedArray::AddKeysFromArrayLike( |
| 8200 Handle<FixedArray> content, Handle<JSObject> array, KeyFilter filter) { | 8200 Handle<FixedArray> content, Handle<JSObject> array, KeyFilter filter) { |
| 8201 DCHECK(array->IsJSArray() || array->HasSloppyArgumentsElements()); | 8201 DCHECK(array->IsJSArray() || array->HasSloppyArgumentsElements()); |
| 8202 ElementsAccessor* accessor = array->GetElementsAccessor(); | 8202 ElementsAccessor* accessor = array->GetElementsAccessor(); |
| 8203 Handle<FixedArray> result; | 8203 Handle<FixedArray> result; |
| 8204 ASSIGN_RETURN_ON_EXCEPTION( | 8204 ASSIGN_RETURN_ON_EXCEPTION( |
| 8205 array->GetIsolate(), result, | 8205 array->GetIsolate(), result, |
| 8206 accessor->AddElementsToFixedArray(array, array, content, filter), | 8206 accessor->AddElementsToFixedArray(array, content, filter), FixedArray); |
| 8207 FixedArray); | |
| 8208 | 8207 |
| 8209 #ifdef ENABLE_SLOW_DCHECKS | 8208 #ifdef ENABLE_SLOW_DCHECKS |
| 8210 if (FLAG_enable_slow_asserts) { | 8209 if (FLAG_enable_slow_asserts) { |
| 8211 DisallowHeapAllocation no_allocation; | 8210 DisallowHeapAllocation no_allocation; |
| 8212 for (int i = 0; i < result->length(); i++) { | 8211 for (int i = 0; i < result->length(); i++) { |
| 8213 Object* current = result->get(i); | 8212 Object* current = result->get(i); |
| 8214 DCHECK(current->IsNumber() || current->IsName()); | 8213 DCHECK(current->IsNumber() || current->IsName()); |
| 8215 } | 8214 } |
| 8216 } | 8215 } |
| 8217 #endif | 8216 #endif |
| 8218 return result; | 8217 return result; |
| 8219 } | 8218 } |
| 8220 | 8219 |
| 8221 | 8220 |
| 8222 MaybeHandle<FixedArray> FixedArray::UnionOfKeys(Handle<FixedArray> first, | 8221 MaybeHandle<FixedArray> FixedArray::UnionOfKeys(Handle<FixedArray> first, |
| 8223 Handle<FixedArray> second) { | 8222 Handle<FixedArray> second) { |
| 8224 ElementsAccessor* accessor = ElementsAccessor::ForArray(second); | 8223 if (second->length() == 0) return first; |
| 8225 Handle<FixedArray> result; | 8224 if (first->length() == 0) return second; |
| 8226 ASSIGN_RETURN_ON_EXCEPTION( | 8225 Isolate* isolate = first->GetIsolate(); |
| 8227 first->GetIsolate(), result, | 8226 Handle<FixedArray> result = |
| 8228 accessor->AddElementsToFixedArray( | 8227 isolate->factory()->NewFixedArray(first->length() + second->length()); |
| 8229 Handle<Object>::null(), // receiver | 8228 for (int i = 0; i < first->length(); i++) { |
| 8230 Handle<JSObject>::null(), // holder | 8229 result->set(i, first->get(i)); |
| 8231 first, Handle<FixedArrayBase>::cast(second), ALL_KEYS), | 8230 } |
| 8232 FixedArray); | 8231 int pos = first->length(); |
| 8233 | 8232 for (int j = 0; j < second->length(); j++) { |
| 8234 #ifdef ENABLE_SLOW_DCHECKS | 8233 Object* current = second->get(j); |
| 8235 if (FLAG_enable_slow_asserts) { | 8234 int i; |
| 8236 DisallowHeapAllocation no_allocation; | 8235 for (i = 0; i < first->length(); i++) { |
| 8237 for (int i = 0; i < result->length(); i++) { | 8236 if (current->KeyEquals(first->get(i))) break; |
| 8238 Object* current = result->get(i); | 8237 } |
| 8239 DCHECK(current->IsNumber() || current->IsName()); | 8238 if (i == first->length()) { |
| 8239 result->set(pos++, current); |
| 8240 } | 8240 } |
| 8241 } | 8241 } |
| 8242 #endif | 8242 |
| 8243 result->Shrink(pos); |
| 8243 return result; | 8244 return result; |
| 8244 } | 8245 } |
| 8245 | 8246 |
| 8246 | 8247 |
| 8247 Handle<FixedArray> FixedArray::CopySize( | 8248 Handle<FixedArray> FixedArray::CopySize( |
| 8248 Handle<FixedArray> array, int new_length, PretenureFlag pretenure) { | 8249 Handle<FixedArray> array, int new_length, PretenureFlag pretenure) { |
| 8249 Isolate* isolate = array->GetIsolate(); | 8250 Isolate* isolate = array->GetIsolate(); |
| 8250 if (new_length == 0) return isolate->factory()->empty_fixed_array(); | 8251 if (new_length == 0) return isolate->factory()->empty_fixed_array(); |
| 8251 Handle<FixedArray> result = | 8252 Handle<FixedArray> result = |
| 8252 isolate->factory()->NewFixedArray(new_length, pretenure); | 8253 isolate->factory()->NewFixedArray(new_length, pretenure); |
| (...skipping 8999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17252 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, | 17253 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, |
| 17253 Handle<Object> new_value) { | 17254 Handle<Object> new_value) { |
| 17254 if (cell->value() != *new_value) { | 17255 if (cell->value() != *new_value) { |
| 17255 cell->set_value(*new_value); | 17256 cell->set_value(*new_value); |
| 17256 Isolate* isolate = cell->GetIsolate(); | 17257 Isolate* isolate = cell->GetIsolate(); |
| 17257 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17258 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 17258 isolate, DependentCode::kPropertyCellChangedGroup); | 17259 isolate, DependentCode::kPropertyCellChangedGroup); |
| 17259 } | 17260 } |
| 17260 } | 17261 } |
| 17261 } } // namespace v8::internal | 17262 } } // namespace v8::internal |
| OLD | NEW |