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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 1868973002: Fix representation issue in FastArrayPushStub (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: moa Created 4 years, 8 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-599089-array-push.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include "src/bailout-reason.h" 7 #include "src/bailout-reason.h"
8 #include "src/crankshaft/hydrogen.h" 8 #include "src/crankshaft/hydrogen.h"
9 #include "src/crankshaft/lithium.h" 9 #include "src/crankshaft/lithium.h"
10 #include "src/field-index.h" 10 #include "src/field-index.h"
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 HValue* argument_elements, 787 HValue* argument_elements,
788 ElementsKind kind) { 788 ElementsKind kind) {
789 // Precheck whether all elements fit into the array. 789 // Precheck whether all elements fit into the array.
790 if (!IsFastObjectElementsKind(kind)) { 790 if (!IsFastObjectElementsKind(kind)) {
791 LoopBuilder builder(this, context(), LoopBuilder::kPostIncrement); 791 LoopBuilder builder(this, context(), LoopBuilder::kPostIncrement);
792 HValue* start = graph()->GetConstant0(); 792 HValue* start = graph()->GetConstant0();
793 HValue* key = builder.BeginBody(start, argc, Token::LT); 793 HValue* key = builder.BeginBody(start, argc, Token::LT);
794 { 794 {
795 HInstruction* argument = 795 HInstruction* argument =
796 Add<HAccessArgumentsAt>(argument_elements, argc, key); 796 Add<HAccessArgumentsAt>(argument_elements, argc, key);
797 Representation r = IsFastSmiElementsKind(kind) ? Representation::Smi() 797 IfBuilder can_store(this);
798 : Representation::Double(); 798 can_store.IfNot<HIsSmiAndBranch>(argument);
799 AddUncasted<HForceRepresentation>(argument, r); 799 if (IsFastDoubleElementsKind(kind)) {
800 can_store.And();
801 can_store.IfNot<HCompareMap>(argument,
802 isolate()->factory()->heap_number_map());
803 }
804 can_store.ThenDeopt(Deoptimizer::kFastArrayPushFailed);
805 can_store.End();
800 } 806 }
801 builder.EndBody(); 807 builder.EndBody();
802 } 808 }
803 809
804 HValue* length = Add<HLoadNamedField>(object, nullptr, 810 HValue* length = Add<HLoadNamedField>(object, nullptr,
805 HObjectAccess::ForArrayLength(kind)); 811 HObjectAccess::ForArrayLength(kind));
806 HValue* new_length = AddUncasted<HAdd>(length, argc); 812 HValue* new_length = AddUncasted<HAdd>(length, argc);
807 HValue* max_key = AddUncasted<HSub>(new_length, graph()->GetConstant1()); 813 HValue* max_key = AddUncasted<HSub>(new_length, graph()->GetConstant1());
808 814
809 HValue* elements = Add<HLoadNamedField>(object, nullptr, 815 HValue* elements = Add<HLoadNamedField>(object, nullptr,
(...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 return Pop(); 2574 return Pop();
2569 } 2575 }
2570 2576
2571 2577
2572 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2578 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2573 return DoGenerateCode(this); 2579 return DoGenerateCode(this);
2574 } 2580 }
2575 2581
2576 } // namespace internal 2582 } // namespace internal
2577 } // namespace v8 2583 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-599089-array-push.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698