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

Side by Side Diff: src/factory.cc

Issue 1480003002: [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add patch from Orion for interpreter cementation test. Disable obsolete/invalid tests. Created 5 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 unified diff | Download patch
« no previous file with comments | « src/crankshaft/x64/lithium-codegen-x64.cc ('k') | src/full-codegen/arm/full-codegen-arm.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 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/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 symbol->set_is_private(true); 718 symbol->set_is_private(true);
719 return symbol; 719 return symbol;
720 } 720 }
721 721
722 722
723 Handle<Context> Factory::NewNativeContext() { 723 Handle<Context> Factory::NewNativeContext() {
724 Handle<FixedArray> array = 724 Handle<FixedArray> array =
725 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED); 725 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED);
726 array->set_map_no_write_barrier(*native_context_map()); 726 array->set_map_no_write_barrier(*native_context_map());
727 Handle<Context> context = Handle<Context>::cast(array); 727 Handle<Context> context = Handle<Context>::cast(array);
728 context->set_native_context(*context);
728 context->set_js_array_maps(*undefined_value()); 729 context->set_js_array_maps(*undefined_value());
729 context->set_errors_thrown(Smi::FromInt(0)); 730 context->set_errors_thrown(Smi::FromInt(0));
730 DCHECK(context->IsNativeContext()); 731 DCHECK(context->IsNativeContext());
731 return context; 732 return context;
732 } 733 }
733 734
734 735
735 Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function, 736 Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function,
736 Handle<ScopeInfo> scope_info) { 737 Handle<ScopeInfo> scope_info) {
737 Handle<FixedArray> array = 738 Handle<FixedArray> array =
738 NewFixedArray(scope_info->ContextLength(), TENURED); 739 NewFixedArray(scope_info->ContextLength(), TENURED);
739 array->set_map_no_write_barrier(*script_context_map()); 740 array->set_map_no_write_barrier(*script_context_map());
740 Handle<Context> context = Handle<Context>::cast(array); 741 Handle<Context> context = Handle<Context>::cast(array);
741 context->set_closure(*function); 742 context->set_closure(*function);
742 context->set_previous(function->context()); 743 context->set_previous(function->context());
743 context->set_extension(*scope_info); 744 context->set_extension(*scope_info);
744 context->set_global_object(function->context()->global_object()); 745 context->set_native_context(function->native_context());
745 DCHECK(context->IsScriptContext()); 746 DCHECK(context->IsScriptContext());
746 return context; 747 return context;
747 } 748 }
748 749
749 750
750 Handle<ScriptContextTable> Factory::NewScriptContextTable() { 751 Handle<ScriptContextTable> Factory::NewScriptContextTable() {
751 Handle<FixedArray> array = NewFixedArray(1); 752 Handle<FixedArray> array = NewFixedArray(1);
752 array->set_map_no_write_barrier(*script_context_table_map()); 753 array->set_map_no_write_barrier(*script_context_table_map());
753 Handle<ScriptContextTable> context_table = 754 Handle<ScriptContextTable> context_table =
754 Handle<ScriptContextTable>::cast(array); 755 Handle<ScriptContextTable>::cast(array);
(...skipping 15 matching lines...) Expand all
770 771
771 Handle<Context> Factory::NewFunctionContext(int length, 772 Handle<Context> Factory::NewFunctionContext(int length,
772 Handle<JSFunction> function) { 773 Handle<JSFunction> function) {
773 DCHECK(length >= Context::MIN_CONTEXT_SLOTS); 774 DCHECK(length >= Context::MIN_CONTEXT_SLOTS);
774 Handle<FixedArray> array = NewFixedArray(length); 775 Handle<FixedArray> array = NewFixedArray(length);
775 array->set_map_no_write_barrier(*function_context_map()); 776 array->set_map_no_write_barrier(*function_context_map());
776 Handle<Context> context = Handle<Context>::cast(array); 777 Handle<Context> context = Handle<Context>::cast(array);
777 context->set_closure(*function); 778 context->set_closure(*function);
778 context->set_previous(function->context()); 779 context->set_previous(function->context());
779 context->set_extension(Smi::FromInt(0)); 780 context->set_extension(Smi::FromInt(0));
780 context->set_global_object(function->context()->global_object()); 781 context->set_native_context(function->native_context());
781 return context; 782 return context;
782 } 783 }
783 784
784 785
785 Handle<Context> Factory::NewCatchContext(Handle<JSFunction> function, 786 Handle<Context> Factory::NewCatchContext(Handle<JSFunction> function,
786 Handle<Context> previous, 787 Handle<Context> previous,
787 Handle<String> name, 788 Handle<String> name,
788 Handle<Object> thrown_object) { 789 Handle<Object> thrown_object) {
789 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == Context::THROWN_OBJECT_INDEX); 790 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == Context::THROWN_OBJECT_INDEX);
790 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS + 1); 791 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS + 1);
791 array->set_map_no_write_barrier(*catch_context_map()); 792 array->set_map_no_write_barrier(*catch_context_map());
792 Handle<Context> context = Handle<Context>::cast(array); 793 Handle<Context> context = Handle<Context>::cast(array);
793 context->set_closure(*function); 794 context->set_closure(*function);
794 context->set_previous(*previous); 795 context->set_previous(*previous);
795 context->set_extension(*name); 796 context->set_extension(*name);
796 context->set_global_object(previous->global_object()); 797 context->set_native_context(previous->native_context());
797 context->set(Context::THROWN_OBJECT_INDEX, *thrown_object); 798 context->set(Context::THROWN_OBJECT_INDEX, *thrown_object);
798 return context; 799 return context;
799 } 800 }
800 801
801 802
802 Handle<Context> Factory::NewWithContext(Handle<JSFunction> function, 803 Handle<Context> Factory::NewWithContext(Handle<JSFunction> function,
803 Handle<Context> previous, 804 Handle<Context> previous,
804 Handle<JSReceiver> extension) { 805 Handle<JSReceiver> extension) {
805 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS); 806 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS);
806 array->set_map_no_write_barrier(*with_context_map()); 807 array->set_map_no_write_barrier(*with_context_map());
807 Handle<Context> context = Handle<Context>::cast(array); 808 Handle<Context> context = Handle<Context>::cast(array);
808 context->set_closure(*function); 809 context->set_closure(*function);
809 context->set_previous(*previous); 810 context->set_previous(*previous);
810 context->set_extension(*extension); 811 context->set_extension(*extension);
811 context->set_global_object(previous->global_object()); 812 context->set_native_context(previous->native_context());
812 return context; 813 return context;
813 } 814 }
814 815
815 816
816 Handle<Context> Factory::NewBlockContext(Handle<JSFunction> function, 817 Handle<Context> Factory::NewBlockContext(Handle<JSFunction> function,
817 Handle<Context> previous, 818 Handle<Context> previous,
818 Handle<ScopeInfo> scope_info) { 819 Handle<ScopeInfo> scope_info) {
819 Handle<FixedArray> array = 820 Handle<FixedArray> array =
820 NewFixedArrayWithHoles(scope_info->ContextLength()); 821 NewFixedArrayWithHoles(scope_info->ContextLength());
821 array->set_map_no_write_barrier(*block_context_map()); 822 array->set_map_no_write_barrier(*block_context_map());
822 Handle<Context> context = Handle<Context>::cast(array); 823 Handle<Context> context = Handle<Context>::cast(array);
823 context->set_closure(*function); 824 context->set_closure(*function);
824 context->set_previous(*previous); 825 context->set_previous(*previous);
825 context->set_extension(*scope_info); 826 context->set_extension(*scope_info);
826 context->set_global_object(previous->global_object()); 827 context->set_native_context(previous->native_context());
827 return context; 828 return context;
828 } 829 }
829 830
830 831
831 Handle<Struct> Factory::NewStruct(InstanceType type) { 832 Handle<Struct> Factory::NewStruct(InstanceType type) {
832 CALL_HEAP_FUNCTION( 833 CALL_HEAP_FUNCTION(
833 isolate(), 834 isolate(),
834 isolate()->heap()->AllocateStruct(type), 835 isolate()->heap()->AllocateStruct(type),
835 Struct); 836 Struct);
836 } 837 }
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 } 2326 }
2326 2327
2327 2328
2328 Handle<Object> Factory::ToBoolean(bool value) { 2329 Handle<Object> Factory::ToBoolean(bool value) {
2329 return value ? true_value() : false_value(); 2330 return value ? true_value() : false_value();
2330 } 2331 }
2331 2332
2332 2333
2333 } // namespace internal 2334 } // namespace internal
2334 } // namespace v8 2335 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/x64/lithium-codegen-x64.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698