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

Side by Side Diff: src/compiler/js-intrinsic-lowering.cc

Issue 1552473002: Revert of [runtime] Introduce dedicated JSBoundFunction to represent bound functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@FunctionConstructor
Patch Set: Created 4 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
« no previous file with comments | « src/compiler/js-intrinsic-lowering.h ('k') | src/crankshaft/hydrogen.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 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-intrinsic-lowering.h" 5 #include "src/compiler/js-intrinsic-lowering.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return ReduceDoubleLo(node); 49 return ReduceDoubleLo(node);
50 case Runtime::kInlineIncrementStatsCounter: 50 case Runtime::kInlineIncrementStatsCounter:
51 return ReduceIncrementStatsCounter(node); 51 return ReduceIncrementStatsCounter(node);
52 case Runtime::kInlineIsArray: 52 case Runtime::kInlineIsArray:
53 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); 53 return ReduceIsInstanceType(node, JS_ARRAY_TYPE);
54 case Runtime::kInlineIsDate: 54 case Runtime::kInlineIsDate:
55 return ReduceIsInstanceType(node, JS_DATE_TYPE); 55 return ReduceIsInstanceType(node, JS_DATE_TYPE);
56 case Runtime::kInlineIsTypedArray: 56 case Runtime::kInlineIsTypedArray:
57 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); 57 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE);
58 case Runtime::kInlineIsFunction: 58 case Runtime::kInlineIsFunction:
59 return ReduceIsFunction(node); 59 return ReduceIsInstanceType(node, JS_FUNCTION_TYPE);
60 case Runtime::kInlineIsRegExp: 60 case Runtime::kInlineIsRegExp:
61 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); 61 return ReduceIsInstanceType(node, JS_REGEXP_TYPE);
62 case Runtime::kInlineIsJSReceiver: 62 case Runtime::kInlineIsJSReceiver:
63 return ReduceIsJSReceiver(node); 63 return ReduceIsJSReceiver(node);
64 case Runtime::kInlineIsSmi: 64 case Runtime::kInlineIsSmi:
65 return ReduceIsSmi(node); 65 return ReduceIsSmi(node);
66 case Runtime::kInlineJSValueGetValue: 66 case Runtime::kInlineJSValueGetValue:
67 return ReduceJSValueGetValue(node); 67 return ReduceJSValueGetValue(node);
68 case Runtime::kInlineMathClz32: 68 case Runtime::kInlineMathClz32:
69 return ReduceMathClz32(node); 69 return ReduceMathClz32(node);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // Replace all effect uses of {node} with the {ephi}. 244 // Replace all effect uses of {node} with the {ephi}.
245 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge); 245 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge);
246 ReplaceWithValue(node, node, ephi); 246 ReplaceWithValue(node, node, ephi);
247 247
248 // Turn the {node} into a Phi. 248 // Turn the {node} into a Phi.
249 return Change(node, common()->Phi(MachineRepresentation::kTagged, 2), vtrue, 249 return Change(node, common()->Phi(MachineRepresentation::kTagged, 2), vtrue,
250 vfalse, merge); 250 vfalse, merge);
251 } 251 }
252 252
253 253
254 Reduction JSIntrinsicLowering::ReduceIsFunction(Node* node) {
255 Node* value = NodeProperties::GetValueInput(node, 0);
256 Type* value_type = NodeProperties::GetType(value);
257 Node* effect = NodeProperties::GetEffectInput(node);
258 Node* control = NodeProperties::GetControlInput(node);
259 if (value_type->Is(Type::Function())) {
260 value = jsgraph()->TrueConstant();
261 } else {
262 // if (%_IsSmi(value)) {
263 // return false;
264 // } else {
265 // return FIRST_FUNCTION_TYPE <= %_GetInstanceType(%_GetMap(value))
266 // }
267 STATIC_ASSERT(LAST_TYPE == LAST_FUNCTION_TYPE);
268
269 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
270 Node* branch = graph()->NewNode(common()->Branch(), check, control);
271
272 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
273 Node* etrue = effect;
274 Node* vtrue = jsgraph()->FalseConstant();
275
276 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
277 Node* efalse = graph()->NewNode(
278 simplified()->LoadField(AccessBuilder::ForMapInstanceType()),
279 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()),
280 value, effect, if_false),
281 effect, if_false);
282 Node* vfalse =
283 graph()->NewNode(machine()->Uint32LessThanOrEqual(),
284 jsgraph()->Int32Constant(FIRST_FUNCTION_TYPE), efalse);
285
286 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
287 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
288 value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
289 vtrue, vfalse, control);
290 }
291 ReplaceWithValue(node, node, effect, control);
292 return Replace(value);
293 }
294
295
296 Reduction JSIntrinsicLowering::ReduceIsJSReceiver(Node* node) { 254 Reduction JSIntrinsicLowering::ReduceIsJSReceiver(Node* node) {
297 Node* value = NodeProperties::GetValueInput(node, 0); 255 Node* value = NodeProperties::GetValueInput(node, 0);
298 Type* value_type = NodeProperties::GetType(value); 256 Type* value_type = NodeProperties::GetType(value);
299 Node* effect = NodeProperties::GetEffectInput(node); 257 Node* effect = NodeProperties::GetEffectInput(node);
300 Node* control = NodeProperties::GetControlInput(node); 258 Node* control = NodeProperties::GetControlInput(node);
301 if (value_type->Is(Type::Receiver())) { 259 if (value_type->Is(Type::Receiver())) {
302 value = jsgraph()->TrueConstant(); 260 value = jsgraph()->TrueConstant();
303 } else if (!value_type->Maybe(Type::Receiver())) { 261 } else if (!value_type->Maybe(Type::Receiver())) {
304 value = jsgraph()->FalseConstant(); 262 value = jsgraph()->FalseConstant();
305 } else { 263 } else {
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 } 691 }
734 692
735 693
736 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { 694 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const {
737 return jsgraph()->simplified(); 695 return jsgraph()->simplified();
738 } 696 }
739 697
740 } // namespace compiler 698 } // namespace compiler
741 } // namespace internal 699 } // namespace internal
742 } // namespace v8 700 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-intrinsic-lowering.h ('k') | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698