Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: src/code-stubs.cc

Issue 2187523002: [interpreter] Add CreateFunctionContext bytecode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@fncontextstubslotparam
Patch Set: fix bytecode graph builder Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4605 matching lines...) Expand 10 before | Expand all | Expand 10 after
4616 assembler->UndefinedConstant()); 4616 assembler->UndefinedConstant());
4617 4617
4618 return result; 4618 return result;
4619 } 4619 }
4620 4620
4621 void FastNewClosureStub::GenerateAssembly(CodeStubAssembler* assembler) const { 4621 void FastNewClosureStub::GenerateAssembly(CodeStubAssembler* assembler) const {
4622 assembler->Return( 4622 assembler->Return(
4623 Generate(assembler, assembler->Parameter(0), assembler->Parameter(1))); 4623 Generate(assembler, assembler->Parameter(0), assembler->Parameter(1)));
4624 } 4624 }
4625 4625
4626 void FastNewFunctionContextStub::GenerateAssembly( 4626 // static
4627 CodeStubAssembler* assembler) const { 4627 compiler::Node* FastNewFunctionContextStub::Generate(
4628 CodeStubAssembler* assembler, compiler::Node* function,
4629 compiler::Node* slots, compiler::Node* context) {
4628 typedef CodeStubAssembler::Label Label; 4630 typedef CodeStubAssembler::Label Label;
4629 typedef compiler::Node Node; 4631 typedef compiler::Node Node;
4630 typedef CodeStubAssembler::Variable Variable; 4632 typedef CodeStubAssembler::Variable Variable;
4631 4633
4632 Node* function = assembler->Parameter(Descriptor::kFunction);
4633 Node* slots = assembler->Parameter(FastNewFunctionContextDescriptor::kSlots);
4634 Node* context = assembler->Parameter(Descriptor::kContext);
4635
4636 Node* min_context_slots = 4634 Node* min_context_slots =
4637 assembler->Int32Constant(Context::MIN_CONTEXT_SLOTS); 4635 assembler->Int32Constant(Context::MIN_CONTEXT_SLOTS);
4638 Node* length = assembler->Int32Add(slots, min_context_slots); 4636 Node* length = assembler->Int32Add(slots, min_context_slots);
4639 Node* size = assembler->Int32Add( 4637 Node* size = assembler->Int32Add(
4640 assembler->Word32Shl(length, assembler->Int32Constant(kPointerSizeLog2)), 4638 assembler->Word32Shl(length, assembler->Int32Constant(kPointerSizeLog2)),
4641 assembler->Int32Constant(FixedArray::kHeaderSize)); 4639 assembler->Int32Constant(FixedArray::kHeaderSize));
4642 4640
4643 // Create a new closure from the given function info in new space 4641 // Create a new closure from the given function info in new space
4644 Node* function_context = assembler->Allocate(size); 4642 Node* function_context = assembler->Allocate(size);
4645 4643
4644 Isolate* isolate = assembler->isolate();
4646 assembler->StoreMapNoWriteBarrier( 4645 assembler->StoreMapNoWriteBarrier(
4647 function_context, 4646 function_context,
4648 assembler->HeapConstant(isolate()->factory()->function_context_map())); 4647 assembler->HeapConstant(isolate->factory()->function_context_map()));
4649 assembler->StoreObjectFieldNoWriteBarrier(function_context, 4648 assembler->StoreObjectFieldNoWriteBarrier(function_context,
4650 Context::kLengthOffset, 4649 Context::kLengthOffset,
4651 assembler->SmiFromWord32(length)); 4650 assembler->SmiFromWord32(length));
4652 4651
4653 // Set up the fixed slots. 4652 // Set up the fixed slots.
4654 assembler->StoreFixedArrayElement( 4653 assembler->StoreFixedArrayElement(
4655 function_context, assembler->Int32Constant(Context::CLOSURE_INDEX), 4654 function_context, assembler->Int32Constant(Context::CLOSURE_INDEX),
4656 function, SKIP_WRITE_BARRIER); 4655 function, SKIP_WRITE_BARRIER);
4657 assembler->StoreFixedArrayElement( 4656 assembler->StoreFixedArrayElement(
4658 function_context, assembler->Int32Constant(Context::PREVIOUS_INDEX), 4657 function_context, assembler->Int32Constant(Context::PREVIOUS_INDEX),
(...skipping 23 matching lines...) Expand all
4682 assembler->StoreFixedArrayElement(function_context, slot_index, undefined, 4681 assembler->StoreFixedArrayElement(function_context, slot_index, undefined,
4683 SKIP_WRITE_BARRIER); 4682 SKIP_WRITE_BARRIER);
4684 Node* one = assembler->Int32Constant(1); 4683 Node* one = assembler->Int32Constant(1);
4685 Node* next_index = assembler->Int32Add(slot_index, one); 4684 Node* next_index = assembler->Int32Add(slot_index, one);
4686 var_slot_index.Bind(next_index); 4685 var_slot_index.Bind(next_index);
4687 assembler->Branch(assembler->Int32LessThan(next_index, length), &loop, 4686 assembler->Branch(assembler->Int32LessThan(next_index, length), &loop,
4688 &after_loop); 4687 &after_loop);
4689 } 4688 }
4690 assembler->Bind(&after_loop); 4689 assembler->Bind(&after_loop);
4691 4690
4692 assembler->Return(function_context); 4691 return function_context;
4692 }
4693
4694 void FastNewFunctionContextStub::GenerateAssembly(
4695 CodeStubAssembler* assembler) const {
4696 typedef compiler::Node Node;
4697 Node* function = assembler->Parameter(Descriptor::kFunction);
4698 Node* slots = assembler->Parameter(FastNewFunctionContextDescriptor::kSlots);
4699 Node* context = assembler->Parameter(Descriptor::kContext);
4700
4701 assembler->Return(Generate(assembler, function, slots, context));
4693 } 4702 }
4694 4703
4695 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { 4704 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) {
4696 CreateAllocationSiteStub stub(isolate); 4705 CreateAllocationSiteStub stub(isolate);
4697 stub.GetCode(); 4706 stub.GetCode();
4698 } 4707 }
4699 4708
4700 4709
4701 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { 4710 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) {
4702 CreateWeakCellStub stub(isolate); 4711 CreateWeakCellStub stub(isolate);
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
5062 if (type->Is(Type::UntaggedPointer())) { 5071 if (type->Is(Type::UntaggedPointer())) {
5063 return Representation::External(); 5072 return Representation::External();
5064 } 5073 }
5065 5074
5066 DCHECK(!type->Is(Type::Untagged())); 5075 DCHECK(!type->Is(Type::Untagged()));
5067 return Representation::Tagged(); 5076 return Representation::Tagged();
5068 } 5077 }
5069 5078
5070 } // namespace internal 5079 } // namespace internal
5071 } // namespace v8 5080 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698