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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 Word32Equal(LoadInstanceType(result.value()), Int32Constant(MAP_TYPE)); | 1194 Word32Equal(LoadInstanceType(result.value()), Int32Constant(MAP_TYPE)); |
1195 GotoUnless(is_map_type, &done); | 1195 GotoUnless(is_map_type, &done); |
1196 result.Bind( | 1196 result.Bind( |
1197 LoadObjectField(result.value(), Map::kConstructorOrBackPointerOffset)); | 1197 LoadObjectField(result.value(), Map::kConstructorOrBackPointerOffset)); |
1198 Goto(&loop); | 1198 Goto(&loop); |
1199 } | 1199 } |
1200 Bind(&done); | 1200 Bind(&done); |
1201 return result.value(); | 1201 return result.value(); |
1202 } | 1202 } |
1203 | 1203 |
| 1204 Node* CodeStubAssembler::LoadSharedFunctionInfoSpecialField( |
| 1205 Node* shared, int offset, ParameterMode mode) { |
| 1206 if (Is64()) { |
| 1207 Node* result = LoadObjectField(shared, offset, MachineType::Int32()); |
| 1208 if (mode == SMI_PARAMETERS) { |
| 1209 result = SmiTag(result); |
| 1210 } else { |
| 1211 result = ChangeUint32ToWord(result); |
| 1212 } |
| 1213 return result; |
| 1214 } else { |
| 1215 Node* result = LoadObjectField(shared, offset); |
| 1216 if (mode != SMI_PARAMETERS) { |
| 1217 result = SmiUntag(result); |
| 1218 } |
| 1219 return result; |
| 1220 } |
| 1221 } |
| 1222 |
1204 Node* CodeStubAssembler::LoadNameHashField(Node* name) { | 1223 Node* CodeStubAssembler::LoadNameHashField(Node* name) { |
1205 CSA_ASSERT(this, IsName(name)); | 1224 CSA_ASSERT(this, IsName(name)); |
1206 return LoadObjectField(name, Name::kHashFieldOffset, MachineType::Uint32()); | 1225 return LoadObjectField(name, Name::kHashFieldOffset, MachineType::Uint32()); |
1207 } | 1226 } |
1208 | 1227 |
1209 Node* CodeStubAssembler::LoadNameHash(Node* name, Label* if_hash_not_computed) { | 1228 Node* CodeStubAssembler::LoadNameHash(Node* name, Label* if_hash_not_computed) { |
1210 Node* hash_field = LoadNameHashField(name); | 1229 Node* hash_field = LoadNameHashField(name); |
1211 if (if_hash_not_computed != nullptr) { | 1230 if (if_hash_not_computed != nullptr) { |
1212 GotoIf(Word32Equal( | 1231 GotoIf(Word32Equal( |
1213 Word32And(hash_field, Int32Constant(Name::kHashNotComputedMask)), | 1232 Word32And(hash_field, Int32Constant(Name::kHashNotComputedMask)), |
(...skipping 5068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6282 int increment = IsFastDoubleElementsKind(kind) ? kDoubleSize : kPointerSize; | 6301 int increment = IsFastDoubleElementsKind(kind) ? kDoubleSize : kPointerSize; |
6283 BuildFastLoop( | 6302 BuildFastLoop( |
6284 vars, start, limit, | 6303 vars, start, limit, |
6285 [fixed_array, &body](Node* offset) { body(fixed_array, offset); }, | 6304 [fixed_array, &body](Node* offset) { body(fixed_array, offset); }, |
6286 direction == ForEachDirection::kReverse ? -increment : increment, | 6305 direction == ForEachDirection::kReverse ? -increment : increment, |
6287 INTPTR_PARAMETERS, | 6306 INTPTR_PARAMETERS, |
6288 direction == ForEachDirection::kReverse ? IndexAdvanceMode::kPre | 6307 direction == ForEachDirection::kReverse ? IndexAdvanceMode::kPre |
6289 : IndexAdvanceMode::kPost); | 6308 : IndexAdvanceMode::kPost); |
6290 } | 6309 } |
6291 | 6310 |
| 6311 void CodeStubAssembler::GotoIfFixedArraySizeDoesntFitInNewSpace( |
| 6312 Node* element_count, Label* doesnt_fit, int base_size, ParameterMode mode) { |
| 6313 int max_newspace_parameters = |
| 6314 (kMaxRegularHeapObjectSize - base_size) / kPointerSize; |
| 6315 GotoIf(IntPtrOrSmiGreaterThan( |
| 6316 element_count, IntPtrOrSmiConstant(max_newspace_parameters, mode), |
| 6317 mode), |
| 6318 doesnt_fit); |
| 6319 } |
| 6320 |
6292 void CodeStubAssembler::InitializeFieldsWithRoot( | 6321 void CodeStubAssembler::InitializeFieldsWithRoot( |
6293 Node* object, Node* start_offset, Node* end_offset, | 6322 Node* object, Node* start_offset, Node* end_offset, |
6294 Heap::RootListIndex root_index) { | 6323 Heap::RootListIndex root_index) { |
6295 start_offset = IntPtrAdd(start_offset, IntPtrConstant(-kHeapObjectTag)); | 6324 start_offset = IntPtrAdd(start_offset, IntPtrConstant(-kHeapObjectTag)); |
6296 end_offset = IntPtrAdd(end_offset, IntPtrConstant(-kHeapObjectTag)); | 6325 end_offset = IntPtrAdd(end_offset, IntPtrConstant(-kHeapObjectTag)); |
6297 Node* root_value = LoadRoot(root_index); | 6326 Node* root_value = LoadRoot(root_index); |
6298 BuildFastLoop(end_offset, start_offset, | 6327 BuildFastLoop(end_offset, start_offset, |
6299 [this, object, root_value](Node* current) { | 6328 [this, object, root_value](Node* current) { |
6300 StoreNoWriteBarrier(MachineRepresentation::kTagged, object, | 6329 StoreNoWriteBarrier(MachineRepresentation::kTagged, object, |
6301 current, root_value); | 6330 current, root_value); |
(...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8347 formatted.c_str(), TENURED); | 8376 formatted.c_str(), TENURED); |
8348 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 8377 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
8349 HeapConstant(string)); | 8378 HeapConstant(string)); |
8350 } | 8379 } |
8351 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 8380 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
8352 #endif | 8381 #endif |
8353 } | 8382 } |
8354 | 8383 |
8355 } // namespace internal | 8384 } // namespace internal |
8356 } // namespace v8 | 8385 } // namespace v8 |
OLD | NEW |