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 4139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4150 FUNCTION_ADDR(Runtime_TransitionStoreIC_MissFromStubFailure)); | 4150 FUNCTION_ADDR(Runtime_TransitionStoreIC_MissFromStubFailure)); |
4151 } | 4151 } |
4152 | 4152 |
4153 void NumberToStringStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { | 4153 void NumberToStringStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
4154 descriptor->Initialize( | 4154 descriptor->Initialize( |
4155 Runtime::FunctionForId(Runtime::kNumberToString)->entry); | 4155 Runtime::FunctionForId(Runtime::kNumberToString)->entry); |
4156 descriptor->SetMissHandler(Runtime::kNumberToString); | 4156 descriptor->SetMissHandler(Runtime::kNumberToString); |
4157 } | 4157 } |
4158 | 4158 |
4159 | 4159 |
4160 void FastCloneRegExpStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { | |
4161 FastCloneRegExpDescriptor call_descriptor(isolate()); | |
4162 descriptor->Initialize( | |
4163 Runtime::FunctionForId(Runtime::kCreateRegExpLiteral)->entry); | |
4164 descriptor->SetMissHandler(Runtime::kCreateRegExpLiteral); | |
4165 } | |
4166 | |
4167 | |
4168 void FastCloneShallowArrayStub::InitializeDescriptor( | 4160 void FastCloneShallowArrayStub::InitializeDescriptor( |
4169 CodeStubDescriptor* descriptor) { | 4161 CodeStubDescriptor* descriptor) { |
4170 FastCloneShallowArrayDescriptor call_descriptor(isolate()); | 4162 FastCloneShallowArrayDescriptor call_descriptor(isolate()); |
4171 descriptor->Initialize( | 4163 descriptor->Initialize( |
4172 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry); | 4164 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry); |
4173 descriptor->SetMissHandler(Runtime::kCreateArrayLiteralStubBailout); | 4165 descriptor->SetMissHandler(Runtime::kCreateArrayLiteralStubBailout); |
4174 } | 4166 } |
4175 | 4167 |
4176 void RegExpConstructResultStub::InitializeDescriptor( | 4168 void RegExpConstructResultStub::InitializeDescriptor( |
4177 CodeStubDescriptor* descriptor) { | 4169 CodeStubDescriptor* descriptor) { |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4615 Node* next_index = assembler->Int32Add(slot_index, one); | 4607 Node* next_index = assembler->Int32Add(slot_index, one); |
4616 var_slot_index.Bind(next_index); | 4608 var_slot_index.Bind(next_index); |
4617 assembler->Branch(assembler->Int32LessThan(next_index, length), &loop, | 4609 assembler->Branch(assembler->Int32LessThan(next_index, length), &loop, |
4618 &after_loop); | 4610 &after_loop); |
4619 } | 4611 } |
4620 assembler->Bind(&after_loop); | 4612 assembler->Bind(&after_loop); |
4621 | 4613 |
4622 assembler->Return(function_context); | 4614 assembler->Return(function_context); |
4623 } | 4615 } |
4624 | 4616 |
| 4617 void FastCloneRegExpStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
| 4618 typedef CodeStubAssembler::Label Label; |
| 4619 typedef compiler::Node Node; |
| 4620 |
| 4621 Label call_runtime(assembler, Label::kDeferred); |
| 4622 |
| 4623 Node* closure = assembler->Parameter(Descriptor::kClosure); |
| 4624 Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex); |
| 4625 |
| 4626 Node* undefined = assembler->UndefinedConstant(); |
| 4627 Node* literals_array = |
| 4628 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset); |
| 4629 Node* boilerplate = assembler->LoadFixedArrayElement( |
| 4630 literals_array, literal_index, |
| 4631 LiteralsArray::kFirstLiteralIndex * kPointerSize, |
| 4632 CodeStubAssembler::SMI_PARAMETERS); |
| 4633 assembler->GotoIf(assembler->WordEqual(boilerplate, undefined), |
| 4634 &call_runtime); |
| 4635 |
| 4636 { |
| 4637 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; |
| 4638 Node* copy = assembler->Allocate(size); |
| 4639 for (int offset = 0; offset < size; offset += kPointerSize) { |
| 4640 Node* value = assembler->LoadObjectField(boilerplate, offset); |
| 4641 assembler->StoreObjectFieldNoWriteBarrier(copy, offset, value); |
| 4642 } |
| 4643 assembler->Return(copy); |
| 4644 } |
| 4645 |
| 4646 assembler->Bind(&call_runtime); |
| 4647 { |
| 4648 Node* context = assembler->Parameter(Descriptor::kContext); |
| 4649 Node* pattern = assembler->Parameter(Descriptor::kPattern); |
| 4650 Node* flags = assembler->Parameter(Descriptor::kFlags); |
| 4651 assembler->TailCallRuntime(Runtime::kCreateRegExpLiteral, context, closure, |
| 4652 literal_index, pattern, flags); |
| 4653 } |
| 4654 } |
| 4655 |
4625 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { | 4656 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { |
4626 CreateAllocationSiteStub stub(isolate); | 4657 CreateAllocationSiteStub stub(isolate); |
4627 stub.GetCode(); | 4658 stub.GetCode(); |
4628 } | 4659 } |
4629 | 4660 |
4630 | 4661 |
4631 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { | 4662 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { |
4632 CreateWeakCellStub stub(isolate); | 4663 CreateWeakCellStub stub(isolate); |
4633 stub.GetCode(); | 4664 stub.GetCode(); |
4634 } | 4665 } |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4992 if (type->Is(Type::UntaggedPointer())) { | 5023 if (type->Is(Type::UntaggedPointer())) { |
4993 return Representation::External(); | 5024 return Representation::External(); |
4994 } | 5025 } |
4995 | 5026 |
4996 DCHECK(!type->Is(Type::Untagged())); | 5027 DCHECK(!type->Is(Type::Untagged())); |
4997 return Representation::Tagged(); | 5028 return Representation::Tagged(); |
4998 } | 5029 } |
4999 | 5030 |
5000 } // namespace internal | 5031 } // namespace internal |
5001 } // namespace v8 | 5032 } // namespace v8 |
OLD | NEW |