OLD | NEW |
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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); | 1869 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); |
1870 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), object); | 1870 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), object); |
1871 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX), | 1871 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX), |
1872 native_context); | 1872 native_context); |
1873 RelaxControls(node); | 1873 RelaxControls(node); |
1874 a.FinishAndChange(node); | 1874 a.FinishAndChange(node); |
1875 return Changed(node); | 1875 return Changed(node); |
1876 } | 1876 } |
1877 | 1877 |
1878 | 1878 |
| 1879 Reduction JSTypedLowering::ReduceJSCreateCatchContext(Node* node) { |
| 1880 DCHECK_EQ(IrOpcode::kJSCreateCatchContext, node->opcode()); |
| 1881 Handle<String> name = OpParameter<Handle<String>>(node); |
| 1882 Node* exception = NodeProperties::GetValueInput(node, 0); |
| 1883 Node* closure = NodeProperties::GetValueInput(node, 1); |
| 1884 Node* effect = NodeProperties::GetEffectInput(node); |
| 1885 Node* control = NodeProperties::GetControlInput(node); |
| 1886 Node* context = NodeProperties::GetContextInput(node); |
| 1887 Node* native_context = effect = graph()->NewNode( |
| 1888 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), |
| 1889 context, context, effect); |
| 1890 AllocationBuilder a(jsgraph(), effect, control); |
| 1891 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered. |
| 1892 a.AllocateArray(Context::MIN_CONTEXT_SLOTS + 1, |
| 1893 factory()->catch_context_map()); |
| 1894 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); |
| 1895 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); |
| 1896 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), name); |
| 1897 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX), |
| 1898 native_context); |
| 1899 a.Store(AccessBuilder::ForContextSlot(Context::THROWN_OBJECT_INDEX), |
| 1900 exception); |
| 1901 RelaxControls(node); |
| 1902 a.FinishAndChange(node); |
| 1903 return Changed(node); |
| 1904 } |
| 1905 |
| 1906 |
1879 Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) { | 1907 Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) { |
1880 DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode()); | 1908 DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode()); |
1881 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node); | 1909 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node); |
1882 int context_length = scope_info->ContextLength(); | 1910 int context_length = scope_info->ContextLength(); |
1883 Node* const closure = NodeProperties::GetValueInput(node, 0); | 1911 Node* const closure = NodeProperties::GetValueInput(node, 0); |
1884 | 1912 |
1885 // Use inline allocation for block contexts up to a size limit. | 1913 // Use inline allocation for block contexts up to a size limit. |
1886 if (context_length < kBlockContextAllocationLimit) { | 1914 if (context_length < kBlockContextAllocationLimit) { |
1887 // JSCreateBlockContext[scope[length < limit]](fun) | 1915 // JSCreateBlockContext[scope[length < limit]](fun) |
1888 Node* effect = NodeProperties::GetEffectInput(node); | 1916 Node* effect = NodeProperties::GetEffectInput(node); |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 case IrOpcode::kJSCreateClosure: | 2458 case IrOpcode::kJSCreateClosure: |
2431 return ReduceJSCreateClosure(node); | 2459 return ReduceJSCreateClosure(node); |
2432 case IrOpcode::kJSCreateLiteralArray: | 2460 case IrOpcode::kJSCreateLiteralArray: |
2433 return ReduceJSCreateLiteralArray(node); | 2461 return ReduceJSCreateLiteralArray(node); |
2434 case IrOpcode::kJSCreateLiteralObject: | 2462 case IrOpcode::kJSCreateLiteralObject: |
2435 return ReduceJSCreateLiteralObject(node); | 2463 return ReduceJSCreateLiteralObject(node); |
2436 case IrOpcode::kJSCreateFunctionContext: | 2464 case IrOpcode::kJSCreateFunctionContext: |
2437 return ReduceJSCreateFunctionContext(node); | 2465 return ReduceJSCreateFunctionContext(node); |
2438 case IrOpcode::kJSCreateWithContext: | 2466 case IrOpcode::kJSCreateWithContext: |
2439 return ReduceJSCreateWithContext(node); | 2467 return ReduceJSCreateWithContext(node); |
| 2468 case IrOpcode::kJSCreateCatchContext: |
| 2469 return ReduceJSCreateCatchContext(node); |
2440 case IrOpcode::kJSCreateBlockContext: | 2470 case IrOpcode::kJSCreateBlockContext: |
2441 return ReduceJSCreateBlockContext(node); | 2471 return ReduceJSCreateBlockContext(node); |
2442 case IrOpcode::kJSCallFunction: | 2472 case IrOpcode::kJSCallFunction: |
2443 return ReduceJSCallFunction(node); | 2473 return ReduceJSCallFunction(node); |
2444 case IrOpcode::kJSForInDone: | 2474 case IrOpcode::kJSForInDone: |
2445 return ReduceJSForInDone(node); | 2475 return ReduceJSForInDone(node); |
2446 case IrOpcode::kJSForInNext: | 2476 case IrOpcode::kJSForInNext: |
2447 return ReduceJSForInNext(node); | 2477 return ReduceJSForInNext(node); |
2448 case IrOpcode::kJSForInPrepare: | 2478 case IrOpcode::kJSForInPrepare: |
2449 return ReduceJSForInPrepare(node); | 2479 return ReduceJSForInPrepare(node); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2597 } | 2627 } |
2598 | 2628 |
2599 | 2629 |
2600 CompilationDependencies* JSTypedLowering::dependencies() const { | 2630 CompilationDependencies* JSTypedLowering::dependencies() const { |
2601 return dependencies_; | 2631 return dependencies_; |
2602 } | 2632 } |
2603 | 2633 |
2604 } // namespace compiler | 2634 } // namespace compiler |
2605 } // namespace internal | 2635 } // namespace internal |
2606 } // namespace v8 | 2636 } // namespace v8 |
OLD | NEW |