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

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

Issue 2398423002: [regexp] Port RegExp.prototype[@@replace] (Closed)
Patch Set: Tweaks in string code-stub-assembler methods 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
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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // |length| and |offset| are expected to be tagged. 351 // |length| and |offset| are expected to be tagged.
352 compiler::Node* AllocateSlicedOneByteString(compiler::Node* length, 352 compiler::Node* AllocateSlicedOneByteString(compiler::Node* length,
353 compiler::Node* parent, 353 compiler::Node* parent,
354 compiler::Node* offset); 354 compiler::Node* offset);
355 // Allocate a SlicedTwoByteString with the given length, parent and offset. 355 // Allocate a SlicedTwoByteString with the given length, parent and offset.
356 // |length| and |offset| are expected to be tagged. 356 // |length| and |offset| are expected to be tagged.
357 compiler::Node* AllocateSlicedTwoByteString(compiler::Node* length, 357 compiler::Node* AllocateSlicedTwoByteString(compiler::Node* length,
358 compiler::Node* parent, 358 compiler::Node* parent,
359 compiler::Node* offset); 359 compiler::Node* offset);
360 360
361 // Allocate a one-byte ConsString with the given length, first and second
362 // parts. |length| is expected to be tagged, and |first| and |second| are
363 // expected to be one-byte strings.
364 compiler::Node* AllocateOneByteConsString(compiler::Node* length,
365 compiler::Node* first,
366 compiler::Node* second);
367 // Allocate a two-byte ConsString with the given length, first and second
368 // parts. |length| is expected to be tagged, and |first| and |second| are
369 // expected to be two-byte strings.
370 compiler::Node* AllocateTwoByteConsString(compiler::Node* length,
371 compiler::Node* first,
372 compiler::Node* second);
373
361 // Allocate a RegExpResult with the given length (the number of captures, 374 // Allocate a RegExpResult with the given length (the number of captures,
362 // including the match itself), index (the index where the match starts), 375 // including the match itself), index (the index where the match starts),
363 // and input string. |length| and |index| are expected to be tagged, and 376 // and input string. |length| and |index| are expected to be tagged, and
364 // |input| must be a string. 377 // |input| must be a string.
365 compiler::Node* AllocateRegExpResult(compiler::Node* context, 378 compiler::Node* AllocateRegExpResult(compiler::Node* context,
366 compiler::Node* length, 379 compiler::Node* length,
367 compiler::Node* index, 380 compiler::Node* index,
368 compiler::Node* input); 381 compiler::Node* input);
369 382
370 // Allocate a JSArray without elements and initialize the header fields. 383 // Allocate a JSArray without elements and initialize the header fields.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 // Copies |element_count| elements from |from_array| to |to_array| of 424 // Copies |element_count| elements from |from_array| to |to_array| of
412 // |capacity| size respecting both array's elements kinds. 425 // |capacity| size respecting both array's elements kinds.
413 void CopyFixedArrayElements( 426 void CopyFixedArrayElements(
414 ElementsKind from_kind, compiler::Node* from_array, ElementsKind to_kind, 427 ElementsKind from_kind, compiler::Node* from_array, ElementsKind to_kind,
415 compiler::Node* to_array, compiler::Node* element_count, 428 compiler::Node* to_array, compiler::Node* element_count,
416 compiler::Node* capacity, 429 compiler::Node* capacity,
417 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, 430 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER,
418 ParameterMode mode = INTEGER_PARAMETERS); 431 ParameterMode mode = INTEGER_PARAMETERS);
419 432
420 // Copies |character_count| elements from |from_string| to |to_string| 433 // Copies |character_count| elements from |from_string| to |to_string|
421 // starting at the |from_index|'th character. |from_index| and 434 // starting at the |from_index|'th character. |from_string| and |to_string|
422 // |character_count| must be Smis s.t. 435 // must be either both one-byte strings or both two-byte strings.
423 // 0 <= |from_index| <= |from_index| + |character_count| < from_string.length. 436 // |from_index|, |to_index| and |character_count| must be Smis s.t.
437 // 0 <= |from_index| <= |from_index| + |character_count| <= from_string.length
438 // and
439 // 0 <= |to_index| <= |to_index| + |character_count| <= to_string.length.
424 void CopyStringCharacters(compiler::Node* from_string, 440 void CopyStringCharacters(compiler::Node* from_string,
425 compiler::Node* to_string, 441 compiler::Node* to_string,
426 compiler::Node* from_index, 442 compiler::Node* from_index,
443 compiler::Node* to_index,
427 compiler::Node* character_count, 444 compiler::Node* character_count,
428 String::Encoding encoding); 445 String::Encoding encoding);
429 446
430 // Loads an element from |array| of |from_kind| elements by given |offset| 447 // Loads an element from |array| of |from_kind| elements by given |offset|
431 // (NOTE: not index!), does a hole check if |if_hole| is provided and 448 // (NOTE: not index!), does a hole check if |if_hole| is provided and
432 // converts the value so that it becomes ready for storing to array of 449 // converts the value so that it becomes ready for storing to array of
433 // |to_kind| elements. 450 // |to_kind| elements.
434 compiler::Node* LoadElementAndPrepareForStore(compiler::Node* array, 451 compiler::Node* LoadElementAndPrepareForStore(compiler::Node* array,
435 compiler::Node* offset, 452 compiler::Node* offset,
436 ElementsKind from_kind, 453 ElementsKind from_kind,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // Load a character from a String (might flatten a ConsString). 524 // Load a character from a String (might flatten a ConsString).
508 compiler::Node* StringCharCodeAt(compiler::Node* string, 525 compiler::Node* StringCharCodeAt(compiler::Node* string,
509 compiler::Node* smi_index); 526 compiler::Node* smi_index);
510 // Return the single character string with only {code}. 527 // Return the single character string with only {code}.
511 compiler::Node* StringFromCharCode(compiler::Node* code); 528 compiler::Node* StringFromCharCode(compiler::Node* code);
512 // Return a new string object which holds a substring containing the range 529 // Return a new string object which holds a substring containing the range
513 // [from,to[ of string. |from| and |to| are expected to be tagged. 530 // [from,to[ of string. |from| and |to| are expected to be tagged.
514 compiler::Node* SubString(compiler::Node* context, compiler::Node* string, 531 compiler::Node* SubString(compiler::Node* context, compiler::Node* string,
515 compiler::Node* from, compiler::Node* to); 532 compiler::Node* from, compiler::Node* to);
516 533
534 // Return a new string object produced by concatenating |first| with |second|.
535 compiler::Node* StringConcat(compiler::Node* context, compiler::Node* first,
536 compiler::Node* second);
537
538 // Return the first index >= {from} at which {needle_char} was found in
539 // {string}, or -1 if such an index does not exist. The returned value is
540 // a Smi, {string} is expected to be a String, {needle_char} is an intptr,
541 // and {from} is expected to be tagged.
542 compiler::Node* StringIndexOfChar(compiler::Node* context,
543 compiler::Node* string,
544 compiler::Node* needle_char,
545 compiler::Node* from);
546
517 compiler::Node* StringFromCodePoint(compiler::Node* codepoint, 547 compiler::Node* StringFromCodePoint(compiler::Node* codepoint,
518 UnicodeEncoding encoding); 548 UnicodeEncoding encoding);
519 549
520 // Type conversion helpers. 550 // Type conversion helpers.
521 // Convert a String to a Number. 551 // Convert a String to a Number.
522 compiler::Node* StringToNumber(compiler::Node* context, 552 compiler::Node* StringToNumber(compiler::Node* context,
523 compiler::Node* input); 553 compiler::Node* input);
524 // Convert an object to a name. 554 // Convert an object to a name.
525 compiler::Node* ToName(compiler::Node* context, compiler::Node* input); 555 compiler::Node* ToName(compiler::Node* context, compiler::Node* input);
526 // Convert a Non-Number object to a Number. 556 // Convert a Non-Number object to a Number.
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 Label* bailout); 954 Label* bailout);
925 955
926 static const int kElementLoopUnrollThreshold = 8; 956 static const int kElementLoopUnrollThreshold = 8;
927 }; 957 };
928 958
929 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); 959 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
930 960
931 } // namespace internal 961 } // namespace internal
932 } // namespace v8 962 } // namespace v8
933 #endif // V8_CODE_STUB_ASSEMBLER_H_ 963 #endif // V8_CODE_STUB_ASSEMBLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698