OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 case Runtime::kInlineGeneratorGetInputOrDebugPos: | 41 case Runtime::kInlineGeneratorGetInputOrDebugPos: |
42 return ReduceGeneratorGetInputOrDebugPos(node); | 42 return ReduceGeneratorGetInputOrDebugPos(node); |
43 case Runtime::kInlineGeneratorGetResumeMode: | 43 case Runtime::kInlineGeneratorGetResumeMode: |
44 return ReduceGeneratorGetResumeMode(node); | 44 return ReduceGeneratorGetResumeMode(node); |
45 case Runtime::kInlineGeneratorGetContext: | 45 case Runtime::kInlineGeneratorGetContext: |
46 return ReduceGeneratorGetContext(node); | 46 return ReduceGeneratorGetContext(node); |
47 case Runtime::kInlineIsArray: | 47 case Runtime::kInlineIsArray: |
48 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); | 48 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); |
49 case Runtime::kInlineIsTypedArray: | 49 case Runtime::kInlineIsTypedArray: |
50 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); | 50 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); |
| 51 case Runtime::kInlineIsJSProxy: |
| 52 return ReduceIsInstanceType(node, JS_PROXY_TYPE); |
51 case Runtime::kInlineIsJSReceiver: | 53 case Runtime::kInlineIsJSReceiver: |
52 return ReduceIsJSReceiver(node); | 54 return ReduceIsJSReceiver(node); |
53 case Runtime::kInlineIsSmi: | 55 case Runtime::kInlineIsSmi: |
54 return ReduceIsSmi(node); | 56 return ReduceIsSmi(node); |
55 case Runtime::kInlineFixedArrayGet: | 57 case Runtime::kInlineFixedArrayGet: |
56 return ReduceFixedArrayGet(node); | 58 return ReduceFixedArrayGet(node); |
57 case Runtime::kInlineFixedArraySet: | 59 case Runtime::kInlineFixedArraySet: |
58 return ReduceFixedArraySet(node); | 60 return ReduceFixedArraySet(node); |
59 case Runtime::kInlineRegExpExec: | 61 case Runtime::kInlineRegExpExec: |
60 return ReduceRegExpExec(node); | 62 return ReduceRegExpExec(node); |
61 case Runtime::kInlineSubString: | 63 case Runtime::kInlineSubString: |
62 return ReduceSubString(node); | 64 return ReduceSubString(node); |
63 case Runtime::kInlineToInteger: | 65 case Runtime::kInlineToInteger: |
64 return ReduceToInteger(node); | 66 return ReduceToInteger(node); |
65 case Runtime::kInlineToLength: | 67 case Runtime::kInlineToLength: |
66 return ReduceToLength(node); | 68 return ReduceToLength(node); |
67 case Runtime::kInlineToNumber: | 69 case Runtime::kInlineToNumber: |
68 return ReduceToNumber(node); | 70 return ReduceToNumber(node); |
69 case Runtime::kInlineToObject: | 71 case Runtime::kInlineToObject: |
70 return ReduceToObject(node); | 72 return ReduceToObject(node); |
71 case Runtime::kInlineToString: | 73 case Runtime::kInlineToString: |
72 return ReduceToString(node); | 74 return ReduceToString(node); |
73 case Runtime::kInlineCall: | 75 case Runtime::kInlineCall: |
74 return ReduceCall(node); | 76 return ReduceCall(node); |
75 case Runtime::kInlineGetSuperConstructor: | 77 case Runtime::kInlineGetSuperConstructor: |
76 return ReduceGetSuperConstructor(node); | 78 return ReduceGetSuperConstructor(node); |
| 79 case Runtime::kInlineJSCollectionGetTable: |
| 80 return ReduceJSCollectionGetTable(node); |
| 81 case Runtime::kInlineStringGetRawHashField: |
| 82 return ReduceStringGetRawHashField(node); |
| 83 case Runtime::kInlineTheHole: |
| 84 return ReduceTheHole(node); |
77 default: | 85 default: |
78 break; | 86 break; |
79 } | 87 } |
80 return NoChange(); | 88 return NoChange(); |
81 } | 89 } |
82 | 90 |
83 | 91 |
84 Reduction JSIntrinsicLowering::ReduceCreateIterResultObject(Node* node) { | 92 Reduction JSIntrinsicLowering::ReduceCreateIterResultObject(Node* node) { |
85 Node* const value = NodeProperties::GetValueInput(node, 0); | 93 Node* const value = NodeProperties::GetValueInput(node, 0); |
86 Node* const done = NodeProperties::GetValueInput(node, 1); | 94 Node* const done = NodeProperties::GetValueInput(node, 1); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 Node* active_function = NodeProperties::GetValueInput(node, 0); | 308 Node* active_function = NodeProperties::GetValueInput(node, 0); |
301 Node* effect = NodeProperties::GetEffectInput(node); | 309 Node* effect = NodeProperties::GetEffectInput(node); |
302 Node* control = NodeProperties::GetControlInput(node); | 310 Node* control = NodeProperties::GetControlInput(node); |
303 Node* active_function_map = effect = | 311 Node* active_function_map = effect = |
304 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), | 312 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), |
305 active_function, effect, control); | 313 active_function, effect, control); |
306 return Change(node, simplified()->LoadField(AccessBuilder::ForMapPrototype()), | 314 return Change(node, simplified()->LoadField(AccessBuilder::ForMapPrototype()), |
307 active_function_map, effect, control); | 315 active_function_map, effect, control); |
308 } | 316 } |
309 | 317 |
| 318 Reduction JSIntrinsicLowering::ReduceJSCollectionGetTable(Node* node) { |
| 319 Node* collection = NodeProperties::GetValueInput(node, 0); |
| 320 Node* effect = NodeProperties::GetEffectInput(node); |
| 321 Node* control = NodeProperties::GetControlInput(node); |
| 322 return Change(node, |
| 323 simplified()->LoadField(AccessBuilder::ForJSCollectionTable()), |
| 324 collection, effect, control); |
| 325 } |
| 326 |
| 327 Reduction JSIntrinsicLowering::ReduceStringGetRawHashField(Node* node) { |
| 328 Node* string = NodeProperties::GetValueInput(node, 0); |
| 329 Node* effect = NodeProperties::GetEffectInput(node); |
| 330 Node* control = NodeProperties::GetControlInput(node); |
| 331 return Change(node, |
| 332 simplified()->LoadField(AccessBuilder::ForNameHashField()), |
| 333 string, effect, control); |
| 334 } |
| 335 |
| 336 Reduction JSIntrinsicLowering::ReduceTheHole(Node* node) { |
| 337 Node* value = jsgraph()->TheHoleConstant(); |
| 338 ReplaceWithValue(node, value); |
| 339 return Replace(value); |
| 340 } |
| 341 |
310 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, | 342 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, |
311 Node* b) { | 343 Node* b) { |
312 RelaxControls(node); | 344 RelaxControls(node); |
313 node->ReplaceInput(0, a); | 345 node->ReplaceInput(0, a); |
314 node->ReplaceInput(1, b); | 346 node->ReplaceInput(1, b); |
315 node->TrimInputCount(2); | 347 node->TrimInputCount(2); |
316 NodeProperties::ChangeOp(node, op); | 348 NodeProperties::ChangeOp(node, op); |
317 return Changed(node); | 349 return Changed(node); |
318 } | 350 } |
319 | 351 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 return jsgraph_->javascript(); | 401 return jsgraph_->javascript(); |
370 } | 402 } |
371 | 403 |
372 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 404 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
373 return jsgraph()->simplified(); | 405 return jsgraph()->simplified(); |
374 } | 406 } |
375 | 407 |
376 } // namespace compiler | 408 } // namespace compiler |
377 } // namespace internal | 409 } // namespace internal |
378 } // namespace v8 | 410 } // namespace v8 |
OLD | NEW |