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

Side by Side Diff: src/compiler/js-type-feedback.cc

Issue 1095313002: [turbofan] Fix reduction of LoadProperty/StoreProperty to LoadNamed/StoreNamed. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « src/compiler/js-operator.cc ('k') | test/mjsunit/compiler/named-load.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/compiler/js-type-feedback.h" 5 #include "src/compiler/js-type-feedback.h"
6 6
7 #include "src/property-details.h" 7 #include "src/property-details.h"
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/ast.h" 10 #include "src/ast.h"
11 #include "src/type-info.h" 11 #include "src/type-info.h"
12 12
13 #include "src/compiler/access-builder.h" 13 #include "src/compiler/access-builder.h"
14 #include "src/compiler/common-operator.h" 14 #include "src/compiler/common-operator.h"
15 #include "src/compiler/node-aux-data.h" 15 #include "src/compiler/node-aux-data.h"
16 #include "src/compiler/node-matchers.h" 16 #include "src/compiler/node-matchers.h"
17 #include "src/compiler/operator-properties.h"
17 #include "src/compiler/simplified-operator.h" 18 #include "src/compiler/simplified-operator.h"
18 19
19 namespace v8 { 20 namespace v8 {
20 namespace internal { 21 namespace internal {
21 namespace compiler { 22 namespace compiler {
22 23
23 enum LoadOrStore { LOAD, STORE }; 24 enum LoadOrStore { LOAD, STORE };
24 25
25 JSTypeFeedbackTable::JSTypeFeedbackTable(Zone* zone) 26 JSTypeFeedbackTable::JSTypeFeedbackTable(Zone* zone)
26 : map_(TypeFeedbackIdMap::key_compare(), 27 : map_(TypeFeedbackIdMap::key_compare(),
27 TypeFeedbackIdMap::allocator_type(zone)) {} 28 TypeFeedbackIdMap::allocator_type(zone)) {}
28 29
29 30
30 void JSTypeFeedbackTable::Record(Node* node, TypeFeedbackId id) { 31 void JSTypeFeedbackTable::Record(Node* node, TypeFeedbackId id) {
31 map_.insert(std::make_pair(node->id(), id)); 32 map_.insert(std::make_pair(node->id(), id));
32 } 33 }
33 34
34 35
35 Reduction JSTypeFeedbackSpecializer::Reduce(Node* node) { 36 Reduction JSTypeFeedbackSpecializer::Reduce(Node* node) {
36 switch (node->opcode()) { 37 switch (node->opcode()) {
37 case IrOpcode::kJSLoadProperty: { 38 case IrOpcode::kJSLoadProperty: {
38 HeapObjectMatcher<Name> match(node->InputAt(1)); 39 HeapObjectMatcher<Name> match(node->InputAt(1));
39 if (match.HasValue() && match.Value().handle()->IsName()) { 40 if (match.HasValue() && match.Value().handle()->IsName()) {
40 // LoadProperty(o, "constant") => LoadNamed["constant"](o). 41 // LoadProperty(o, "constant") => LoadNamed["constant"](o).
41 Unique<Name> name = match.Value(); 42 Unique<Name> name = match.Value();
42 const VectorSlotPair& feedback = 43 const VectorSlotPair& feedback =
43 LoadPropertyParametersOf(node->op()).feedback(); 44 LoadPropertyParametersOf(node->op()).feedback();
44 node->set_op(jsgraph()->javascript()->LoadNamed(name, feedback)); 45 node->set_op(jsgraph()->javascript()->LoadNamed(name, feedback,
46 NOT_CONTEXTUAL, KEYED));
45 node->RemoveInput(1); 47 node->RemoveInput(1);
46 return ReduceJSLoadNamed(node); 48 return ReduceJSLoadNamed(node);
47 } 49 }
48 return ReduceJSLoadProperty(node); 50 return ReduceJSLoadProperty(node);
49 } 51 }
50 case IrOpcode::kJSLoadNamed: 52 case IrOpcode::kJSLoadNamed:
51 return ReduceJSLoadNamed(node); 53 return ReduceJSLoadNamed(node);
52 case IrOpcode::kJSStoreNamed: 54 case IrOpcode::kJSStoreNamed:
53 return ReduceJSStoreNamed(node); 55 return ReduceJSStoreNamed(node);
54 case IrOpcode::kJSStoreProperty: { 56 case IrOpcode::kJSStoreProperty: {
55 HeapObjectMatcher<Name> match(node->InputAt(1)); 57 HeapObjectMatcher<Name> match(node->InputAt(1));
56 if (match.HasValue() && match.Value().handle()->IsName()) { 58 if (match.HasValue() && match.Value().handle()->IsName()) {
57 // StoreProperty(o, "constant", v) => StoreNamed["constant"](o, v). 59 // StoreProperty(o, "constant", v) => StoreNamed["constant"](o, v).
58 Unique<Name> name = match.Value(); 60 Unique<Name> name = match.Value();
59 LanguageMode language_mode = OpParameter<LanguageMode>(node); 61 LanguageMode language_mode = OpParameter<LanguageMode>(node);
60 node->set_op(jsgraph()->javascript()->StoreNamed(language_mode, name)); 62 if (FLAG_turbo_deoptimization) {
63 // StoreProperty has 2 frame state inputs, but StoreNamed only 1.
64 DCHECK_EQ(2, OperatorProperties::GetFrameStateInputCount(node->op()));
65 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1);
66 }
67 node->set_op(
68 jsgraph()->javascript()->StoreNamed(language_mode, name, KEYED));
61 node->RemoveInput(1); 69 node->RemoveInput(1);
62 return ReduceJSStoreNamed(node); 70 return ReduceJSStoreNamed(node);
63 } 71 }
64 return ReduceJSStoreProperty(node); 72 return ReduceJSStoreProperty(node);
65 } 73 }
66 default: 74 default:
67 break; 75 break;
68 } 76 }
69 return NoChange(); 77 return NoChange();
70 } 78 }
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 // TODO(turbofan): filter maps by initial receiver map if known 284 // TODO(turbofan): filter maps by initial receiver map if known
277 // TODO(turbofan): filter maps by native context (if specializing) 285 // TODO(turbofan): filter maps by native context (if specializing)
278 // TODO(turbofan): filter maps by effect chain 286 // TODO(turbofan): filter maps by effect chain
279 oracle()->PropertyReceiverTypes(id, name, maps); 287 oracle()->PropertyReceiverTypes(id, name, maps);
280 } 288 }
281 289
282 290
283 } // namespace compiler 291 } // namespace compiler
284 } // namespace internal 292 } // namespace internal
285 } // namespace v8 293 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-operator.cc ('k') | test/mjsunit/compiler/named-load.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698