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/compiler/js-generic-lowering.h" | 5 #include "src/compiler/js-generic-lowering.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 ReplaceWithStubCall(node, callable, flags); | 344 ReplaceWithStubCall(node, callable, flags); |
345 } else { | 345 } else { |
346 ReplaceWithRuntimeCall(node, (p.pretenure() == TENURED) | 346 ReplaceWithRuntimeCall(node, (p.pretenure() == TENURED) |
347 ? Runtime::kNewClosure_Tenured | 347 ? Runtime::kNewClosure_Tenured |
348 : Runtime::kNewClosure); | 348 : Runtime::kNewClosure); |
349 } | 349 } |
350 } | 350 } |
351 | 351 |
352 | 352 |
353 void JSGenericLowering::LowerJSCreateFunctionContext(Node* node) { | 353 void JSGenericLowering::LowerJSCreateFunctionContext(Node* node) { |
354 int const slot_count = OpParameter<int>(node->op()); | 354 const CreateFunctionContextParameters& parameters = |
| 355 CreateFunctionContextParametersOf(node->op()); |
| 356 int slot_count = parameters.slot_count(); |
| 357 ScopeType scope_type = parameters.scope_type(); |
355 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 358 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
356 | 359 |
357 if (slot_count <= FastNewFunctionContextStub::kMaximumSlots) { | 360 if (slot_count <= FastNewFunctionContextStub::MaximumSlots()) { |
358 Callable callable = CodeFactory::FastNewFunctionContext(isolate()); | 361 Callable callable = |
| 362 CodeFactory::FastNewFunctionContext(isolate(), scope_type); |
359 node->InsertInput(zone(), 1, jsgraph()->Int32Constant(slot_count)); | 363 node->InsertInput(zone(), 1, jsgraph()->Int32Constant(slot_count)); |
360 ReplaceWithStubCall(node, callable, flags); | 364 ReplaceWithStubCall(node, callable, flags); |
361 } else { | 365 } else { |
| 366 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(scope_type)); |
362 ReplaceWithRuntimeCall(node, Runtime::kNewFunctionContext); | 367 ReplaceWithRuntimeCall(node, Runtime::kNewFunctionContext); |
363 } | 368 } |
364 } | 369 } |
365 | 370 |
366 | 371 |
367 void JSGenericLowering::LowerJSCreateIterResultObject(Node* node) { | 372 void JSGenericLowering::LowerJSCreateIterResultObject(Node* node) { |
368 ReplaceWithRuntimeCall(node, Runtime::kCreateIterResultObject); | 373 ReplaceWithRuntimeCall(node, Runtime::kCreateIterResultObject); |
369 } | 374 } |
370 | 375 |
371 void JSGenericLowering::LowerJSCreateKeyValueArray(Node* node) { | 376 void JSGenericLowering::LowerJSCreateKeyValueArray(Node* node) { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 } | 621 } |
617 | 622 |
618 | 623 |
619 MachineOperatorBuilder* JSGenericLowering::machine() const { | 624 MachineOperatorBuilder* JSGenericLowering::machine() const { |
620 return jsgraph()->machine(); | 625 return jsgraph()->machine(); |
621 } | 626 } |
622 | 627 |
623 } // namespace compiler | 628 } // namespace compiler |
624 } // namespace internal | 629 } // namespace internal |
625 } // namespace v8 | 630 } // namespace v8 |
OLD | NEW |