| 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 4171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4182 const { | 4182 const { |
| 4183 return VectorStoreTransitionDescriptor(isolate()); | 4183 return VectorStoreTransitionDescriptor(isolate()); |
| 4184 } | 4184 } |
| 4185 | 4185 |
| 4186 | 4186 |
| 4187 CallInterfaceDescriptor | 4187 CallInterfaceDescriptor |
| 4188 ElementsTransitionAndStoreStub::GetCallInterfaceDescriptor() const { | 4188 ElementsTransitionAndStoreStub::GetCallInterfaceDescriptor() const { |
| 4189 return VectorStoreTransitionDescriptor(isolate()); | 4189 return VectorStoreTransitionDescriptor(isolate()); |
| 4190 } | 4190 } |
| 4191 | 4191 |
| 4192 void FastNewContextStub::InitializeDescriptor(CodeStubDescriptor* d) {} | |
| 4193 | |
| 4194 void TypeofStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {} | 4192 void TypeofStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {} |
| 4195 | 4193 |
| 4196 void NumberToStringStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { | 4194 void NumberToStringStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
| 4197 descriptor->Initialize( | 4195 descriptor->Initialize( |
| 4198 Runtime::FunctionForId(Runtime::kNumberToString)->entry); | 4196 Runtime::FunctionForId(Runtime::kNumberToString)->entry); |
| 4199 } | 4197 } |
| 4200 | 4198 |
| 4201 | 4199 |
| 4202 void FastCloneRegExpStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { | 4200 void FastCloneRegExpStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
| 4203 FastCloneRegExpDescriptor call_descriptor(isolate()); | 4201 FastCloneRegExpDescriptor call_descriptor(isolate()); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4548 assembler->UndefinedConstant()); | 4546 assembler->UndefinedConstant()); |
| 4549 | 4547 |
| 4550 return result; | 4548 return result; |
| 4551 } | 4549 } |
| 4552 | 4550 |
| 4553 void FastNewClosureStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 4551 void FastNewClosureStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
| 4554 assembler->Return( | 4552 assembler->Return( |
| 4555 Generate(assembler, assembler->Parameter(0), assembler->Parameter(1))); | 4553 Generate(assembler, assembler->Parameter(0), assembler->Parameter(1))); |
| 4556 } | 4554 } |
| 4557 | 4555 |
| 4556 void FastNewFunctionContextStub::GenerateAssembly( |
| 4557 CodeStubAssembler* assembler) const { |
| 4558 typedef compiler::Node Node; |
| 4559 |
| 4560 int length = slots() + Context::MIN_CONTEXT_SLOTS; |
| 4561 int size = length * kPointerSize + FixedArray::kHeaderSize; |
| 4562 |
| 4563 // Get the function |
| 4564 Node* function = |
| 4565 assembler->Parameter(FastNewFunctionContextDescriptor::kFunctionIndex); |
| 4566 Node* context = |
| 4567 assembler->Parameter(FastNewFunctionContextDescriptor::kContextIndex); |
| 4568 |
| 4569 // Create a new closure from the given function info in new space |
| 4570 Node* function_context = assembler->Allocate(size); |
| 4571 |
| 4572 assembler->StoreMapNoWriteBarrier( |
| 4573 function_context, |
| 4574 assembler->HeapConstant(isolate()->factory()->function_context_map())); |
| 4575 assembler->StoreObjectFieldNoWriteBarrier( |
| 4576 function_context, Context::kLengthOffset, |
| 4577 assembler->SmiConstant(Smi::FromInt(length))); |
| 4578 |
| 4579 // Set up the fixed slots. |
| 4580 assembler->StoreFixedArrayElement( |
| 4581 function_context, assembler->Int32Constant(Context::CLOSURE_INDEX), |
| 4582 function, SKIP_WRITE_BARRIER); |
| 4583 assembler->StoreFixedArrayElement( |
| 4584 function_context, assembler->Int32Constant(Context::PREVIOUS_INDEX), |
| 4585 context, SKIP_WRITE_BARRIER); |
| 4586 assembler->StoreFixedArrayElement( |
| 4587 function_context, assembler->Int32Constant(Context::EXTENSION_INDEX), |
| 4588 assembler->TheHoleConstant(), SKIP_WRITE_BARRIER); |
| 4589 |
| 4590 // Copy the native context from the previous context. |
| 4591 Node* native_context = assembler->LoadFixedArrayElement( |
| 4592 context, assembler->Int32Constant(Context::NATIVE_CONTEXT_INDEX)); |
| 4593 assembler->StoreFixedArrayElement( |
| 4594 function_context, assembler->Int32Constant(Context::NATIVE_CONTEXT_INDEX), |
| 4595 native_context, SKIP_WRITE_BARRIER); |
| 4596 |
| 4597 // Initialize the rest of the slots to undefined. |
| 4598 Node* undefined = assembler->UndefinedConstant(); |
| 4599 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; ++i) { |
| 4600 assembler->StoreFixedArrayElement(function_context, |
| 4601 assembler->Int32Constant(i), undefined, |
| 4602 SKIP_WRITE_BARRIER); |
| 4603 } |
| 4604 |
| 4605 assembler->Return(function_context); |
| 4606 } |
| 4607 |
| 4558 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { | 4608 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { |
| 4559 CreateAllocationSiteStub stub(isolate); | 4609 CreateAllocationSiteStub stub(isolate); |
| 4560 stub.GetCode(); | 4610 stub.GetCode(); |
| 4561 } | 4611 } |
| 4562 | 4612 |
| 4563 | 4613 |
| 4564 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { | 4614 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { |
| 4565 CreateWeakCellStub stub(isolate); | 4615 CreateWeakCellStub stub(isolate); |
| 4566 stub.GetCode(); | 4616 stub.GetCode(); |
| 4567 } | 4617 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4580 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, | 4630 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, |
| 4581 STORE_AND_GROW_NO_TRANSITION).GetCode(); | 4631 STORE_AND_GROW_NO_TRANSITION).GetCode(); |
| 4582 for (int i = FIRST_FAST_ELEMENTS_KIND; i <= LAST_FAST_ELEMENTS_KIND; i++) { | 4632 for (int i = FIRST_FAST_ELEMENTS_KIND; i <= LAST_FAST_ELEMENTS_KIND; i++) { |
| 4583 ElementsKind kind = static_cast<ElementsKind>(i); | 4633 ElementsKind kind = static_cast<ElementsKind>(i); |
| 4584 StoreFastElementStub(isolate, true, kind, STANDARD_STORE).GetCode(); | 4634 StoreFastElementStub(isolate, true, kind, STANDARD_STORE).GetCode(); |
| 4585 StoreFastElementStub(isolate, true, kind, STORE_AND_GROW_NO_TRANSITION) | 4635 StoreFastElementStub(isolate, true, kind, STORE_AND_GROW_NO_TRANSITION) |
| 4586 .GetCode(); | 4636 .GetCode(); |
| 4587 } | 4637 } |
| 4588 } | 4638 } |
| 4589 | 4639 |
| 4590 | |
| 4591 void ArrayConstructorStub::PrintName(std::ostream& os) const { // NOLINT | 4640 void ArrayConstructorStub::PrintName(std::ostream& os) const { // NOLINT |
| 4592 os << "ArrayConstructorStub"; | 4641 os << "ArrayConstructorStub"; |
| 4593 switch (argument_count()) { | 4642 switch (argument_count()) { |
| 4594 case ANY: | 4643 case ANY: |
| 4595 os << "_Any"; | 4644 os << "_Any"; |
| 4596 break; | 4645 break; |
| 4597 case NONE: | 4646 case NONE: |
| 4598 os << "_None"; | 4647 os << "_None"; |
| 4599 break; | 4648 break; |
| 4600 case ONE: | 4649 case ONE: |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4875 if (type->Is(Type::UntaggedPointer())) { | 4924 if (type->Is(Type::UntaggedPointer())) { |
| 4876 return Representation::External(); | 4925 return Representation::External(); |
| 4877 } | 4926 } |
| 4878 | 4927 |
| 4879 DCHECK(!type->Is(Type::Untagged())); | 4928 DCHECK(!type->Is(Type::Untagged())); |
| 4880 return Representation::Tagged(); | 4929 return Representation::Tagged(); |
| 4881 } | 4930 } |
| 4882 | 4931 |
| 4883 } // namespace internal | 4932 } // namespace internal |
| 4884 } // namespace v8 | 4933 } // namespace v8 |
| OLD | NEW |