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

Side by Side Diff: src/isolate.cc

Issue 2465253011: Fastpath some spread-call desugaring. (Closed)
Patch Set: Handles double arrays too Created 4 years, 1 month 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/isolate.h ('k') | src/isolate-inl.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/isolate.h" 5 #include "src/isolate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <fstream> // NOLINT(readability/streams) 9 #include <fstream> // NOLINT(readability/streams)
10 #include <sstream> 10 #include <sstream>
(...skipping 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after
2815 } 2815 }
2816 context = current_context->next_context_link(); 2816 context = current_context->next_context_link();
2817 } 2817 }
2818 return false; 2818 return false;
2819 } 2819 }
2820 2820
2821 bool Isolate::IsFastArrayConstructorPrototypeChainIntact() { 2821 bool Isolate::IsFastArrayConstructorPrototypeChainIntact() {
2822 PropertyCell* no_elements_cell = heap()->array_protector(); 2822 PropertyCell* no_elements_cell = heap()->array_protector();
2823 bool cell_reports_intact = 2823 bool cell_reports_intact =
2824 no_elements_cell->value()->IsSmi() && 2824 no_elements_cell->value()->IsSmi() &&
2825 Smi::cast(no_elements_cell->value())->value() == kArrayProtectorValid; 2825 Smi::cast(no_elements_cell->value())->value() == kProtectorValid;
2826 2826
2827 #ifdef DEBUG 2827 #ifdef DEBUG
2828 Map* root_array_map = 2828 Map* root_array_map =
2829 get_initial_js_array_map(GetInitialFastElementsKind()); 2829 get_initial_js_array_map(GetInitialFastElementsKind());
2830 Context* native_context = context()->native_context(); 2830 Context* native_context = context()->native_context();
2831 JSObject* initial_array_proto = JSObject::cast( 2831 JSObject* initial_array_proto = JSObject::cast(
2832 native_context->get(Context::INITIAL_ARRAY_PROTOTYPE_INDEX)); 2832 native_context->get(Context::INITIAL_ARRAY_PROTOTYPE_INDEX));
2833 JSObject* initial_object_proto = JSObject::cast( 2833 JSObject* initial_object_proto = JSObject::cast(
2834 native_context->get(Context::INITIAL_OBJECT_PROTOTYPE_INDEX)); 2834 native_context->get(Context::INITIAL_OBJECT_PROTOTYPE_INDEX));
2835 2835
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 2874
2875 #endif 2875 #endif
2876 2876
2877 return cell_reports_intact; 2877 return cell_reports_intact;
2878 } 2878 }
2879 2879
2880 bool Isolate::IsIsConcatSpreadableLookupChainIntact() { 2880 bool Isolate::IsIsConcatSpreadableLookupChainIntact() {
2881 Cell* is_concat_spreadable_cell = heap()->is_concat_spreadable_protector(); 2881 Cell* is_concat_spreadable_cell = heap()->is_concat_spreadable_protector();
2882 bool is_is_concat_spreadable_set = 2882 bool is_is_concat_spreadable_set =
2883 Smi::cast(is_concat_spreadable_cell->value())->value() == 2883 Smi::cast(is_concat_spreadable_cell->value())->value() ==
2884 kArrayProtectorInvalid; 2884 kProtectorInvalid;
2885 #ifdef DEBUG 2885 #ifdef DEBUG
2886 Map* root_array_map = get_initial_js_array_map(GetInitialFastElementsKind()); 2886 Map* root_array_map = get_initial_js_array_map(GetInitialFastElementsKind());
2887 if (root_array_map == NULL) { 2887 if (root_array_map == NULL) {
2888 // Ignore the value of is_concat_spreadable during bootstrap. 2888 // Ignore the value of is_concat_spreadable during bootstrap.
2889 return !is_is_concat_spreadable_set; 2889 return !is_is_concat_spreadable_set;
2890 } 2890 }
2891 Handle<Object> array_prototype(array_function()->prototype(), this); 2891 Handle<Object> array_prototype(array_function()->prototype(), this);
2892 Handle<Symbol> key = factory()->is_concat_spreadable_symbol(); 2892 Handle<Symbol> key = factory()->is_concat_spreadable_symbol();
2893 Handle<Object> value; 2893 Handle<Object> value;
2894 LookupIterator it(array_prototype, key); 2894 LookupIterator it(array_prototype, key);
(...skipping 14 matching lines...) Expand all
2909 return !receiver->HasProxyInPrototype(this); 2909 return !receiver->HasProxyInPrototype(this);
2910 } 2910 }
2911 2911
2912 void Isolate::UpdateArrayProtectorOnSetElement(Handle<JSObject> object) { 2912 void Isolate::UpdateArrayProtectorOnSetElement(Handle<JSObject> object) {
2913 DisallowHeapAllocation no_gc; 2913 DisallowHeapAllocation no_gc;
2914 if (!object->map()->is_prototype_map()) return; 2914 if (!object->map()->is_prototype_map()) return;
2915 if (!IsFastArrayConstructorPrototypeChainIntact()) return; 2915 if (!IsFastArrayConstructorPrototypeChainIntact()) return;
2916 if (!IsArrayOrObjectPrototype(*object)) return; 2916 if (!IsArrayOrObjectPrototype(*object)) return;
2917 PropertyCell::SetValueWithInvalidation( 2917 PropertyCell::SetValueWithInvalidation(
2918 factory()->array_protector(), 2918 factory()->array_protector(),
2919 handle(Smi::FromInt(kArrayProtectorInvalid), this)); 2919 handle(Smi::FromInt(kProtectorInvalid), this));
2920 } 2920 }
2921 2921
2922 void Isolate::InvalidateHasInstanceProtector() { 2922 void Isolate::InvalidateHasInstanceProtector() {
2923 DCHECK(factory()->has_instance_protector()->value()->IsSmi()); 2923 DCHECK(factory()->has_instance_protector()->value()->IsSmi());
2924 DCHECK(IsHasInstanceLookupChainIntact()); 2924 DCHECK(IsHasInstanceLookupChainIntact());
2925 PropertyCell::SetValueWithInvalidation( 2925 PropertyCell::SetValueWithInvalidation(
2926 factory()->has_instance_protector(), 2926 factory()->has_instance_protector(),
2927 handle(Smi::FromInt(kArrayProtectorInvalid), this)); 2927 handle(Smi::FromInt(kProtectorInvalid), this));
2928 DCHECK(!IsHasInstanceLookupChainIntact()); 2928 DCHECK(!IsHasInstanceLookupChainIntact());
2929 } 2929 }
2930 2930
2931 void Isolate::InvalidateIsConcatSpreadableProtector() { 2931 void Isolate::InvalidateIsConcatSpreadableProtector() {
2932 DCHECK(factory()->is_concat_spreadable_protector()->value()->IsSmi()); 2932 DCHECK(factory()->is_concat_spreadable_protector()->value()->IsSmi());
2933 DCHECK(IsIsConcatSpreadableLookupChainIntact()); 2933 DCHECK(IsIsConcatSpreadableLookupChainIntact());
2934 factory()->is_concat_spreadable_protector()->set_value( 2934 factory()->is_concat_spreadable_protector()->set_value(
2935 Smi::FromInt(kArrayProtectorInvalid)); 2935 Smi::FromInt(kProtectorInvalid));
2936 DCHECK(!IsIsConcatSpreadableLookupChainIntact()); 2936 DCHECK(!IsIsConcatSpreadableLookupChainIntact());
2937 } 2937 }
2938 2938
2939 void Isolate::InvalidateArraySpeciesProtector() { 2939 void Isolate::InvalidateArraySpeciesProtector() {
2940 DCHECK(factory()->species_protector()->value()->IsSmi()); 2940 DCHECK(factory()->species_protector()->value()->IsSmi());
2941 DCHECK(IsArraySpeciesLookupChainIntact()); 2941 DCHECK(IsArraySpeciesLookupChainIntact());
2942 factory()->species_protector()->set_value( 2942 factory()->species_protector()->set_value(Smi::FromInt(kProtectorInvalid));
2943 Smi::FromInt(kArrayProtectorInvalid));
2944 DCHECK(!IsArraySpeciesLookupChainIntact()); 2943 DCHECK(!IsArraySpeciesLookupChainIntact());
2945 } 2944 }
2946 2945
2947 void Isolate::InvalidateStringLengthOverflowProtector() { 2946 void Isolate::InvalidateStringLengthOverflowProtector() {
2948 DCHECK(factory()->string_length_protector()->value()->IsSmi()); 2947 DCHECK(factory()->string_length_protector()->value()->IsSmi());
2949 DCHECK(IsStringLengthOverflowIntact()); 2948 DCHECK(IsStringLengthOverflowIntact());
2950 PropertyCell::SetValueWithInvalidation( 2949 PropertyCell::SetValueWithInvalidation(
2951 factory()->string_length_protector(), 2950 factory()->string_length_protector(),
2952 handle(Smi::FromInt(kArrayProtectorInvalid), this)); 2951 handle(Smi::FromInt(kProtectorInvalid), this));
2953 DCHECK(!IsStringLengthOverflowIntact()); 2952 DCHECK(!IsStringLengthOverflowIntact());
2954 } 2953 }
2955 2954
2955 void Isolate::InvalidateArrayIteratorProtector() {
2956 DCHECK(factory()->array_iterator_protector()->value()->IsSmi());
2957 DCHECK(IsArrayIteratorLookupChainIntact());
2958 factory()->array_iterator_protector()->set_value(
2959 Smi::FromInt(kProtectorInvalid));
2960 DCHECK(!IsArrayIteratorLookupChainIntact());
2961 }
2962
2956 bool Isolate::IsAnyInitialArrayPrototype(Handle<JSArray> array) { 2963 bool Isolate::IsAnyInitialArrayPrototype(Handle<JSArray> array) {
2957 DisallowHeapAllocation no_gc; 2964 DisallowHeapAllocation no_gc;
2958 return IsInAnyContext(*array, Context::INITIAL_ARRAY_PROTOTYPE_INDEX); 2965 return IsInAnyContext(*array, Context::INITIAL_ARRAY_PROTOTYPE_INDEX);
2959 } 2966 }
2960 2967
2961 2968
2962 CallInterfaceDescriptorData* Isolate::call_descriptor_data(int index) { 2969 CallInterfaceDescriptorData* Isolate::call_descriptor_data(int index) {
2963 DCHECK(0 <= index && index < CallDescriptors::NUMBER_OF_DESCRIPTORS); 2970 DCHECK(0 <= index && index < CallDescriptors::NUMBER_OF_DESCRIPTORS);
2964 return &call_descriptor_data_[index]; 2971 return &call_descriptor_data_[index];
2965 } 2972 }
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
3488 // Then check whether this scope intercepts. 3495 // Then check whether this scope intercepts.
3489 if ((flag & intercept_mask_)) { 3496 if ((flag & intercept_mask_)) {
3490 intercepted_flags_ |= flag; 3497 intercepted_flags_ |= flag;
3491 return true; 3498 return true;
3492 } 3499 }
3493 return false; 3500 return false;
3494 } 3501 }
3495 3502
3496 } // namespace internal 3503 } // namespace internal
3497 } // namespace v8 3504 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/isolate-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698