| 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 "hydrogen.h" | 5 #include "hydrogen.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "v8.h" | 9 #include "v8.h" |
| 10 #include "allocation-site-scopes.h" | 10 #include "allocation-site-scopes.h" |
| (...skipping 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2409 | 2409 |
| 2410 HValue* min_growth = Add<HConstant>(16); | 2410 HValue* min_growth = Add<HConstant>(16); |
| 2411 | 2411 |
| 2412 new_capacity = AddUncasted<HAdd>(new_capacity, min_growth); | 2412 new_capacity = AddUncasted<HAdd>(new_capacity, min_growth); |
| 2413 new_capacity->ClearFlag(HValue::kCanOverflow); | 2413 new_capacity->ClearFlag(HValue::kCanOverflow); |
| 2414 | 2414 |
| 2415 return new_capacity; | 2415 return new_capacity; |
| 2416 } | 2416 } |
| 2417 | 2417 |
| 2418 | 2418 |
| 2419 void HGraphBuilder::BuildNewSpaceArrayCheck(HValue* length, ElementsKind kind) { | |
| 2420 int element_size = IsFastDoubleElementsKind(kind) ? kDoubleSize | |
| 2421 : kPointerSize; | |
| 2422 int max_size = Page::kMaxRegularHeapObjectSize / element_size; | |
| 2423 max_size -= JSArray::kSize / element_size; | |
| 2424 HConstant* max_size_constant = Add<HConstant>(max_size); | |
| 2425 Add<HBoundsCheck>(length, max_size_constant); | |
| 2426 } | |
| 2427 | |
| 2428 | |
| 2429 HValue* HGraphBuilder::BuildGrowElementsCapacity(HValue* object, | 2419 HValue* HGraphBuilder::BuildGrowElementsCapacity(HValue* object, |
| 2430 HValue* elements, | 2420 HValue* elements, |
| 2431 ElementsKind kind, | 2421 ElementsKind kind, |
| 2432 ElementsKind new_kind, | 2422 ElementsKind new_kind, |
| 2433 HValue* length, | 2423 HValue* length, |
| 2434 HValue* new_capacity) { | 2424 HValue* new_capacity) { |
| 2435 BuildNewSpaceArrayCheck(new_capacity, new_kind); | 2425 Add<HBoundsCheck>(new_capacity, Add<HConstant>( |
| 2426 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) >> |
| 2427 ElementsKindToShiftSize(kind))); |
| 2436 | 2428 |
| 2437 HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader( | 2429 HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader( |
| 2438 new_kind, new_capacity); | 2430 new_kind, new_capacity); |
| 2439 | 2431 |
| 2440 BuildCopyElements(elements, kind, | 2432 BuildCopyElements(elements, kind, |
| 2441 new_elements, new_kind, | 2433 new_elements, new_kind, |
| 2442 length, new_capacity); | 2434 length, new_capacity); |
| 2443 | 2435 |
| 2444 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), | 2436 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), |
| 2445 new_elements); | 2437 new_elements); |
| (...skipping 9257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11703 if (ShouldProduceTraceOutput()) { | 11695 if (ShouldProduceTraceOutput()) { |
| 11704 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11696 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11705 } | 11697 } |
| 11706 | 11698 |
| 11707 #ifdef DEBUG | 11699 #ifdef DEBUG |
| 11708 graph_->Verify(false); // No full verify. | 11700 graph_->Verify(false); // No full verify. |
| 11709 #endif | 11701 #endif |
| 11710 } | 11702 } |
| 11711 | 11703 |
| 11712 } } // namespace v8::internal | 11704 } } // namespace v8::internal |
| OLD | NEW |