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

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 2161943002: [crankshaft] Guard against side effects in Array.prototype.shift lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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-crbug-614644.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 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/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/allocation-site-scopes.h" 9 #include "src/allocation-site-scopes.h"
10 #include "src/ast/ast-numbering.h" 10 #include "src/ast/ast-numbering.h"
(...skipping 9054 matching lines...) Expand 10 before | Expand all | Expand 10 after
9065 // chain, which would cause elements to go to dictionary mode and result 9065 // chain, which would cause elements to go to dictionary mode and result
9066 // in a map change. 9066 // in a map change.
9067 BuildCheckPrototypeMaps( 9067 BuildCheckPrototypeMaps(
9068 handle(JSObject::cast(receiver_map->prototype()), isolate()), 9068 handle(JSObject::cast(receiver_map->prototype()), isolate()),
9069 Handle<JSObject>::null()); 9069 Handle<JSObject>::null());
9070 9070
9071 // Threshold for fast inlined Array.shift(). 9071 // Threshold for fast inlined Array.shift().
9072 HConstant* inline_threshold = Add<HConstant>(static_cast<int32_t>(16)); 9072 HConstant* inline_threshold = Add<HConstant>(static_cast<int32_t>(16));
9073 9073
9074 Drop(args_count_no_receiver); 9074 Drop(args_count_no_receiver);
9075 HValue* result;
9075 HValue* receiver = Pop(); 9076 HValue* receiver = Pop();
9077 HValue* checked_object = AddCheckMap(receiver, receiver_map);
9078 HValue* length = Add<HLoadNamedField>(
9079 receiver, checked_object, HObjectAccess::ForArrayLength(kind));
9080
9076 Drop(1); // Function. 9081 Drop(1); // Function.
9077 HValue* result;
9078
9079 { 9082 {
9080 NoObservableSideEffectsScope scope(this); 9083 NoObservableSideEffectsScope scope(this);
9081 9084
9082 HValue* length = Add<HLoadNamedField>(
9083 receiver, nullptr, HObjectAccess::ForArrayLength(kind));
9084
9085 IfBuilder if_lengthiszero(this); 9085 IfBuilder if_lengthiszero(this);
9086 HValue* lengthiszero = if_lengthiszero.If<HCompareNumericAndBranch>( 9086 HValue* lengthiszero = if_lengthiszero.If<HCompareNumericAndBranch>(
9087 length, graph()->GetConstant0(), Token::EQ); 9087 length, graph()->GetConstant0(), Token::EQ);
9088 if_lengthiszero.Then(); 9088 if_lengthiszero.Then();
9089 { 9089 {
9090 if (!ast_context()->IsEffect()) Push(graph()->GetConstantUndefined()); 9090 if (!ast_context()->IsEffect()) Push(graph()->GetConstantUndefined());
9091 } 9091 }
9092 if_lengthiszero.Else(); 9092 if_lengthiszero.Else();
9093 { 9093 {
9094 HValue* elements = AddLoadElements(receiver); 9094 HValue* elements = AddLoadElements(receiver);
(...skipping 4323 matching lines...) Expand 10 before | Expand all | Expand 10 after
13418 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13418 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13419 } 13419 }
13420 13420
13421 #ifdef DEBUG 13421 #ifdef DEBUG
13422 graph_->Verify(false); // No full verify. 13422 graph_->Verify(false); // No full verify.
13423 #endif 13423 #endif
13424 } 13424 }
13425 13425
13426 } // namespace internal 13426 } // namespace internal
13427 } // namespace v8 13427 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-614644.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698