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

Side by Side Diff: src/hydrogen.cc

Issue 300283003: FastCloneShallowArrayStub should not be used it the length of the array is too big as it could even… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/code-stubs.h ('k') | src/ia32/full-codegen-ia32.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 "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 2507 matching lines...) Expand 10 before | Expand all | Expand 10 after
2518 ElementsKind from_elements_kind, 2518 ElementsKind from_elements_kind,
2519 HValue* to_elements, 2519 HValue* to_elements,
2520 ElementsKind to_elements_kind, 2520 ElementsKind to_elements_kind,
2521 HValue* length, 2521 HValue* length,
2522 HValue* capacity) { 2522 HValue* capacity) {
2523 int constant_capacity = -1; 2523 int constant_capacity = -1;
2524 if (capacity != NULL && 2524 if (capacity != NULL &&
2525 capacity->IsConstant() && 2525 capacity->IsConstant() &&
2526 HConstant::cast(capacity)->HasInteger32Value()) { 2526 HConstant::cast(capacity)->HasInteger32Value()) {
2527 int constant_candidate = HConstant::cast(capacity)->Integer32Value(); 2527 int constant_candidate = HConstant::cast(capacity)->Integer32Value();
2528 if (constant_candidate <= 2528 if (constant_candidate <= kElementLoopUnrollThreshold) {
2529 FastCloneShallowArrayStub::kMaximumInlinedCloneLength) {
2530 constant_capacity = constant_candidate; 2529 constant_capacity = constant_candidate;
2531 } 2530 }
2532 } 2531 }
2533 2532
2534 if (constant_capacity != -1) { 2533 if (constant_capacity != -1) {
2535 // Unroll the loop for small elements kinds. 2534 // Unroll the loop for small elements kinds.
2536 for (int i = 0; i < constant_capacity; i++) { 2535 for (int i = 0; i < constant_capacity; i++) {
2537 HValue* key_constant = Add<HConstant>(i); 2536 HValue* key_constant = Add<HConstant>(i);
2538 HInstruction* value = Add<HLoadKeyed>(from_elements, key_constant, 2537 HInstruction* value = Add<HLoadKeyed>(from_elements, key_constant,
2539 static_cast<HValue*>(NULL), 2538 static_cast<HValue*>(NULL),
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 int elements_kind_size = IsFastDoubleElementsKind(kind) 2693 int elements_kind_size = IsFastDoubleElementsKind(kind)
2695 ? kDoubleSize : kPointerSize; 2694 ? kDoubleSize : kPointerSize;
2696 2695
2697 HValue* boilerplate_elements = AddLoadElements(boilerplate); 2696 HValue* boilerplate_elements = AddLoadElements(boilerplate);
2698 HValue* capacity = AddLoadFixedArrayLength(boilerplate_elements); 2697 HValue* capacity = AddLoadFixedArrayLength(boilerplate_elements);
2699 HValue* extra = AddUncasted<HMul>(capacity, 2698 HValue* extra = AddUncasted<HMul>(capacity,
2700 Add<HConstant>(elements_kind_size)); 2699 Add<HConstant>(elements_kind_size));
2701 extra->ClearFlag(HValue::kCanOverflow); 2700 extra->ClearFlag(HValue::kCanOverflow);
2702 extra = AddUncasted<HAdd>(extra, Add<HConstant>(FixedArray::kHeaderSize)); 2701 extra = AddUncasted<HAdd>(extra, Add<HConstant>(FixedArray::kHeaderSize));
2703 extra->ClearFlag(HValue::kCanOverflow); 2702 extra->ClearFlag(HValue::kCanOverflow);
2703 // This function implicitly relies on the fact that the
2704 // FastCloneShallowArrayStub is called only for literals shorter than
2705 // JSObject::kInitialMaxFastElementArray and therefore the size of the
2706 // resulting folded allocation will always be in allowed range.
2707 // Can't add HBoundsCheck here because otherwise the stub will eager a frame.
2708
2704 HValue* elements = NULL; 2709 HValue* elements = NULL;
2705 HValue* result = BuildCloneShallowArrayCommon(boilerplate, 2710 HValue* result = BuildCloneShallowArrayCommon(boilerplate,
2706 allocation_site, extra, &elements, mode); 2711 allocation_site, extra, &elements, mode);
2707 Add<HStoreNamedField>(result, HObjectAccess::ForElementsPointer(), 2712 Add<HStoreNamedField>(result, HObjectAccess::ForElementsPointer(),
2708 elements, INITIALIZING_STORE); 2713 elements, INITIALIZING_STORE);
2709 2714
2710 // The allocation for the cloned array above causes register pressure on 2715 // The allocation for the cloned array above causes register pressure on
2711 // machines with low register counts. Force a reload of the boilerplate 2716 // machines with low register counts. Force a reload of the boilerplate
2712 // elements here to free up a register for the allocation to avoid unnecessary 2717 // elements here to free up a register for the allocation to avoid unnecessary
2713 // spillage. 2718 // spillage.
(...skipping 9081 matching lines...) Expand 10 before | Expand all | Expand 10 after
11795 if (ShouldProduceTraceOutput()) { 11800 if (ShouldProduceTraceOutput()) {
11796 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11801 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11797 } 11802 }
11798 11803
11799 #ifdef DEBUG 11804 #ifdef DEBUG
11800 graph_->Verify(false); // No full verify. 11805 graph_->Verify(false); // No full verify.
11801 #endif 11806 #endif
11802 } 11807 }
11803 11808
11804 } } // namespace v8::internal 11809 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698