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/builtins/builtins-constructor.h" | 8 #include "src/builtins/builtins-constructor.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 void JSGenericLowering::LowerJSCreateKeyValueArray(Node* node) { | 385 void JSGenericLowering::LowerJSCreateKeyValueArray(Node* node) { |
386 ReplaceWithRuntimeCall(node, Runtime::kCreateKeyValueArray); | 386 ReplaceWithRuntimeCall(node, Runtime::kCreateKeyValueArray); |
387 } | 387 } |
388 | 388 |
389 void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) { | 389 void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) { |
390 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); | 390 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); |
391 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 391 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
392 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index())); | 392 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index())); |
393 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant())); | 393 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant())); |
394 | 394 |
395 // Use the FastCloneShallowArrayStub only for shallow boilerplates without | 395 // Use the FastCloneShallowArray builtin only for shallow boilerplates without |
396 // properties up to the number of elements that the stubs can handle. | 396 // properties up to the number of elements that the stubs can handle. |
397 if ((p.flags() & ArrayLiteral::kShallowElements) != 0 && | 397 if ((p.flags() & ArrayLiteral::kShallowElements) != 0 && |
398 p.length() < FastCloneShallowArrayStub::kMaximumClonedElements) { | 398 p.length() < |
399 Callable callable = CodeFactory::FastCloneShallowArray(isolate()); | 399 ConstructorBuiltinsAssembler::kMaximumClonedShallowArrayElements) { |
| 400 Callable callable = CodeFactory::FastCloneShallowArray( |
| 401 isolate(), DONT_TRACK_ALLOCATION_SITE); |
400 ReplaceWithStubCall(node, callable, flags); | 402 ReplaceWithStubCall(node, callable, flags); |
401 } else { | 403 } else { |
402 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); | 404 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); |
403 ReplaceWithRuntimeCall(node, Runtime::kCreateArrayLiteral); | 405 ReplaceWithRuntimeCall(node, Runtime::kCreateArrayLiteral); |
404 } | 406 } |
405 } | 407 } |
406 | 408 |
407 | 409 |
408 void JSGenericLowering::LowerJSCreateLiteralObject(Node* node) { | 410 void JSGenericLowering::LowerJSCreateLiteralObject(Node* node) { |
409 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); | 411 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); |
410 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 412 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
411 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index())); | 413 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index())); |
412 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant())); | 414 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant())); |
413 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); | 415 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); |
414 | 416 |
415 // Use the FastCloneShallowObjectStub only for shallow boilerplates without | 417 // Use the FastCloneShallowObject builtin only for shallow boilerplates |
416 // elements up to the number of properties that the stubs can handle. | 418 // without elements up to the number of properties that the stubs can handle. |
417 if ((p.flags() & ObjectLiteral::kShallowProperties) != 0 && | 419 if ((p.flags() & ObjectLiteral::kShallowProperties) != 0 && |
418 p.length() <= FastCloneShallowObjectStub::kMaximumClonedProperties) { | 420 p.length() <= |
| 421 ConstructorBuiltinsAssembler::kMaximumClonedShallowObjectProperties) { |
419 Callable callable = | 422 Callable callable = |
420 CodeFactory::FastCloneShallowObject(isolate(), p.length()); | 423 CodeFactory::FastCloneShallowObject(isolate(), p.length()); |
421 ReplaceWithStubCall(node, callable, flags); | 424 ReplaceWithStubCall(node, callable, flags); |
422 } else { | 425 } else { |
423 ReplaceWithRuntimeCall(node, Runtime::kCreateObjectLiteral); | 426 ReplaceWithRuntimeCall(node, Runtime::kCreateObjectLiteral); |
424 } | 427 } |
425 } | 428 } |
426 | 429 |
427 | 430 |
428 void JSGenericLowering::LowerJSCreateLiteralRegExp(Node* node) { | 431 void JSGenericLowering::LowerJSCreateLiteralRegExp(Node* node) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 } | 633 } |
631 | 634 |
632 | 635 |
633 MachineOperatorBuilder* JSGenericLowering::machine() const { | 636 MachineOperatorBuilder* JSGenericLowering::machine() const { |
634 return jsgraph()->machine(); | 637 return jsgraph()->machine(); |
635 } | 638 } |
636 | 639 |
637 } // namespace compiler | 640 } // namespace compiler |
638 } // namespace internal | 641 } // namespace internal |
639 } // namespace v8 | 642 } // namespace v8 |
OLD | NEW |