| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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-stubs.h" | 5 #include "src/code-stubs.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 4597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4608 void FastNewFunctionContextStub::GenerateAssembly( | 4608 void FastNewFunctionContextStub::GenerateAssembly( |
| 4609 CodeStubAssembler* assembler) const { | 4609 CodeStubAssembler* assembler) const { |
| 4610 typedef compiler::Node Node; | 4610 typedef compiler::Node Node; |
| 4611 Node* function = assembler->Parameter(Descriptor::kFunction); | 4611 Node* function = assembler->Parameter(Descriptor::kFunction); |
| 4612 Node* slots = assembler->Parameter(FastNewFunctionContextDescriptor::kSlots); | 4612 Node* slots = assembler->Parameter(FastNewFunctionContextDescriptor::kSlots); |
| 4613 Node* context = assembler->Parameter(Descriptor::kContext); | 4613 Node* context = assembler->Parameter(Descriptor::kContext); |
| 4614 | 4614 |
| 4615 assembler->Return(Generate(assembler, function, slots, context)); | 4615 assembler->Return(Generate(assembler, function, slots, context)); |
| 4616 } | 4616 } |
| 4617 | 4617 |
| 4618 void FastCloneRegExpStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 4618 // static |
| 4619 compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler, |
| 4620 compiler::Node* closure, |
| 4621 compiler::Node* literal_index, |
| 4622 compiler::Node* pattern, |
| 4623 compiler::Node* flags, |
| 4624 compiler::Node* context) { |
| 4619 typedef CodeStubAssembler::Label Label; | 4625 typedef CodeStubAssembler::Label Label; |
| 4626 typedef CodeStubAssembler::Variable Variable; |
| 4620 typedef compiler::Node Node; | 4627 typedef compiler::Node Node; |
| 4621 | 4628 |
| 4622 Label call_runtime(assembler, Label::kDeferred); | 4629 Label call_runtime(assembler, Label::kDeferred), end(assembler); |
| 4623 | 4630 |
| 4624 Node* closure = assembler->Parameter(Descriptor::kClosure); | 4631 Variable result(assembler, MachineRepresentation::kTagged); |
| 4625 Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex); | |
| 4626 | 4632 |
| 4627 Node* undefined = assembler->UndefinedConstant(); | 4633 Node* undefined = assembler->UndefinedConstant(); |
| 4628 Node* literals_array = | 4634 Node* literals_array = |
| 4629 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset); | 4635 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset); |
| 4630 Node* boilerplate = assembler->LoadFixedArrayElement( | 4636 Node* boilerplate = assembler->LoadFixedArrayElement( |
| 4631 literals_array, literal_index, | 4637 literals_array, literal_index, |
| 4632 LiteralsArray::kFirstLiteralIndex * kPointerSize, | 4638 LiteralsArray::kFirstLiteralIndex * kPointerSize, |
| 4633 CodeStubAssembler::SMI_PARAMETERS); | 4639 CodeStubAssembler::SMI_PARAMETERS); |
| 4634 assembler->GotoIf(assembler->WordEqual(boilerplate, undefined), | 4640 assembler->GotoIf(assembler->WordEqual(boilerplate, undefined), |
| 4635 &call_runtime); | 4641 &call_runtime); |
| 4636 | 4642 |
| 4637 { | 4643 { |
| 4638 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; | 4644 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; |
| 4639 Node* copy = assembler->Allocate(size); | 4645 Node* copy = assembler->Allocate(size); |
| 4640 for (int offset = 0; offset < size; offset += kPointerSize) { | 4646 for (int offset = 0; offset < size; offset += kPointerSize) { |
| 4641 Node* value = assembler->LoadObjectField(boilerplate, offset); | 4647 Node* value = assembler->LoadObjectField(boilerplate, offset); |
| 4642 assembler->StoreObjectFieldNoWriteBarrier(copy, offset, value); | 4648 assembler->StoreObjectFieldNoWriteBarrier(copy, offset, value); |
| 4643 } | 4649 } |
| 4644 assembler->Return(copy); | 4650 result.Bind(copy); |
| 4651 assembler->Goto(&end); |
| 4645 } | 4652 } |
| 4646 | 4653 |
| 4647 assembler->Bind(&call_runtime); | 4654 assembler->Bind(&call_runtime); |
| 4648 { | 4655 { |
| 4649 Node* context = assembler->Parameter(Descriptor::kContext); | 4656 result.Bind(assembler->CallRuntime(Runtime::kCreateRegExpLiteral, context, |
| 4650 Node* pattern = assembler->Parameter(Descriptor::kPattern); | 4657 closure, literal_index, pattern, flags)); |
| 4651 Node* flags = assembler->Parameter(Descriptor::kFlags); | 4658 assembler->Goto(&end); |
| 4652 assembler->TailCallRuntime(Runtime::kCreateRegExpLiteral, context, closure, | |
| 4653 literal_index, pattern, flags); | |
| 4654 } | 4659 } |
| 4660 |
| 4661 assembler->Bind(&end); |
| 4662 return result.value(); |
| 4663 } |
| 4664 |
| 4665 void FastCloneRegExpStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
| 4666 typedef compiler::Node Node; |
| 4667 Node* closure = assembler->Parameter(Descriptor::kClosure); |
| 4668 Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex); |
| 4669 Node* pattern = assembler->Parameter(Descriptor::kPattern); |
| 4670 Node* flags = assembler->Parameter(Descriptor::kFlags); |
| 4671 Node* context = assembler->Parameter(Descriptor::kContext); |
| 4672 |
| 4673 assembler->Return( |
| 4674 Generate(assembler, closure, literal_index, pattern, flags, context)); |
| 4655 } | 4675 } |
| 4656 | 4676 |
| 4657 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { | 4677 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { |
| 4658 CreateAllocationSiteStub stub(isolate); | 4678 CreateAllocationSiteStub stub(isolate); |
| 4659 stub.GetCode(); | 4679 stub.GetCode(); |
| 4660 } | 4680 } |
| 4661 | 4681 |
| 4662 | 4682 |
| 4663 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { | 4683 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { |
| 4664 CreateWeakCellStub stub(isolate); | 4684 CreateWeakCellStub stub(isolate); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5054 if (type->Is(Type::UntaggedPointer())) { | 5074 if (type->Is(Type::UntaggedPointer())) { |
| 5055 return Representation::External(); | 5075 return Representation::External(); |
| 5056 } | 5076 } |
| 5057 | 5077 |
| 5058 DCHECK(!type->Is(Type::Untagged())); | 5078 DCHECK(!type->Is(Type::Untagged())); |
| 5059 return Representation::Tagged(); | 5079 return Representation::Tagged(); |
| 5060 } | 5080 } |
| 5061 | 5081 |
| 5062 } // namespace internal | 5082 } // namespace internal |
| 5063 } // namespace v8 | 5083 } // namespace v8 |
| OLD | NEW |