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

Side by Side Diff: src/code-stub-assembler.cc

Issue 2133233002: [LoadIC] Handle simple field loads in the dispatcher (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix release builds Created 4 years, 5 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
« no previous file with comments | « no previous file | src/field-index.h » ('j') | src/ic/ic.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/code-stub-assembler.h" 5 #include "src/code-stub-assembler.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/frames-inl.h" 7 #include "src/frames-inl.h"
8 #include "src/frames.h" 8 #include "src/frames.h"
9 #include "src/ic/stub-cache.h" 9 #include "src/ic/stub-cache.h"
10 10
(...skipping 2064 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 } 2075 }
2076 Bind(&if_double); 2076 Bind(&if_double);
2077 { 2077 {
2078 var_double_value.Bind(LoadHeapNumberValue(value)); 2078 var_double_value.Bind(LoadHeapNumberValue(value));
2079 Goto(&rebox_double); 2079 Goto(&rebox_double);
2080 } 2080 }
2081 } 2081 }
2082 Bind(&rebox_double); 2082 Bind(&rebox_double);
2083 { 2083 {
2084 Comment("rebox_double"); 2084 Comment("rebox_double");
2085 Node* heap_number = AllocateHeapNumber(); 2085 Node* heap_number = AllocateHeapNumberWithValue(var_double_value.value());
2086 StoreHeapNumberValue(heap_number, var_double_value.value());
2087 var_value->Bind(heap_number); 2086 var_value->Bind(heap_number);
2088 Goto(&done); 2087 Goto(&done);
2089 } 2088 }
2090 } 2089 }
2091 Bind(&if_in_descriptor); 2090 Bind(&if_in_descriptor);
2092 { 2091 {
2093 Node* value = 2092 Node* value =
2094 LoadFixedArrayElement(descriptors, name_index, name_to_value_offset); 2093 LoadFixedArrayElement(descriptors, name_index, name_to_value_offset);
2095 var_value->Bind(value); 2094 var_value->Bind(value);
2096 Goto(&done); 2095 Goto(&done);
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
2872 try_megamorphic(this /*, Label::kDeferred*/), 2871 try_megamorphic(this /*, Label::kDeferred*/),
2873 miss(this /*, Label::kDeferred*/); 2872 miss(this /*, Label::kDeferred*/);
2874 2873
2875 Node* receiver_map = LoadReceiverMap(p->receiver); 2874 Node* receiver_map = LoadReceiverMap(p->receiver);
2876 2875
2877 // Check monomorphic case. 2876 // Check monomorphic case.
2878 Node* feedback = TryMonomorphicCase(p, receiver_map, &if_handler, 2877 Node* feedback = TryMonomorphicCase(p, receiver_map, &if_handler,
2879 &var_handler, &try_polymorphic); 2878 &var_handler, &try_polymorphic);
2880 Bind(&if_handler); 2879 Bind(&if_handler);
2881 { 2880 {
2881 Comment("LoadIC_if_handler");
2882 Label call_handler(this);
2883 Node* handler = var_handler.value();
2884 GotoUnless(WordIsSmi(handler), &call_handler);
2885
2886 // |handler| is a Smi. It encodes a field index as obtained by
2887 // FieldIndex.GetLoadByFieldOffset().
2888 {
2889 Label inobject_double(this), out_of_object(this),
2890 out_of_object_double(this);
2891 Variable var_double_value(this, MachineRepresentation::kFloat64);
2892 Label rebox_double(this, &var_double_value);
2893
2894 Node* handler_word = SmiToWord32(handler);
2895 // handler == (offset << 1) | is_double.
2896 Node* double_bit = Word32And(handler_word, Int32Constant(1));
2897 Node* offset = Word32Sar(handler_word, Int32Constant(1));
2898
2899 // Negative index -> out of object.
2900 GotoIf(Int32LessThan(offset, Int32Constant(0)), &out_of_object);
2901
2902 Node* offset_ptr = ChangeInt32ToIntPtr(offset);
2903 GotoUnless(Word32Equal(double_bit, Int32Constant(0)), &inobject_double);
2904 Return(LoadObjectField(p->receiver, offset_ptr));
2905
2906 Bind(&inobject_double);
2907 if (FLAG_unbox_double_fields) {
2908 var_double_value.Bind(
2909 LoadObjectField(p->receiver, offset_ptr, MachineType::Float64()));
2910 } else {
2911 Node* mutable_heap_number = LoadObjectField(p->receiver, offset_ptr);
2912 var_double_value.Bind(LoadHeapNumberValue(mutable_heap_number));
2913 }
2914 Goto(&rebox_double);
2915
2916 Bind(&out_of_object);
2917 // |offset| == -actual_offset
2918 offset_ptr = ChangeInt32ToIntPtr(Int32Sub(Int32Constant(0), offset));
2919 Node* properties = LoadProperties(p->receiver);
2920 Node* value = LoadObjectField(properties, offset_ptr);
2921 GotoUnless(Word32Equal(double_bit, Int32Constant(0)),
2922 &out_of_object_double);
2923 Return(value);
2924
2925 Bind(&out_of_object_double);
2926 var_double_value.Bind(LoadHeapNumberValue(value));
2927 Goto(&rebox_double);
2928
2929 Bind(&rebox_double);
2930 Return(AllocateHeapNumberWithValue(var_double_value.value()));
2931 }
2932
2933 // |handler| is a heap object. Must be code, call it.
2934 Bind(&call_handler);
2882 LoadWithVectorDescriptor descriptor(isolate()); 2935 LoadWithVectorDescriptor descriptor(isolate());
2883 TailCallStub(descriptor, var_handler.value(), p->context, p->receiver, 2936 TailCallStub(descriptor, handler, p->context, p->receiver, p->name, p->slot,
2884 p->name, p->slot, p->vector); 2937 p->vector);
2885 } 2938 }
2886 2939
2887 Bind(&try_polymorphic); 2940 Bind(&try_polymorphic);
2888 { 2941 {
2889 // Check polymorphic case. 2942 // Check polymorphic case.
2943 Comment("LoadIC_try_polymorphic");
2890 GotoUnless( 2944 GotoUnless(
2891 WordEqual(LoadMap(feedback), LoadRoot(Heap::kFixedArrayMapRootIndex)), 2945 WordEqual(LoadMap(feedback), LoadRoot(Heap::kFixedArrayMapRootIndex)),
2892 &try_megamorphic); 2946 &try_megamorphic);
2893 HandlePolymorphicCase(p, receiver_map, feedback, &if_handler, &var_handler, 2947 HandlePolymorphicCase(p, receiver_map, feedback, &if_handler, &var_handler,
2894 &miss, 2); 2948 &miss, 2);
2895 } 2949 }
2896 2950
2897 Bind(&try_megamorphic); 2951 Bind(&try_megamorphic);
2898 { 2952 {
2899 // Check megamorphic case. 2953 // Check megamorphic case.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2944 } 2998 }
2945 Bind(&miss); 2999 Bind(&miss);
2946 { 3000 {
2947 TailCallRuntime(Runtime::kLoadGlobalIC_Miss, p->context, p->slot, 3001 TailCallRuntime(Runtime::kLoadGlobalIC_Miss, p->context, p->slot,
2948 p->vector); 3002 p->vector);
2949 } 3003 }
2950 } 3004 }
2951 3005
2952 } // namespace internal 3006 } // namespace internal
2953 } // namespace v8 3007 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/field-index.h » ('j') | src/ic/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698