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

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 for realz 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') | no next file with comments »
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 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 } 2136 }
2137 Bind(&if_double); 2137 Bind(&if_double);
2138 { 2138 {
2139 var_double_value.Bind(LoadHeapNumberValue(value)); 2139 var_double_value.Bind(LoadHeapNumberValue(value));
2140 Goto(&rebox_double); 2140 Goto(&rebox_double);
2141 } 2141 }
2142 } 2142 }
2143 Bind(&rebox_double); 2143 Bind(&rebox_double);
2144 { 2144 {
2145 Comment("rebox_double"); 2145 Comment("rebox_double");
2146 Node* heap_number = AllocateHeapNumber(); 2146 Node* heap_number = AllocateHeapNumberWithValue(var_double_value.value());
2147 StoreHeapNumberValue(heap_number, var_double_value.value());
2148 var_value->Bind(heap_number); 2147 var_value->Bind(heap_number);
2149 Goto(&done); 2148 Goto(&done);
2150 } 2149 }
2151 } 2150 }
2152 Bind(&if_in_descriptor); 2151 Bind(&if_in_descriptor);
2153 { 2152 {
2154 Node* value = 2153 Node* value =
2155 LoadFixedArrayElement(descriptors, name_index, name_to_value_offset); 2154 LoadFixedArrayElement(descriptors, name_index, name_to_value_offset);
2156 var_value->Bind(value); 2155 var_value->Bind(value);
2157 Goto(&done); 2156 Goto(&done);
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 try_megamorphic(this /*, Label::kDeferred*/), 2917 try_megamorphic(this /*, Label::kDeferred*/),
2919 miss(this /*, Label::kDeferred*/); 2918 miss(this /*, Label::kDeferred*/);
2920 2919
2921 Node* receiver_map = LoadReceiverMap(p->receiver); 2920 Node* receiver_map = LoadReceiverMap(p->receiver);
2922 2921
2923 // Check monomorphic case. 2922 // Check monomorphic case.
2924 Node* feedback = TryMonomorphicCase(p, receiver_map, &if_handler, 2923 Node* feedback = TryMonomorphicCase(p, receiver_map, &if_handler,
2925 &var_handler, &try_polymorphic); 2924 &var_handler, &try_polymorphic);
2926 Bind(&if_handler); 2925 Bind(&if_handler);
2927 { 2926 {
2927 Comment("LoadIC_if_handler");
2928 Label call_handler(this);
2929 Node* handler = var_handler.value();
2930 GotoUnless(WordIsSmi(handler), &call_handler);
2931
2932 // |handler| is a Smi. It encodes a field index as obtained by
2933 // FieldIndex.GetLoadByFieldOffset().
2934 {
2935 Label inobject_double(this), out_of_object(this),
2936 out_of_object_double(this);
2937 Variable var_double_value(this, MachineRepresentation::kFloat64);
2938 Label rebox_double(this, &var_double_value);
2939
2940 Node* handler_word = SmiToWord32(handler);
2941 // handler == (offset << 1) | is_double.
2942 Node* double_bit = Word32And(handler_word, Int32Constant(1));
2943 Node* offset = Word32Sar(handler_word, Int32Constant(1));
2944
2945 // Negative index -> out of object.
2946 GotoIf(Int32LessThan(offset, Int32Constant(0)), &out_of_object);
2947
2948 Node* offset_ptr = ChangeInt32ToIntPtr(offset);
2949 GotoUnless(Word32Equal(double_bit, Int32Constant(0)), &inobject_double);
2950 Return(LoadObjectField(p->receiver, offset_ptr));
2951
2952 Bind(&inobject_double);
2953 if (FLAG_unbox_double_fields) {
2954 var_double_value.Bind(
2955 LoadObjectField(p->receiver, offset_ptr, MachineType::Float64()));
2956 } else {
2957 Node* mutable_heap_number = LoadObjectField(p->receiver, offset_ptr);
2958 var_double_value.Bind(LoadHeapNumberValue(mutable_heap_number));
2959 }
2960 Goto(&rebox_double);
2961
2962 Bind(&out_of_object);
2963 // |offset| == -actual_offset
2964 offset_ptr = ChangeInt32ToIntPtr(Int32Sub(Int32Constant(0), offset));
2965 Node* properties = LoadProperties(p->receiver);
2966 Node* value = LoadObjectField(properties, offset_ptr);
2967 GotoUnless(Word32Equal(double_bit, Int32Constant(0)),
2968 &out_of_object_double);
2969 Return(value);
2970
2971 Bind(&out_of_object_double);
2972 var_double_value.Bind(LoadHeapNumberValue(value));
2973 Goto(&rebox_double);
2974
2975 Bind(&rebox_double);
2976 Return(AllocateHeapNumberWithValue(var_double_value.value()));
2977 }
2978
2979 // |handler| is a heap object. Must be code, call it.
2980 Bind(&call_handler);
2928 LoadWithVectorDescriptor descriptor(isolate()); 2981 LoadWithVectorDescriptor descriptor(isolate());
2929 TailCallStub(descriptor, var_handler.value(), p->context, p->receiver, 2982 TailCallStub(descriptor, handler, p->context, p->receiver, p->name, p->slot,
2930 p->name, p->slot, p->vector); 2983 p->vector);
2931 } 2984 }
2932 2985
2933 Bind(&try_polymorphic); 2986 Bind(&try_polymorphic);
2934 { 2987 {
2935 // Check polymorphic case. 2988 // Check polymorphic case.
2989 Comment("LoadIC_try_polymorphic");
2936 GotoUnless( 2990 GotoUnless(
2937 WordEqual(LoadMap(feedback), LoadRoot(Heap::kFixedArrayMapRootIndex)), 2991 WordEqual(LoadMap(feedback), LoadRoot(Heap::kFixedArrayMapRootIndex)),
2938 &try_megamorphic); 2992 &try_megamorphic);
2939 HandlePolymorphicCase(p, receiver_map, feedback, &if_handler, &var_handler, 2993 HandlePolymorphicCase(p, receiver_map, feedback, &if_handler, &var_handler,
2940 &miss, 2); 2994 &miss, 2);
2941 } 2995 }
2942 2996
2943 Bind(&try_megamorphic); 2997 Bind(&try_megamorphic);
2944 { 2998 {
2945 // Check megamorphic case. 2999 // Check megamorphic case.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 } 3044 }
2991 Bind(&miss); 3045 Bind(&miss);
2992 { 3046 {
2993 TailCallRuntime(Runtime::kLoadGlobalIC_Miss, p->context, p->slot, 3047 TailCallRuntime(Runtime::kLoadGlobalIC_Miss, p->context, p->slot,
2994 p->vector); 3048 p->vector);
2995 } 3049 }
2996 } 3050 }
2997 3051
2998 } // namespace internal 3052 } // namespace internal
2999 } // namespace v8 3053 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/field-index.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698