| 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-native-context-specialization.h" | 5 #include "src/compiler/js-native-context-specialization.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
| 10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 control_count + 1, &values.front()); | 312 control_count + 1, &values.front()); |
| 313 effects.push_back(control); | 313 effects.push_back(control); |
| 314 effect = graph()->NewNode(common()->EffectPhi(control_count), | 314 effect = graph()->NewNode(common()->EffectPhi(control_count), |
| 315 control_count + 1, &effects.front()); | 315 control_count + 1, &effects.front()); |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 ReplaceWithValue(node, value, effect, control); | 318 ReplaceWithValue(node, value, effect, control); |
| 319 return Replace(value); | 319 return Replace(value); |
| 320 } | 320 } |
| 321 | 321 |
| 322 Reduction JSNativeContextSpecialization::ReduceNamedAccess( | 322 Reduction JSNativeContextSpecialization::ReduceNamedAccessFromNexus( |
| 323 Node* node, Node* value, FeedbackNexus const& nexus, Handle<Name> name, | 323 Node* node, Node* value, FeedbackNexus const& nexus, Handle<Name> name, |
| 324 AccessMode access_mode, LanguageMode language_mode) { | 324 AccessMode access_mode, LanguageMode language_mode) { |
| 325 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed || | 325 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed || |
| 326 node->opcode() == IrOpcode::kJSStoreNamed); | 326 node->opcode() == IrOpcode::kJSStoreNamed); |
| 327 Node* const receiver = NodeProperties::GetValueInput(node, 0); | 327 Node* const receiver = NodeProperties::GetValueInput(node, 0); |
| 328 Node* const effect = NodeProperties::GetEffectInput(node); | 328 Node* const effect = NodeProperties::GetEffectInput(node); |
| 329 | 329 |
| 330 // Check if the {nexus} reports type feedback for the IC. | 330 // Check if the {nexus} reports type feedback for the IC. |
| 331 if (nexus.IsUninitialized()) { | 331 if (nexus.IsUninitialized()) { |
| 332 if ((flags() & kDeoptimizationEnabled) && | 332 if ((flags() & kDeoptimizationEnabled) && |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 | 390 |
| 391 // Extract receiver maps from the LOAD_IC using the LoadICNexus. | 391 // Extract receiver maps from the LOAD_IC using the LoadICNexus. |
| 392 if (!p.feedback().IsValid()) return NoChange(); | 392 if (!p.feedback().IsValid()) return NoChange(); |
| 393 LoadICNexus nexus(p.feedback().vector(), p.feedback().slot()); | 393 LoadICNexus nexus(p.feedback().vector(), p.feedback().slot()); |
| 394 | 394 |
| 395 // Try to lower the named access based on the {receiver_maps}. | 395 // Try to lower the named access based on the {receiver_maps}. |
| 396 return ReduceNamedAccess(node, value, nexus, p.name(), AccessMode::kLoad, | 396 return ReduceNamedAccessFromNexus(node, value, nexus, p.name(), |
| 397 p.language_mode()); | 397 AccessMode::kLoad, p.language_mode()); |
| 398 } | 398 } |
| 399 | 399 |
| 400 | 400 |
| 401 Reduction JSNativeContextSpecialization::ReduceJSStoreNamed(Node* node) { | 401 Reduction JSNativeContextSpecialization::ReduceJSStoreNamed(Node* node) { |
| 402 DCHECK_EQ(IrOpcode::kJSStoreNamed, node->opcode()); | 402 DCHECK_EQ(IrOpcode::kJSStoreNamed, node->opcode()); |
| 403 NamedAccess const& p = NamedAccessOf(node->op()); | 403 NamedAccess const& p = NamedAccessOf(node->op()); |
| 404 Node* const value = NodeProperties::GetValueInput(node, 1); | 404 Node* const value = NodeProperties::GetValueInput(node, 1); |
| 405 | 405 |
| 406 // Extract receiver maps from the STORE_IC using the StoreICNexus. | 406 // Extract receiver maps from the STORE_IC using the StoreICNexus. |
| 407 if (!p.feedback().IsValid()) return NoChange(); | 407 if (!p.feedback().IsValid()) return NoChange(); |
| 408 StoreICNexus nexus(p.feedback().vector(), p.feedback().slot()); | 408 StoreICNexus nexus(p.feedback().vector(), p.feedback().slot()); |
| 409 | 409 |
| 410 // Try to lower the named access based on the {receiver_maps}. | 410 // Try to lower the named access based on the {receiver_maps}. |
| 411 return ReduceNamedAccess(node, value, nexus, p.name(), AccessMode::kStore, | 411 return ReduceNamedAccessFromNexus(node, value, nexus, p.name(), |
| 412 p.language_mode()); | 412 AccessMode::kStore, p.language_mode()); |
| 413 } | 413 } |
| 414 | 414 |
| 415 | 415 |
| 416 Reduction JSNativeContextSpecialization::ReduceElementAccess( | 416 Reduction JSNativeContextSpecialization::ReduceElementAccess( |
| 417 Node* node, Node* index, Node* value, MapHandleList const& receiver_maps, | 417 Node* node, Node* index, Node* value, MapHandleList const& receiver_maps, |
| 418 AccessMode access_mode, LanguageMode language_mode, | 418 AccessMode access_mode, LanguageMode language_mode, |
| 419 KeyedAccessStoreMode store_mode) { | 419 KeyedAccessStoreMode store_mode) { |
| 420 DCHECK(node->opcode() == IrOpcode::kJSLoadProperty || | 420 DCHECK(node->opcode() == IrOpcode::kJSLoadProperty || |
| 421 node->opcode() == IrOpcode::kJSStoreProperty); | 421 node->opcode() == IrOpcode::kJSStoreProperty); |
| 422 Node* receiver = NodeProperties::GetValueInput(node, 0); | 422 Node* receiver = NodeProperties::GetValueInput(node, 0); |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 | 1495 |
| 1496 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1496 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
| 1497 return jsgraph()->simplified(); | 1497 return jsgraph()->simplified(); |
| 1498 } | 1498 } |
| 1499 | 1499 |
| 1500 } // namespace compiler | 1500 } // namespace compiler |
| 1501 } // namespace internal | 1501 } // namespace internal |
| 1502 } // namespace v8 | 1502 } // namespace v8 |
| OLD | NEW |