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

Side by Side Diff: src/hydrogen.cc

Issue 863633002: Use signaling NaN for holes in fixed double arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Restore SSE2 Created 5 years, 11 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
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 "src/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 2783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2794 } 2794 }
2795 } 2795 }
2796 2796
2797 2797
2798 void HGraphBuilder::BuildFillElementsWithHole(HValue* elements, 2798 void HGraphBuilder::BuildFillElementsWithHole(HValue* elements,
2799 ElementsKind elements_kind, 2799 ElementsKind elements_kind,
2800 HValue* from, 2800 HValue* from,
2801 HValue* to) { 2801 HValue* to) {
2802 // Fast elements kinds need to be initialized in case statements below cause a 2802 // Fast elements kinds need to be initialized in case statements below cause a
2803 // garbage collection. 2803 // garbage collection.
2804 Factory* factory = isolate()->factory();
2805 2804
2806 double nan_double = FixedDoubleArray::hole_nan_as_double();
2807 HValue* hole = IsFastSmiOrObjectElementsKind(elements_kind) 2805 HValue* hole = IsFastSmiOrObjectElementsKind(elements_kind)
2808 ? Add<HConstant>(factory->the_hole_value()) 2806 ? graph()->GetConstantHole()
2809 : Add<HConstant>(nan_double); 2807 : Add<HConstant>(HConstant::kHoleNaN);
2810 2808
2811 // Since we're about to store a hole value, the store instruction below must 2809 // Since we're about to store a hole value, the store instruction below must
2812 // assume an elements kind that supports heap object values. 2810 // assume an elements kind that supports heap object values.
2813 if (IsFastSmiOrObjectElementsKind(elements_kind)) { 2811 if (IsFastSmiOrObjectElementsKind(elements_kind)) {
2814 elements_kind = FAST_HOLEY_ELEMENTS; 2812 elements_kind = FAST_HOLEY_ELEMENTS;
2815 } 2813 }
2816 2814
2817 BuildFillElementsWithValue(elements, elements_kind, from, to, hole); 2815 BuildFillElementsWithValue(elements, elements_kind, from, to, hole);
2818 } 2816 }
2819 2817
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2897 ElementsKind kind = (IsHoleyElementsKind(from_elements_kind) && 2895 ElementsKind kind = (IsHoleyElementsKind(from_elements_kind) &&
2898 IsFastSmiElementsKind(to_elements_kind)) 2896 IsFastSmiElementsKind(to_elements_kind))
2899 ? FAST_HOLEY_ELEMENTS : to_elements_kind; 2897 ? FAST_HOLEY_ELEMENTS : to_elements_kind;
2900 2898
2901 if (IsHoleyElementsKind(from_elements_kind) && 2899 if (IsHoleyElementsKind(from_elements_kind) &&
2902 from_elements_kind != to_elements_kind) { 2900 from_elements_kind != to_elements_kind) {
2903 IfBuilder if_hole(this); 2901 IfBuilder if_hole(this);
2904 if_hole.If<HCompareHoleAndBranch>(element); 2902 if_hole.If<HCompareHoleAndBranch>(element);
2905 if_hole.Then(); 2903 if_hole.Then();
2906 HConstant* hole_constant = IsFastDoubleElementsKind(to_elements_kind) 2904 HConstant* hole_constant = IsFastDoubleElementsKind(to_elements_kind)
2907 ? Add<HConstant>(FixedDoubleArray::hole_nan_as_double()) 2905 ? Add<HConstant>(HConstant::kHoleNaN)
2908 : graph()->GetConstantHole(); 2906 : graph()->GetConstantHole();
2909 Add<HStoreKeyed>(to_elements, key, hole_constant, kind); 2907 Add<HStoreKeyed>(to_elements, key, hole_constant, kind);
2910 if_hole.Else(); 2908 if_hole.Else();
2911 HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind); 2909 HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind);
2912 store->SetFlag(HValue::kAllowUndefinedAsNaN); 2910 store->SetFlag(HValue::kAllowUndefinedAsNaN);
2913 if_hole.End(); 2911 if_hole.End();
2914 } else { 2912 } else {
2915 HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind); 2913 HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind);
2916 store->SetFlag(HValue::kAllowUndefinedAsNaN); 2914 store->SetFlag(HValue::kAllowUndefinedAsNaN);
2917 } 2915 }
2918 2916
(...skipping 5453 matching lines...) Expand 10 before | Expand all | Expand 10 after
8372 length_checker.Else(); 8370 length_checker.Else();
8373 HValue* elements = AddLoadElements(checked_object); 8371 HValue* elements = AddLoadElements(checked_object);
8374 // Ensure that we aren't popping from a copy-on-write array. 8372 // Ensure that we aren't popping from a copy-on-write array.
8375 if (IsFastSmiOrObjectElementsKind(elements_kind)) { 8373 if (IsFastSmiOrObjectElementsKind(elements_kind)) {
8376 elements = BuildCopyElementsOnWrite(checked_object, elements, 8374 elements = BuildCopyElementsOnWrite(checked_object, elements,
8377 elements_kind, length); 8375 elements_kind, length);
8378 } 8376 }
8379 reduced_length = AddUncasted<HSub>(length, graph()->GetConstant1()); 8377 reduced_length = AddUncasted<HSub>(length, graph()->GetConstant1());
8380 result = AddElementAccess(elements, reduced_length, NULL, 8378 result = AddElementAccess(elements, reduced_length, NULL,
8381 bounds_check, elements_kind, LOAD); 8379 bounds_check, elements_kind, LOAD);
8382 Factory* factory = isolate()->factory();
8383 double nan_double = FixedDoubleArray::hole_nan_as_double();
8384 HValue* hole = IsFastSmiOrObjectElementsKind(elements_kind) 8380 HValue* hole = IsFastSmiOrObjectElementsKind(elements_kind)
8385 ? Add<HConstant>(factory->the_hole_value()) 8381 ? graph()->GetConstantHole()
8386 : Add<HConstant>(nan_double); 8382 : Add<HConstant>(HConstant::kHoleNaN);
8387 if (IsFastSmiOrObjectElementsKind(elements_kind)) { 8383 if (IsFastSmiOrObjectElementsKind(elements_kind)) {
8388 elements_kind = FAST_HOLEY_ELEMENTS; 8384 elements_kind = FAST_HOLEY_ELEMENTS;
8389 } 8385 }
8390 AddElementAccess( 8386 AddElementAccess(
8391 elements, reduced_length, hole, bounds_check, elements_kind, STORE); 8387 elements, reduced_length, hole, bounds_check, elements_kind, STORE);
8392 Add<HStoreNamedField>( 8388 Add<HStoreNamedField>(
8393 checked_object, HObjectAccess::ForArrayLength(elements_kind), 8389 checked_object, HObjectAccess::ForArrayLength(elements_kind),
8394 reduced_length, STORE_TO_INITIALIZED_ENTRY); 8390 reduced_length, STORE_TO_INITIALIZED_ENTRY);
8395 8391
8396 if (!ast_context()->IsEffect()) Push(result); 8392 if (!ast_context()->IsEffect()) Push(result);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
8538 HValue* element = AddUncasted<HLoadKeyed>( 8534 HValue* element = AddUncasted<HLoadKeyed>(
8539 elements, key, lengthiszero, copy_kind, ALLOW_RETURN_HOLE); 8535 elements, key, lengthiszero, copy_kind, ALLOW_RETURN_HOLE);
8540 HStoreKeyed* store = 8536 HStoreKeyed* store =
8541 Add<HStoreKeyed>(elements, new_key, element, copy_kind); 8537 Add<HStoreKeyed>(elements, new_key, element, copy_kind);
8542 store->SetFlag(HValue::kAllowUndefinedAsNaN); 8538 store->SetFlag(HValue::kAllowUndefinedAsNaN);
8543 } 8539 }
8544 loop.EndBody(); 8540 loop.EndBody();
8545 8541
8546 // Put a hole at the end. 8542 // Put a hole at the end.
8547 HValue* hole = IsFastSmiOrObjectElementsKind(kind) 8543 HValue* hole = IsFastSmiOrObjectElementsKind(kind)
8548 ? Add<HConstant>(isolate()->factory()->the_hole_value()) 8544 ? graph()->GetConstantHole()
8549 : Add<HConstant>(FixedDoubleArray::hole_nan_as_double()); 8545 : Add<HConstant>(HConstant::kHoleNaN);
8550 if (IsFastSmiOrObjectElementsKind(kind)) kind = FAST_HOLEY_ELEMENTS; 8546 if (IsFastSmiOrObjectElementsKind(kind)) kind = FAST_HOLEY_ELEMENTS;
8551 Add<HStoreKeyed>( 8547 Add<HStoreKeyed>(
8552 elements, new_length, hole, kind, INITIALIZING_STORE); 8548 elements, new_length, hole, kind, INITIALIZING_STORE);
8553 8549
8554 // Remember new length. 8550 // Remember new length.
8555 Add<HStoreNamedField>( 8551 Add<HStoreNamedField>(
8556 receiver, HObjectAccess::ForArrayLength(kind), 8552 receiver, HObjectAccess::ForArrayLength(kind),
8557 new_length, STORE_TO_INITIALIZED_ENTRY); 8553 new_length, STORE_TO_INITIALIZED_ENTRY);
8558 } 8554 }
8559 if_inline.Else(); 8555 if_inline.Else();
(...skipping 4907 matching lines...) Expand 10 before | Expand all | Expand 10 after
13467 if (ShouldProduceTraceOutput()) { 13463 if (ShouldProduceTraceOutput()) {
13468 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13464 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13469 } 13465 }
13470 13466
13471 #ifdef DEBUG 13467 #ifdef DEBUG
13472 graph_->Verify(false); // No full verify. 13468 graph_->Verify(false); // No full verify.
13473 #endif 13469 #endif
13474 } 13470 }
13475 13471
13476 } } // namespace v8::internal 13472 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/hydrogen-instructions.h » ('j') | src/hydrogen-instructions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698