OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef V8_COMPILER_CODE_STUB_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_CODE_STUB_ASSEMBLER_H_ |
6 #define V8_COMPILER_CODE_STUB_ASSEMBLER_H_ | 6 #define V8_COMPILER_CODE_STUB_ASSEMBLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 // Clients of this interface shouldn't depend on lots of compiler internals. | 10 // Clients of this interface shouldn't depend on lots of compiler internals. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // Constants. | 155 // Constants. |
156 Node* Int32Constant(int value); | 156 Node* Int32Constant(int value); |
157 Node* IntPtrConstant(intptr_t value); | 157 Node* IntPtrConstant(intptr_t value); |
158 Node* NumberConstant(double value); | 158 Node* NumberConstant(double value); |
159 Node* SmiConstant(Smi* value); | 159 Node* SmiConstant(Smi* value); |
160 Node* HeapConstant(Handle<HeapObject> object); | 160 Node* HeapConstant(Handle<HeapObject> object); |
161 Node* BooleanConstant(bool value); | 161 Node* BooleanConstant(bool value); |
162 Node* ExternalConstant(ExternalReference address); | 162 Node* ExternalConstant(ExternalReference address); |
163 Node* Float64Constant(double value); | 163 Node* Float64Constant(double value); |
164 Node* BooleanMapConstant(); | 164 Node* BooleanMapConstant(); |
165 Node* EmptyStringConstant(); | |
166 Node* HeapNumberMapConstant(); | 165 Node* HeapNumberMapConstant(); |
167 Node* NaNConstant(); | |
168 Node* NoContextConstant(); | |
169 Node* NullConstant(); | 166 Node* NullConstant(); |
170 Node* UndefinedConstant(); | 167 Node* UndefinedConstant(); |
171 | 168 |
172 Node* Parameter(int value); | 169 Node* Parameter(int value); |
173 void Return(Node* value); | 170 void Return(Node* value); |
174 | 171 |
175 void Bind(Label* label); | 172 void Bind(Label* label); |
176 void Goto(Label* label); | 173 void Goto(Label* label); |
177 void GotoIf(Node* condition, Label* true_label); | 174 void GotoIf(Node* condition, Label* true_label); |
178 void GotoUnless(Node* condition, Label* false_label); | 175 void GotoUnless(Node* condition, Label* false_label); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // Float64 operations. | 271 // Float64 operations. |
275 Node* Float64Ceil(Node* x); | 272 Node* Float64Ceil(Node* x); |
276 Node* Float64Floor(Node* x); | 273 Node* Float64Floor(Node* x); |
277 Node* Float64Round(Node* x); | 274 Node* Float64Round(Node* x); |
278 Node* Float64Trunc(Node* x); | 275 Node* Float64Trunc(Node* x); |
279 | 276 |
280 // Tag a Word as a Smi value. | 277 // Tag a Word as a Smi value. |
281 Node* SmiTag(Node* value); | 278 Node* SmiTag(Node* value); |
282 // Untag a Smi value as a Word. | 279 // Untag a Smi value as a Word. |
283 Node* SmiUntag(Node* value); | 280 Node* SmiUntag(Node* value); |
284 Node* SmiToWord(Node* value) { return SmiUntag(value); } | |
285 | 281 |
286 // Smi conversions. | 282 // Smi conversions. |
287 Node* SmiToFloat64(Node* value); | 283 Node* SmiToFloat64(Node* value); |
288 Node* SmiFromWord32(Node* value); | |
289 Node* SmiToWord32(Node* value); | 284 Node* SmiToWord32(Node* value); |
290 | 285 |
291 // Smi operations. | 286 // Smi operations. |
292 Node* SmiAdd(Node* a, Node* b); | 287 Node* SmiAdd(Node* a, Node* b); |
293 Node* SmiAddWithOverflow(Node* a, Node* b); | 288 Node* SmiAddWithOverflow(Node* a, Node* b); |
294 Node* SmiSub(Node* a, Node* b); | 289 Node* SmiSub(Node* a, Node* b); |
295 Node* SmiSubWithOverflow(Node* a, Node* b); | 290 Node* SmiSubWithOverflow(Node* a, Node* b); |
296 Node* SmiEqual(Node* a, Node* b); | 291 Node* SmiEqual(Node* a, Node* b); |
297 Node* SmiAboveOrEqual(Node* a, Node* b); | |
298 Node* SmiLessThan(Node* a, Node* b); | 292 Node* SmiLessThan(Node* a, Node* b); |
299 Node* SmiLessThanOrEqual(Node* a, Node* b); | 293 Node* SmiLessThanOrEqual(Node* a, Node* b); |
300 Node* SmiMin(Node* a, Node* b); | 294 Node* SmiMin(Node* a, Node* b); |
301 | 295 |
302 // Load a value from the root array. | 296 // Load a value from the root array. |
303 Node* LoadRoot(Heap::RootListIndex root_index); | 297 Node* LoadRoot(Heap::RootListIndex root_index); |
304 | 298 |
305 // Check a value for smi-ness | 299 // Check a value for smi-ness |
306 Node* WordIsSmi(Node* a); | 300 Node* WordIsSmi(Node* a); |
307 | 301 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 336 |
343 // Load an array element from a FixedArray. | 337 // Load an array element from a FixedArray. |
344 Node* LoadFixedArrayElementInt32Index(Node* object, Node* int32_index, | 338 Node* LoadFixedArrayElementInt32Index(Node* object, Node* int32_index, |
345 int additional_offset = 0); | 339 int additional_offset = 0); |
346 Node* LoadFixedArrayElementSmiIndex(Node* object, Node* smi_index, | 340 Node* LoadFixedArrayElementSmiIndex(Node* object, Node* smi_index, |
347 int additional_offset = 0); | 341 int additional_offset = 0); |
348 Node* LoadFixedArrayElementConstantIndex(Node* object, int index); | 342 Node* LoadFixedArrayElementConstantIndex(Node* object, int index); |
349 | 343 |
350 // Allocate an object of the given size. | 344 // Allocate an object of the given size. |
351 Node* Allocate(int size, AllocationFlags flags = kNone); | 345 Node* Allocate(int size, AllocationFlags flags = kNone); |
352 Node* InnerAllocate(Node* previous, int offset); | |
353 // Allocate a HeapNumber without initializing its value. | 346 // Allocate a HeapNumber without initializing its value. |
354 Node* AllocateHeapNumber(); | 347 Node* AllocateHeapNumber(); |
355 // Allocate a HeapNumber with a specific value. | 348 // Allocate a HeapNumber with a specific value. |
356 Node* AllocateHeapNumberWithValue(Node* value); | 349 Node* AllocateHeapNumberWithValue(Node* value); |
357 // Allocate a SeqOneByteString with the given length. | 350 Node* InnerAllocate(Node* previous, int offset); |
358 Node* AllocateSeqOneByteString(int length); | |
359 // Allocate a SeqTwoByteString with the given length. | |
360 Node* AllocateSeqTwoByteString(int length); | |
361 | 351 |
362 // Store an array element to a FixedArray. | 352 // Store an array element to a FixedArray. |
363 Node* StoreFixedArrayElementInt32Index(Node* object, Node* index, | |
364 Node* value); | |
365 Node* StoreFixedArrayElementNoWriteBarrier(Node* object, Node* index, | 353 Node* StoreFixedArrayElementNoWriteBarrier(Node* object, Node* index, |
366 Node* value); | 354 Node* value); |
367 // Load the Map of an HeapObject. | 355 // Load the Map of an HeapObject. |
368 Node* LoadMap(Node* object); | 356 Node* LoadMap(Node* object); |
369 // Store the Map of an HeapObject. | 357 // Store the Map of an HeapObject. |
370 Node* StoreMapNoWriteBarrier(Node* object, Node* map); | 358 Node* StoreMapNoWriteBarrier(Node* object, Node* map); |
371 // Load the instance type of an HeapObject. | 359 // Load the instance type of an HeapObject. |
372 Node* LoadInstanceType(Node* object); | 360 Node* LoadInstanceType(Node* object); |
373 | 361 |
374 // Load the elements backing store of a JSObject. | 362 // Load the elements backing store of a JSObject. |
375 Node* LoadElements(Node* object); | 363 Node* LoadElements(Node* object); |
376 // Load the length of a fixed array base instance. | 364 // Load the length of a fixed array base instance. |
377 Node* LoadFixedArrayBaseLength(Node* array); | 365 Node* LoadFixedArrayBaseLength(Node* array); |
378 | 366 |
379 // Returns a node that is true if the given bit is set in |word32|. | 367 // Returns a node that is true if the given bit is set in |word32|. |
380 template <typename T> | 368 template <typename T> |
381 Node* BitFieldDecode(Node* word32) { | 369 Node* BitFieldDecode(Node* word32) { |
382 return BitFieldDecode(word32, T::kShift, T::kMask); | 370 return BitFieldDecode(word32, T::kShift, T::kMask); |
383 } | 371 } |
384 | 372 |
385 Node* BitFieldDecode(Node* word32, uint32_t shift, uint32_t mask); | 373 Node* BitFieldDecode(Node* word32, uint32_t shift, uint32_t mask); |
386 | 374 |
387 // Conversions. | 375 // Conversions. |
388 Node* ChangeFloat64ToTagged(Node* value); | 376 Node* ChangeFloat64ToTagged(Node* value); |
389 Node* ChangeInt32ToTagged(Node* value); | 377 Node* ChangeInt32ToTagged(Node* value); |
390 Node* TruncateTaggedToFloat64(Node* context, Node* value); | 378 Node* TruncateTaggedToFloat64(Node* context, Node* value); |
391 Node* TruncateTaggedToWord32(Node* context, Node* value); | 379 Node* TruncateTaggedToWord32(Node* context, Node* value); |
392 | 380 |
393 // Type conversions. | |
394 // Throws a TypeError for {method_name} if {value} is not coercible to Object, | |
395 // or returns the {value} converted to a String otherwise. | |
396 Node* ToThisString(Node* context, Node* value, char const* method_name); | |
397 | |
398 // String helpers. | |
399 // Load a character from a String (might flatten a ConsString). | |
400 Node* StringCharCodeAt(Node* string, Node* smi_index); | |
401 // Return the single character string with only {code}. | |
402 Node* StringFromCharCode(Node* code); | |
403 | |
404 // Branching helpers. | 381 // Branching helpers. |
405 // TODO(danno): Can we be more cleverish wrt. edge-split? | 382 // TODO(danno): Can we be more cleverish wrt. edge-split? |
406 void BranchIf(Node* condition, Label* if_true, Label* if_false); | 383 void BranchIf(Node* condition, Label* if_true, Label* if_false); |
407 | 384 |
408 #define BRANCH_HELPER(name) \ | 385 #define BRANCH_HELPER(name) \ |
409 void BranchIf##name(Node* a, Node* b, Label* if_true, Label* if_false) { \ | 386 void BranchIf##name(Node* a, Node* b, Label* if_true, Label* if_false) { \ |
410 BranchIf(name(a, b), if_true, if_false); \ | 387 BranchIf(name(a, b), if_true, if_false); \ |
411 } | 388 } |
412 CODE_STUB_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER) | 389 CODE_STUB_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER) |
413 #undef BRANCH_HELPER | 390 #undef BRANCH_HELPER |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 // Map of variables to the list of value nodes that have been added from each | 478 // Map of variables to the list of value nodes that have been added from each |
502 // merge path in their order of merging. | 479 // merge path in their order of merging. |
503 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; | 480 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; |
504 }; | 481 }; |
505 | 482 |
506 } // namespace compiler | 483 } // namespace compiler |
507 } // namespace internal | 484 } // namespace internal |
508 } // namespace v8 | 485 } // namespace v8 |
509 | 486 |
510 #endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_ | 487 #endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |