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

Unified Diff: src/code-stubs.cc

Issue 2435023002: Use a different map to distinguish eval contexts (Closed)
Patch Set: Changes based on review commnets 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
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index 9ad51574c162ce65895e3025119957515ddefc8d..e3d041e974db0e9f59dd20456511493418481b95 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -2606,9 +2606,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);
@@ -2624,8 +2630,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));
@@ -2665,7 +2681,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

Powered by Google App Engine
This is Rietveld 408576698