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

Side by Side Diff: src/compiler/operator-properties.cc

Issue 983153002: [turbofan] Add an extra frame state for deoptimization before binary op. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweak Created 5 years, 9 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/operator-properties.h ('k') | src/compiler/verifier.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/operator-properties.h" 5 #include "src/compiler/operator-properties.h"
6 6
7 #include "src/compiler/js-operator.h" 7 #include "src/compiler/js-operator.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/opcodes.h" 9 #include "src/compiler/opcodes.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15 // static 15 // static
16 bool OperatorProperties::HasContextInput(const Operator* op) { 16 bool OperatorProperties::HasContextInput(const Operator* op) {
17 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode()); 17 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
18 return IrOpcode::IsJsOpcode(opcode); 18 return IrOpcode::IsJsOpcode(opcode);
19 } 19 }
20 20
21 21
22 // static 22 // static
23 bool OperatorProperties::HasFrameStateInput(const Operator* op) { 23 int OperatorProperties::GetFrameStateInputCount(const Operator* op) {
24 if (!FLAG_turbo_deoptimization) { 24 if (!FLAG_turbo_deoptimization) {
25 return false; 25 return 0;
26 } 26 }
27 switch (op->opcode()) { 27 switch (op->opcode()) {
28 case IrOpcode::kFrameState: 28 case IrOpcode::kFrameState:
29 return true; 29 return 1;
30 case IrOpcode::kJSCallRuntime: { 30 case IrOpcode::kJSCallRuntime: {
31 const CallRuntimeParameters& p = CallRuntimeParametersOf(op); 31 const CallRuntimeParameters& p = CallRuntimeParametersOf(op);
32 return Linkage::NeedsFrameState(p.id()); 32 return Linkage::NeedsFrameState(p.id());
33 } 33 }
34 34
35 // Strict equality cannot lazily deoptimize. 35 // Strict equality cannot lazily deoptimize.
36 case IrOpcode::kJSStrictEqual: 36 case IrOpcode::kJSStrictEqual:
37 case IrOpcode::kJSStrictNotEqual: 37 case IrOpcode::kJSStrictNotEqual:
38 return false; 38 return 0;
39 39
40 // Calls 40 // Calls
41 case IrOpcode::kJSCallFunction: 41 case IrOpcode::kJSCallFunction:
42 case IrOpcode::kJSCallConstruct: 42 case IrOpcode::kJSCallConstruct:
43 43
44 // Compare operations 44 // Compare operations
45 case IrOpcode::kJSEqual: 45 case IrOpcode::kJSEqual:
46 case IrOpcode::kJSGreaterThan: 46 case IrOpcode::kJSGreaterThan:
47 case IrOpcode::kJSGreaterThanOrEqual: 47 case IrOpcode::kJSGreaterThanOrEqual:
48 case IrOpcode::kJSHasProperty: 48 case IrOpcode::kJSHasProperty:
49 case IrOpcode::kJSInstanceOf: 49 case IrOpcode::kJSInstanceOf:
50 case IrOpcode::kJSLessThan: 50 case IrOpcode::kJSLessThan:
51 case IrOpcode::kJSLessThanOrEqual: 51 case IrOpcode::kJSLessThanOrEqual:
52 case IrOpcode::kJSNotEqual: 52 case IrOpcode::kJSNotEqual:
53 53
54 // Binary operations
55 case IrOpcode::kJSAdd:
56 case IrOpcode::kJSBitwiseAnd:
57 case IrOpcode::kJSBitwiseOr:
58 case IrOpcode::kJSBitwiseXor:
59 case IrOpcode::kJSDivide:
60 case IrOpcode::kJSModulus:
61 case IrOpcode::kJSMultiply:
62 case IrOpcode::kJSShiftLeft:
63 case IrOpcode::kJSShiftRight:
64 case IrOpcode::kJSShiftRightLogical:
65 case IrOpcode::kJSSubtract:
66
67 // Context operations 54 // Context operations
68 case IrOpcode::kJSCreateWithContext: 55 case IrOpcode::kJSCreateWithContext:
69 56
70 // Conversions 57 // Conversions
71 case IrOpcode::kJSToObject: 58 case IrOpcode::kJSToObject:
72 case IrOpcode::kJSToNumber: 59 case IrOpcode::kJSToNumber:
73 case IrOpcode::kJSToName: 60 case IrOpcode::kJSToName:
74 61
75 // Properties 62 // Properties
76 case IrOpcode::kJSLoadNamed: 63 case IrOpcode::kJSLoadNamed:
77 case IrOpcode::kJSLoadProperty: 64 case IrOpcode::kJSLoadProperty:
78 case IrOpcode::kJSStoreNamed: 65 case IrOpcode::kJSStoreNamed:
79 case IrOpcode::kJSStoreProperty: 66 case IrOpcode::kJSStoreProperty:
80 case IrOpcode::kJSDeleteProperty: 67 case IrOpcode::kJSDeleteProperty:
81 return true; 68 return 1;
69
70 // Binary operators that can deopt in the middle the operation (e.g.,
71 // as a result of lazy deopt in ToNumber conversion) need a second frame
72 // state so that we can resume before the operation.
73 case IrOpcode::kJSMultiply:
74 case IrOpcode::kJSAdd:
75 case IrOpcode::kJSBitwiseAnd:
76 case IrOpcode::kJSBitwiseOr:
77 case IrOpcode::kJSBitwiseXor:
78 case IrOpcode::kJSDivide:
79 case IrOpcode::kJSModulus:
80 case IrOpcode::kJSShiftLeft:
81 case IrOpcode::kJSShiftRight:
82 case IrOpcode::kJSShiftRightLogical:
83 case IrOpcode::kJSSubtract:
84 return 2;
82 85
83 default: 86 default:
84 return false; 87 return 0;
85 } 88 }
86 } 89 }
87 90
88 91
89 // static 92 // static
90 int OperatorProperties::GetTotalInputCount(const Operator* op) { 93 int OperatorProperties::GetTotalInputCount(const Operator* op) {
91 return op->ValueInputCount() + GetContextInputCount(op) + 94 return op->ValueInputCount() + GetContextInputCount(op) +
92 GetFrameStateInputCount(op) + op->EffectInputCount() + 95 GetFrameStateInputCount(op) + op->EffectInputCount() +
93 op->ControlInputCount(); 96 op->ControlInputCount();
94 } 97 }
95 98
96 99
97 // static 100 // static
98 bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { 101 bool OperatorProperties::IsBasicBlockBegin(const Operator* op) {
99 Operator::Opcode const opcode = op->opcode(); 102 Operator::Opcode const opcode = op->opcode();
100 return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd || 103 return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd ||
101 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || 104 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop ||
102 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || 105 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue ||
103 opcode == IrOpcode::kIfFalse || opcode == IrOpcode::kIfSuccess || 106 opcode == IrOpcode::kIfFalse || opcode == IrOpcode::kIfSuccess ||
104 opcode == IrOpcode::kIfException || opcode == IrOpcode::kIfValue || 107 opcode == IrOpcode::kIfException || opcode == IrOpcode::kIfValue ||
105 opcode == IrOpcode::kIfDefault; 108 opcode == IrOpcode::kIfDefault;
106 } 109 }
107 110
108 } // namespace compiler 111 } // namespace compiler
109 } // namespace internal 112 } // namespace internal
110 } // namespace v8 113 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/operator-properties.h ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698