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

Unified Diff: src/code-stubs.cc

Issue 2435023002: Use a different map to distinguish eval contexts (Closed)
Patch Set: Changes from review 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/ast-graph-builder.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 c8feaddee6995df7b76df33e9aaca898196f3ba5..8345912cf79220428ae3541726b267ceb3b1e67d 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -2592,9 +2592,15 @@ void FastNewClosureStub::GenerateAssembly(
}
// 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) {
+ compiler::Node* slots, compiler::Node* context, ScopeType scope_type) {
typedef compiler::Node Node;
slots = assembler->ChangeUint32ToWord(slots);
@@ -2610,8 +2616,18 @@ compiler::Node* FastNewFunctionContextStub::Generate(
// Create a new closure from the given function info in new space
Node* function_context = assembler->Allocate(size);
- assembler->StoreMapNoWriteBarrier(function_context,
- Heap::kFunctionContextMapRootIndex);
+ 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));
@@ -2651,7 +2667,8 @@ void FastNewFunctionContextStub::GenerateAssembly(
Node* slots = assembler.Parameter(Descriptor::kSlots);
Node* context = assembler.Parameter(Descriptor::kContext);
- assembler.Return(Generate(&assembler, function, slots, context));
+ assembler.Return(
+ Generate(&assembler, function, slots, context, scope_type()));
}
// static
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698