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

Side by Side Diff: src/code-stub-assembler.h

Issue 2355793003: [stubs] Port SubStringStub to TurboFan (Closed)
Patch Set: Address comments Created 4 years, 2 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 | « src/arm64/code-stubs-arm64.cc ('k') | src/code-stub-assembler.cc » ('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 #ifndef V8_CODE_STUB_ASSEMBLER_H_ 5 #ifndef V8_CODE_STUB_ASSEMBLER_H_
6 #define V8_CODE_STUB_ASSEMBLER_H_ 6 #define V8_CODE_STUB_ASSEMBLER_H_
7 7
8 #include <functional> 8 #include <functional>
9 9
10 #include "src/compiler/code-assembler.h" 10 #include "src/compiler/code-assembler.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 compiler::Node* SmiFromWord32(compiler::Node* value); 110 compiler::Node* SmiFromWord32(compiler::Node* value);
111 compiler::Node* SmiToWord(compiler::Node* value) { return SmiUntag(value); } 111 compiler::Node* SmiToWord(compiler::Node* value) { return SmiUntag(value); }
112 compiler::Node* SmiToWord32(compiler::Node* value); 112 compiler::Node* SmiToWord32(compiler::Node* value);
113 113
114 // Smi operations. 114 // Smi operations.
115 compiler::Node* SmiAdd(compiler::Node* a, compiler::Node* b); 115 compiler::Node* SmiAdd(compiler::Node* a, compiler::Node* b);
116 compiler::Node* SmiAddWithOverflow(compiler::Node* a, compiler::Node* b); 116 compiler::Node* SmiAddWithOverflow(compiler::Node* a, compiler::Node* b);
117 compiler::Node* SmiSub(compiler::Node* a, compiler::Node* b); 117 compiler::Node* SmiSub(compiler::Node* a, compiler::Node* b);
118 compiler::Node* SmiSubWithOverflow(compiler::Node* a, compiler::Node* b); 118 compiler::Node* SmiSubWithOverflow(compiler::Node* a, compiler::Node* b);
119 compiler::Node* SmiEqual(compiler::Node* a, compiler::Node* b); 119 compiler::Node* SmiEqual(compiler::Node* a, compiler::Node* b);
120 compiler::Node* SmiAbove(compiler::Node* a, compiler::Node* b);
120 compiler::Node* SmiAboveOrEqual(compiler::Node* a, compiler::Node* b); 121 compiler::Node* SmiAboveOrEqual(compiler::Node* a, compiler::Node* b);
122 compiler::Node* SmiBelow(compiler::Node* a, compiler::Node* b);
121 compiler::Node* SmiLessThan(compiler::Node* a, compiler::Node* b); 123 compiler::Node* SmiLessThan(compiler::Node* a, compiler::Node* b);
122 compiler::Node* SmiLessThanOrEqual(compiler::Node* a, compiler::Node* b); 124 compiler::Node* SmiLessThanOrEqual(compiler::Node* a, compiler::Node* b);
123 compiler::Node* SmiMax(compiler::Node* a, compiler::Node* b); 125 compiler::Node* SmiMax(compiler::Node* a, compiler::Node* b);
124 compiler::Node* SmiMin(compiler::Node* a, compiler::Node* b); 126 compiler::Node* SmiMin(compiler::Node* a, compiler::Node* b);
125 // Computes a % b for Smi inputs a and b; result is not necessarily a Smi. 127 // Computes a % b for Smi inputs a and b; result is not necessarily a Smi.
126 compiler::Node* SmiMod(compiler::Node* a, compiler::Node* b); 128 compiler::Node* SmiMod(compiler::Node* a, compiler::Node* b);
127 // Computes a * b for Smi inputs a and b; result is not necessarily a Smi. 129 // Computes a * b for Smi inputs a and b; result is not necessarily a Smi.
128 compiler::Node* SmiMul(compiler::Node* a, compiler::Node* b); 130 compiler::Node* SmiMul(compiler::Node* a, compiler::Node* b);
129 compiler::Node* SmiOr(compiler::Node* a, compiler::Node* b) { 131 compiler::Node* SmiOr(compiler::Node* a, compiler::Node* b) {
130 return WordOr(a, b); 132 return WordOr(a, b);
131 } 133 }
132 134
133 // Allocate an object of the given size. 135 // Allocate an object of the given size.
134 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); 136 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone);
135 compiler::Node* Allocate(int size, AllocationFlags flags = kNone); 137 compiler::Node* Allocate(int size, AllocationFlags flags = kNone);
136 compiler::Node* InnerAllocate(compiler::Node* previous, int offset); 138 compiler::Node* InnerAllocate(compiler::Node* previous, int offset);
137 compiler::Node* InnerAllocate(compiler::Node* previous, 139 compiler::Node* InnerAllocate(compiler::Node* previous,
138 compiler::Node* offset); 140 compiler::Node* offset);
139 141
140 void Assert(compiler::Node* condition); 142 void Assert(compiler::Node* condition);
141 143
142 // Check a value for smi-ness 144 // Check a value for smi-ness
143 compiler::Node* WordIsSmi(compiler::Node* a); 145 compiler::Node* WordIsSmi(compiler::Node* a);
144 // Check that the value is a positive smi. 146 // Check that the value is a non-negative smi.
145 compiler::Node* WordIsPositiveSmi(compiler::Node* a); 147 compiler::Node* WordIsPositiveSmi(compiler::Node* a);
146 148
147 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true, 149 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true,
148 Label* if_false) { 150 Label* if_false) {
149 BranchIf(SmiEqual(a, b), if_true, if_false); 151 BranchIf(SmiEqual(a, b), if_true, if_false);
150 } 152 }
151 153
152 void BranchIfSmiLessThan(compiler::Node* a, compiler::Node* b, Label* if_true, 154 void BranchIfSmiLessThan(compiler::Node* a, compiler::Node* b, Label* if_true,
153 Label* if_false) { 155 Label* if_false) {
154 BranchIf(SmiLessThan(a, b), if_true, if_false); 156 BranchIf(SmiLessThan(a, b), if_true, if_false);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value, 323 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value,
322 MutableMode mode = IMMUTABLE); 324 MutableMode mode = IMMUTABLE);
323 // Allocate a SeqOneByteString with the given length. 325 // Allocate a SeqOneByteString with the given length.
324 compiler::Node* AllocateSeqOneByteString(int length); 326 compiler::Node* AllocateSeqOneByteString(int length);
325 compiler::Node* AllocateSeqOneByteString(compiler::Node* context, 327 compiler::Node* AllocateSeqOneByteString(compiler::Node* context,
326 compiler::Node* length); 328 compiler::Node* length);
327 // Allocate a SeqTwoByteString with the given length. 329 // Allocate a SeqTwoByteString with the given length.
328 compiler::Node* AllocateSeqTwoByteString(int length); 330 compiler::Node* AllocateSeqTwoByteString(int length);
329 compiler::Node* AllocateSeqTwoByteString(compiler::Node* context, 331 compiler::Node* AllocateSeqTwoByteString(compiler::Node* context,
330 compiler::Node* length); 332 compiler::Node* length);
333
334 // Allocate a SlicedOneByteString with the given length, parent and offset.
335 // |length| and |offset| are expected to be tagged.
336 compiler::Node* AllocateSlicedOneByteString(compiler::Node* length,
337 compiler::Node* parent,
338 compiler::Node* offset);
339 // Allocate a SlicedTwoByteString with the given length, parent and offset.
340 // |length| and |offset| are expected to be tagged.
341 compiler::Node* AllocateSlicedTwoByteString(compiler::Node* length,
342 compiler::Node* parent,
343 compiler::Node* offset);
344
331 // Allocate a JSArray without elements and initialize the header fields. 345 // Allocate a JSArray without elements and initialize the header fields.
332 compiler::Node* AllocateUninitializedJSArrayWithoutElements( 346 compiler::Node* AllocateUninitializedJSArrayWithoutElements(
333 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, 347 ElementsKind kind, compiler::Node* array_map, compiler::Node* length,
334 compiler::Node* allocation_site); 348 compiler::Node* allocation_site);
335 // Allocate and return a JSArray with initialized header fields and its 349 // Allocate and return a JSArray with initialized header fields and its
336 // uninitialized elements. 350 // uninitialized elements.
337 // The ParameterMode argument is only used for the capacity parameter. 351 // The ParameterMode argument is only used for the capacity parameter.
338 std::pair<compiler::Node*, compiler::Node*> 352 std::pair<compiler::Node*, compiler::Node*>
339 AllocateUninitializedJSArrayWithElements( 353 AllocateUninitializedJSArrayWithElements(
340 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, 354 ElementsKind kind, compiler::Node* array_map, compiler::Node* length,
(...skipping 30 matching lines...) Expand all
371 385
372 // Copies |element_count| elements from |from_array| to |to_array| of 386 // Copies |element_count| elements from |from_array| to |to_array| of
373 // |capacity| size respecting both array's elements kinds. 387 // |capacity| size respecting both array's elements kinds.
374 void CopyFixedArrayElements( 388 void CopyFixedArrayElements(
375 ElementsKind from_kind, compiler::Node* from_array, ElementsKind to_kind, 389 ElementsKind from_kind, compiler::Node* from_array, ElementsKind to_kind,
376 compiler::Node* to_array, compiler::Node* element_count, 390 compiler::Node* to_array, compiler::Node* element_count,
377 compiler::Node* capacity, 391 compiler::Node* capacity,
378 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, 392 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER,
379 ParameterMode mode = INTEGER_PARAMETERS); 393 ParameterMode mode = INTEGER_PARAMETERS);
380 394
395 // Copies |character_count| elements from |from_string| to |to_string|
396 // starting at the |from_index|'th character. |from_index| and
397 // |character_count| must be Smis s.t.
398 // 0 <= |from_index| <= |from_index| + |character_count| < from_string.length.
399 void CopyStringCharacters(compiler::Node* from_string,
400 compiler::Node* to_string,
401 compiler::Node* from_index,
402 compiler::Node* character_count,
403 String::Encoding encoding);
404
381 // Loads an element from |array| of |from_kind| elements by given |offset| 405 // Loads an element from |array| of |from_kind| elements by given |offset|
382 // (NOTE: not index!), does a hole check if |if_hole| is provided and 406 // (NOTE: not index!), does a hole check if |if_hole| is provided and
383 // converts the value so that it becomes ready for storing to array of 407 // converts the value so that it becomes ready for storing to array of
384 // |to_kind| elements. 408 // |to_kind| elements.
385 compiler::Node* LoadElementAndPrepareForStore(compiler::Node* array, 409 compiler::Node* LoadElementAndPrepareForStore(compiler::Node* array,
386 compiler::Node* offset, 410 compiler::Node* offset,
387 ElementsKind from_kind, 411 ElementsKind from_kind,
388 ElementsKind to_kind, 412 ElementsKind to_kind,
389 Label* if_hole); 413 Label* if_hole);
390 414
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 compiler::Node* ToThisValue(compiler::Node* context, compiler::Node* value, 466 compiler::Node* ToThisValue(compiler::Node* context, compiler::Node* value,
443 PrimitiveType primitive_type, 467 PrimitiveType primitive_type,
444 char const* method_name); 468 char const* method_name);
445 469
446 // String helpers. 470 // String helpers.
447 // Load a character from a String (might flatten a ConsString). 471 // Load a character from a String (might flatten a ConsString).
448 compiler::Node* StringCharCodeAt(compiler::Node* string, 472 compiler::Node* StringCharCodeAt(compiler::Node* string,
449 compiler::Node* smi_index); 473 compiler::Node* smi_index);
450 // Return the single character string with only {code}. 474 // Return the single character string with only {code}.
451 compiler::Node* StringFromCharCode(compiler::Node* code); 475 compiler::Node* StringFromCharCode(compiler::Node* code);
476 // Return a new string object which holds a substring containing the range
477 // [from,to[ of string. |from| and |to| are expected to be tagged.
478 compiler::Node* SubString(compiler::Node* context, compiler::Node* string,
479 compiler::Node* from, compiler::Node* to);
452 480
453 compiler::Node* StringFromCodePoint(compiler::Node* codepoint, 481 compiler::Node* StringFromCodePoint(compiler::Node* codepoint,
454 UnicodeEncoding encoding); 482 UnicodeEncoding encoding);
455 483
456 // Type conversion helpers. 484 // Type conversion helpers.
457 // Convert a String to a Number. 485 // Convert a String to a Number.
458 compiler::Node* StringToNumber(compiler::Node* context, 486 compiler::Node* StringToNumber(compiler::Node* context,
459 compiler::Node* input); 487 compiler::Node* input);
460 // Convert an object to a name. 488 // Convert an object to a name.
461 compiler::Node* ToName(compiler::Node* context, compiler::Node* input); 489 compiler::Node* ToName(compiler::Node* context, compiler::Node* input);
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 Label* bailout); 863 Label* bailout);
836 864
837 static const int kElementLoopUnrollThreshold = 8; 865 static const int kElementLoopUnrollThreshold = 8;
838 }; 866 };
839 867
840 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); 868 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
841 869
842 } // namespace internal 870 } // namespace internal
843 } // namespace v8 871 } // namespace v8
844 #endif // V8_CODE_STUB_ASSEMBLER_H_ 872 #endif // V8_CODE_STUB_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698