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 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2222 CallRuntime(Runtime::kThrowNotGeneric, context, | 2222 CallRuntime(Runtime::kThrowNotGeneric, context, |
2223 HeapConstant(factory()->NewStringFromAsciiChecked(method_name, | 2223 HeapConstant(factory()->NewStringFromAsciiChecked(method_name, |
2224 TENURED))); | 2224 TENURED))); |
2225 Goto(&done_loop); // Never reached. | 2225 Goto(&done_loop); // Never reached. |
2226 } | 2226 } |
2227 | 2227 |
2228 Bind(&done_loop); | 2228 Bind(&done_loop); |
2229 return var_value.value(); | 2229 return var_value.value(); |
2230 } | 2230 } |
2231 | 2231 |
| 2232 Node* CodeStubAssembler::ThrowIfNotInstanceType(Node* context, Node* value, |
| 2233 InstanceType instance_type, |
| 2234 char const* method_name) { |
| 2235 Label out(this), throw_exception(this, Label::kDeferred); |
| 2236 Variable var_value_map(this, MachineRepresentation::kTagged); |
| 2237 |
| 2238 GotoIf(WordIsSmi(value), &throw_exception); |
| 2239 |
| 2240 // Load the instance type of the {value}. |
| 2241 var_value_map.Bind(LoadMap(value)); |
| 2242 Node* const value_instance_type = LoadMapInstanceType(var_value_map.value()); |
| 2243 |
| 2244 Branch(Word32Equal(value_instance_type, Int32Constant(instance_type)), &out, |
| 2245 &throw_exception); |
| 2246 |
| 2247 // The {value} is not a compatible receiver for this method. |
| 2248 Bind(&throw_exception); |
| 2249 CallRuntime( |
| 2250 Runtime::kThrowIncompatibleMethodReceiver, context, |
| 2251 HeapConstant(factory()->NewStringFromAsciiChecked(method_name, TENURED)), |
| 2252 value); |
| 2253 var_value_map.Bind(UndefinedConstant()); |
| 2254 Goto(&out); // Never reached. |
| 2255 |
| 2256 Bind(&out); |
| 2257 return var_value_map.value(); |
| 2258 } |
| 2259 |
2232 Node* CodeStubAssembler::StringCharCodeAt(Node* string, Node* index) { | 2260 Node* CodeStubAssembler::StringCharCodeAt(Node* string, Node* index) { |
2233 // Translate the {index} into a Word. | 2261 // Translate the {index} into a Word. |
2234 index = SmiToWord(index); | 2262 index = SmiToWord(index); |
2235 | 2263 |
2236 // We may need to loop in case of cons or sliced strings. | 2264 // We may need to loop in case of cons or sliced strings. |
2237 Variable var_index(this, MachineType::PointerRepresentation()); | 2265 Variable var_index(this, MachineType::PointerRepresentation()); |
2238 Variable var_result(this, MachineRepresentation::kWord32); | 2266 Variable var_result(this, MachineRepresentation::kWord32); |
2239 Variable var_string(this, MachineRepresentation::kTagged); | 2267 Variable var_string(this, MachineRepresentation::kTagged); |
2240 Variable* loop_vars[] = {&var_index, &var_string}; | 2268 Variable* loop_vars[] = {&var_index, &var_string}; |
2241 Label done_loop(this, &var_result), loop(this, 2, loop_vars); | 2269 Label done_loop(this, &var_result), loop(this, 2, loop_vars); |
(...skipping 3452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5694 Heap::kTheHoleValueRootIndex); | 5722 Heap::kTheHoleValueRootIndex); |
5695 | 5723 |
5696 // Store the WeakCell in the feedback vector. | 5724 // Store the WeakCell in the feedback vector. |
5697 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 5725 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
5698 CodeStubAssembler::SMI_PARAMETERS); | 5726 CodeStubAssembler::SMI_PARAMETERS); |
5699 return cell; | 5727 return cell; |
5700 } | 5728 } |
5701 | 5729 |
5702 } // namespace internal | 5730 } // namespace internal |
5703 } // namespace v8 | 5731 } // namespace v8 |
OLD | NEW |