OLD | NEW |
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/handler-configuration.h" | 9 #include "src/ic/handler-configuration.h" |
10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
(...skipping 3199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3210 : WordShr(index_node, IntPtrConstant(-element_size_shift))); | 3210 : WordShr(index_node, IntPtrConstant(-element_size_shift))); |
3211 } | 3211 } |
3212 | 3212 |
3213 compiler::Node* CodeStubAssembler::LoadTypeFeedbackVectorForStub() { | 3213 compiler::Node* CodeStubAssembler::LoadTypeFeedbackVectorForStub() { |
3214 Node* function = | 3214 Node* function = |
3215 LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset); | 3215 LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset); |
3216 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); | 3216 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); |
3217 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); | 3217 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); |
3218 } | 3218 } |
3219 | 3219 |
| 3220 void CodeStubAssembler::UpdateFeedback(compiler::Node* feedback, |
| 3221 compiler::Node* type_feedback_vector, |
| 3222 compiler::Node* slot_id) { |
| 3223 Label combine_feedback(this), record_feedback(this), end(this); |
| 3224 |
| 3225 Node* previous_feedback = |
| 3226 LoadFixedArrayElement(type_feedback_vector, slot_id); |
| 3227 Node* is_uninitialized = WordEqual( |
| 3228 previous_feedback, |
| 3229 HeapConstant(TypeFeedbackVector::UninitializedSentinel(isolate()))); |
| 3230 BranchIf(is_uninitialized, &record_feedback, &combine_feedback); |
| 3231 |
| 3232 Bind(&record_feedback); |
| 3233 { |
| 3234 StoreFixedArrayElement(type_feedback_vector, slot_id, SmiTag(feedback), |
| 3235 SKIP_WRITE_BARRIER); |
| 3236 Goto(&end); |
| 3237 } |
| 3238 |
| 3239 Bind(&combine_feedback); |
| 3240 { |
| 3241 Node* untagged_previous_feedback = SmiUntag(previous_feedback); |
| 3242 Node* combined_feedback = Word32Or(untagged_previous_feedback, feedback); |
| 3243 StoreFixedArrayElement(type_feedback_vector, slot_id, |
| 3244 SmiTag(combined_feedback), SKIP_WRITE_BARRIER); |
| 3245 Goto(&end); |
| 3246 } |
| 3247 |
| 3248 Bind(&end); |
| 3249 } |
| 3250 |
3220 compiler::Node* CodeStubAssembler::LoadReceiverMap(compiler::Node* receiver) { | 3251 compiler::Node* CodeStubAssembler::LoadReceiverMap(compiler::Node* receiver) { |
3221 Variable var_receiver_map(this, MachineRepresentation::kTagged); | 3252 Variable var_receiver_map(this, MachineRepresentation::kTagged); |
3222 // TODO(ishell): defer blocks when it works. | 3253 // TODO(ishell): defer blocks when it works. |
3223 Label load_smi_map(this /*, Label::kDeferred*/), load_receiver_map(this), | 3254 Label load_smi_map(this /*, Label::kDeferred*/), load_receiver_map(this), |
3224 if_result(this); | 3255 if_result(this); |
3225 | 3256 |
3226 Branch(WordIsSmi(receiver), &load_smi_map, &load_receiver_map); | 3257 Branch(WordIsSmi(receiver), &load_smi_map, &load_receiver_map); |
3227 Bind(&load_smi_map); | 3258 Bind(&load_smi_map); |
3228 { | 3259 { |
3229 var_receiver_map.Bind(LoadRoot(Heap::kHeapNumberMapRootIndex)); | 3260 var_receiver_map.Bind(LoadRoot(Heap::kHeapNumberMapRootIndex)); |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3974 Heap::kTheHoleValueRootIndex); | 4005 Heap::kTheHoleValueRootIndex); |
3975 | 4006 |
3976 // Store the WeakCell in the feedback vector. | 4007 // Store the WeakCell in the feedback vector. |
3977 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 4008 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
3978 CodeStubAssembler::SMI_PARAMETERS); | 4009 CodeStubAssembler::SMI_PARAMETERS); |
3979 return cell; | 4010 return cell; |
3980 } | 4011 } |
3981 | 4012 |
3982 } // namespace internal | 4013 } // namespace internal |
3983 } // namespace v8 | 4014 } // namespace v8 |
OLD | NEW |