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

Side by Side Diff: src/factory.cc

Issue 2435023002: Use a different map to distinguish eval contexts (Closed)
Patch Set: Crankshaft backends and scope deserialization Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 array->set_map_no_write_barrier(*module_context_map()); 831 array->set_map_no_write_barrier(*module_context_map());
832 Handle<Context> context = Handle<Context>::cast(array); 832 Handle<Context> context = Handle<Context>::cast(array);
833 context->set_closure(*function); 833 context->set_closure(*function);
834 context->set_previous(function->context()); 834 context->set_previous(function->context());
835 context->set_extension(*module); 835 context->set_extension(*module);
836 context->set_native_context(function->native_context()); 836 context->set_native_context(function->native_context());
837 DCHECK(context->IsModuleContext()); 837 DCHECK(context->IsModuleContext());
838 return context; 838 return context;
839 } 839 }
840 840
841 Handle<Context> Factory::NewEvalContext(Handle<Module> module,
842 Handle<JSFunction> function,
843 Handle<ScopeInfo> scope_info) {
844 DCHECK_EQ(scope_info->scope_type(), EVAL_SCOPE);
845 Handle<FixedArray> array =
846 NewFixedArray(scope_info->ContextLength(), TENURED);
847 array->set_map_no_write_barrier(*module_context_map());
848 Handle<Context> context = Handle<Context>::cast(array);
849 context->set_closure(*function);
850 context->set_previous(function->context());
851 context->set_extension(*module);
852 context->set_native_context(function->native_context());
853 DCHECK(context->IsModuleContext());
854 return context;
855 }
841 856
842 Handle<Context> Factory::NewFunctionContext(int length, 857 Handle<Context> Factory::NewFunctionContext(int length,
843 Handle<JSFunction> function) { 858 Handle<JSFunction> function) {
844 DCHECK(function->shared()->scope_info()->scope_type() == FUNCTION_SCOPE); 859 DCHECK(function->shared()->scope_info()->scope_type() == FUNCTION_SCOPE);
845 DCHECK(length >= Context::MIN_CONTEXT_SLOTS); 860 DCHECK(length >= Context::MIN_CONTEXT_SLOTS);
846 Handle<FixedArray> array = NewFixedArray(length); 861 Handle<FixedArray> array = NewFixedArray(length);
847 array->set_map_no_write_barrier(*function_context_map()); 862 array->set_map_no_write_barrier(*function_context_map());
848 Handle<Context> context = Handle<Context>::cast(array); 863 Handle<Context> context = Handle<Context>::cast(array);
849 context->set_closure(*function); 864 context->set_closure(*function);
850 context->set_previous(function->context()); 865 context->set_previous(function->context());
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); 2685 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map));
2671 iterator->set_initial_next(*next); 2686 iterator->set_initial_next(*next);
2672 iterator->set_array(*array); 2687 iterator->set_array(*array);
2673 iterator->set_index(0); 2688 iterator->set_index(0);
2674 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); 2689 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next);
2675 return iterator; 2690 return iterator;
2676 } 2691 }
2677 2692
2678 } // namespace internal 2693 } // namespace internal
2679 } // namespace v8 2694 } // namespace v8
OLDNEW
« src/contexts.cc ('K') | « src/factory.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698