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/code-stubs.h" | 6 #include "src/code-stubs.h" |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 #include "src/compiler/node-aux-data-inl.h" | 10 #include "src/compiler/node-aux-data-inl.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 #undef REPLACE_COMPARE_IC_CALL | 97 #undef REPLACE_COMPARE_IC_CALL |
98 | 98 |
99 | 99 |
100 #define REPLACE_RUNTIME_CALL(op, fun) \ | 100 #define REPLACE_RUNTIME_CALL(op, fun) \ |
101 void JSGenericLowering::Lower##op(Node* node) { \ | 101 void JSGenericLowering::Lower##op(Node* node) { \ |
102 ReplaceWithRuntimeCall(node, fun); \ | 102 ReplaceWithRuntimeCall(node, fun); \ |
103 } | 103 } |
104 REPLACE_RUNTIME_CALL(JSTypeOf, Runtime::kTypeof) | 104 REPLACE_RUNTIME_CALL(JSTypeOf, Runtime::kTypeof) |
105 REPLACE_RUNTIME_CALL(JSCreate, Runtime::kAbort) | 105 REPLACE_RUNTIME_CALL(JSCreate, Runtime::kAbort) |
106 REPLACE_RUNTIME_CALL(JSCreateFunctionContext, Runtime::kNewFunctionContext) | 106 REPLACE_RUNTIME_CALL(JSCreateFunctionContext, Runtime::kNewFunctionContext) |
107 REPLACE_RUNTIME_CALL(JSCreateCatchContext, Runtime::kPushCatchContext) | |
108 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) | 107 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) |
109 REPLACE_RUNTIME_CALL(JSCreateBlockContext, Runtime::kPushBlockContext) | 108 REPLACE_RUNTIME_CALL(JSCreateBlockContext, Runtime::kPushBlockContext) |
110 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) | 109 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) |
111 REPLACE_RUNTIME_CALL(JSCreateScriptContext, Runtime::kAbort) | 110 REPLACE_RUNTIME_CALL(JSCreateScriptContext, Runtime::kAbort) |
112 #undef REPLACE_RUNTIME | 111 #undef REPLACE_RUNTIME |
113 | 112 |
114 | 113 |
115 #define REPLACE_UNIMPLEMENTED(op) \ | 114 #define REPLACE_UNIMPLEMENTED(op) \ |
116 void JSGenericLowering::Lower##op(Node* node) { UNIMPLEMENTED(); } | 115 void JSGenericLowering::Lower##op(Node* node) { UNIMPLEMENTED(); } |
117 REPLACE_UNIMPLEMENTED(JSYield) | 116 REPLACE_UNIMPLEMENTED(JSYield) |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 graph()->start())); | 356 graph()->start())); |
358 } | 357 } |
359 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); | 358 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); |
360 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( | 359 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( |
361 static_cast<int>(access.index())))); | 360 static_cast<int>(access.index())))); |
362 PatchOperator(node, machine()->Store(StoreRepresentation(kMachAnyTagged, | 361 PatchOperator(node, machine()->Store(StoreRepresentation(kMachAnyTagged, |
363 kFullWriteBarrier))); | 362 kFullWriteBarrier))); |
364 } | 363 } |
365 | 364 |
366 | 365 |
| 366 void JSGenericLowering::LowerJSCreateCatchContext(Node* node) { |
| 367 Unique<String> name = OpParameter<Unique<String>>(node); |
| 368 PatchInsertInput(node, 0, jsgraph()->HeapConstant(name)); |
| 369 ReplaceWithRuntimeCall(node, Runtime::kPushCatchContext); |
| 370 } |
| 371 |
| 372 |
367 void JSGenericLowering::LowerJSCallConstruct(Node* node) { | 373 void JSGenericLowering::LowerJSCallConstruct(Node* node) { |
368 int arity = OpParameter<int>(node); | 374 int arity = OpParameter<int>(node); |
369 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); | 375 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); |
370 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); | 376 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); |
371 CallDescriptor* desc = | 377 CallDescriptor* desc = |
372 linkage()->GetStubCallDescriptor(d, arity, FlagsForNode(node)); | 378 linkage()->GetStubCallDescriptor(d, arity, FlagsForNode(node)); |
373 Node* stub_code = jsgraph()->HeapConstant(stub.GetCode()); | 379 Node* stub_code = jsgraph()->HeapConstant(stub.GetCode()); |
374 Node* construct = NodeProperties::GetValueInput(node, 0); | 380 Node* construct = NodeProperties::GetValueInput(node, 0); |
375 PatchInsertInput(node, 0, stub_code); | 381 PatchInsertInput(node, 0, stub_code); |
376 PatchInsertInput(node, 1, jsgraph()->Int32Constant(arity - 1)); | 382 PatchInsertInput(node, 1, jsgraph()->Int32Constant(arity - 1)); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 441 |
436 | 442 |
437 void JSGenericLowering::LowerJSCallRuntime(Node* node) { | 443 void JSGenericLowering::LowerJSCallRuntime(Node* node) { |
438 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); | 444 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); |
439 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); | 445 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); |
440 } | 446 } |
441 | 447 |
442 } // namespace compiler | 448 } // namespace compiler |
443 } // namespace internal | 449 } // namespace internal |
444 } // namespace v8 | 450 } // namespace v8 |
OLD | NEW |