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

Unified Diff: src/code-stubs.cc

Issue 2604833004: [builtins] FastNewFunctionContextStub becomes a builtin (Closed)
Patch Set: REBASE. Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index f47bdff149aaae975bf3b60ae03d5020ebf1793d..686a449ac7f7a688be1de31c98d279c614957b33 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -2053,87 +2053,6 @@ void GetPropertyStub::GenerateAssembly(
assembler.Return(var_result.value());
}
-
-// static
-int FastNewFunctionContextStub::MaximumSlots() {
- return FLAG_test_small_max_function_context_stub_size ? kSmallMaximumSlots
- : kMaximumSlots;
-}
-
-// static
-compiler::Node* FastNewFunctionContextStub::Generate(
- CodeStubAssembler* assembler, compiler::Node* function,
- compiler::Node* slots, compiler::Node* context, ScopeType scope_type) {
- typedef compiler::Node Node;
-
- slots = assembler->ChangeUint32ToWord(slots);
-
- // TODO(ishell): Use CSA::OptimalParameterMode() here.
- CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS;
- Node* min_context_slots =
- assembler->IntPtrConstant(Context::MIN_CONTEXT_SLOTS);
- Node* length = assembler->IntPtrAdd(slots, min_context_slots);
- Node* size =
- assembler->GetFixedArrayAllocationSize(length, FAST_ELEMENTS, mode);
-
- // Create a new closure from the given function info in new space
- Node* function_context = assembler->Allocate(size);
-
- Heap::RootListIndex context_type;
- switch (scope_type) {
- case EVAL_SCOPE:
- context_type = Heap::kEvalContextMapRootIndex;
- break;
- case FUNCTION_SCOPE:
- context_type = Heap::kFunctionContextMapRootIndex;
- break;
- default:
- UNREACHABLE();
- }
- assembler->StoreMapNoWriteBarrier(function_context, context_type);
- assembler->StoreObjectFieldNoWriteBarrier(
- function_context, Context::kLengthOffset, assembler->SmiTag(length));
-
- // Set up the fixed slots.
- assembler->StoreFixedArrayElement(function_context, Context::CLOSURE_INDEX,
- function, SKIP_WRITE_BARRIER);
- assembler->StoreFixedArrayElement(function_context, Context::PREVIOUS_INDEX,
- context, SKIP_WRITE_BARRIER);
- assembler->StoreFixedArrayElement(function_context, Context::EXTENSION_INDEX,
- assembler->TheHoleConstant(),
- SKIP_WRITE_BARRIER);
-
- // Copy the native context from the previous context.
- Node* native_context = assembler->LoadNativeContext(context);
- assembler->StoreFixedArrayElement(function_context,
- Context::NATIVE_CONTEXT_INDEX,
- native_context, SKIP_WRITE_BARRIER);
-
- // Initialize the rest of the slots to undefined.
- Node* undefined = assembler->UndefinedConstant();
- assembler->BuildFastFixedArrayForEach(
- function_context, FAST_ELEMENTS, min_context_slots, length,
- [assembler, undefined](Node* context, Node* offset) {
- assembler->StoreNoWriteBarrier(MachineRepresentation::kTagged, context,
- offset, undefined);
- },
- mode);
-
- return function_context;
-}
-
-void FastNewFunctionContextStub::GenerateAssembly(
- compiler::CodeAssemblerState* state) const {
- typedef compiler::Node Node;
- CodeStubAssembler assembler(state);
- Node* function = assembler.Parameter(Descriptor::kFunction);
- Node* slots = assembler.Parameter(Descriptor::kSlots);
- Node* context = assembler.Parameter(Descriptor::kContext);
-
- assembler.Return(
- Generate(&assembler, function, slots, context, scope_type()));
-}
-
// static
compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler,
compiler::Node* closure,
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698