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

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

Issue 1868963002: [builtins] Migrate String.prototype.charCodeAt and String.prototype.charAt to TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 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
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();
165 Node* HeapNumberMapConstant(); 166 Node* HeapNumberMapConstant();
167 Node* NaNConstant();
168 Node* NoContextConstant();
166 Node* NullConstant(); 169 Node* NullConstant();
167 Node* UndefinedConstant(); 170 Node* UndefinedConstant();
168 171
169 Node* Parameter(int value); 172 Node* Parameter(int value);
170 void Return(Node* value); 173 void Return(Node* value);
171 174
172 void Bind(Label* label); 175 void Bind(Label* label);
173 void Goto(Label* label); 176 void Goto(Label* label);
174 void GotoIf(Node* condition, Label* true_label); 177 void GotoIf(Node* condition, Label* true_label);
175 void GotoUnless(Node* condition, Label* false_label); 178 void GotoUnless(Node* condition, Label* false_label);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // Float64 operations. 274 // Float64 operations.
272 Node* Float64Ceil(Node* x); 275 Node* Float64Ceil(Node* x);
273 Node* Float64Floor(Node* x); 276 Node* Float64Floor(Node* x);
274 Node* Float64Round(Node* x); 277 Node* Float64Round(Node* x);
275 Node* Float64Trunc(Node* x); 278 Node* Float64Trunc(Node* x);
276 279
277 // Tag a Word as a Smi value. 280 // Tag a Word as a Smi value.
278 Node* SmiTag(Node* value); 281 Node* SmiTag(Node* value);
279 // Untag a Smi value as a Word. 282 // Untag a Smi value as a Word.
280 Node* SmiUntag(Node* value); 283 Node* SmiUntag(Node* value);
284 Node* SmiToWord(Node* value) { return SmiUntag(value); }
281 285
282 // Smi conversions. 286 // Smi conversions.
283 Node* SmiToFloat64(Node* value); 287 Node* SmiToFloat64(Node* value);
288 Node* SmiFromWord32(Node* value);
284 Node* SmiToWord32(Node* value); 289 Node* SmiToWord32(Node* value);
285 290
286 // Smi operations. 291 // Smi operations.
287 Node* SmiAdd(Node* a, Node* b); 292 Node* SmiAdd(Node* a, Node* b);
288 Node* SmiAddWithOverflow(Node* a, Node* b); 293 Node* SmiAddWithOverflow(Node* a, Node* b);
289 Node* SmiSub(Node* a, Node* b); 294 Node* SmiSub(Node* a, Node* b);
290 Node* SmiSubWithOverflow(Node* a, Node* b); 295 Node* SmiSubWithOverflow(Node* a, Node* b);
291 Node* SmiEqual(Node* a, Node* b); 296 Node* SmiEqual(Node* a, Node* b);
297 Node* SmiAboveOrEqual(Node* a, Node* b);
292 Node* SmiLessThan(Node* a, Node* b); 298 Node* SmiLessThan(Node* a, Node* b);
293 Node* SmiLessThanOrEqual(Node* a, Node* b); 299 Node* SmiLessThanOrEqual(Node* a, Node* b);
294 Node* SmiMin(Node* a, Node* b); 300 Node* SmiMin(Node* a, Node* b);
295 301
296 // Load a value from the root array. 302 // Load a value from the root array.
297 Node* LoadRoot(Heap::RootListIndex root_index); 303 Node* LoadRoot(Heap::RootListIndex root_index);
298 304
299 // Check a value for smi-ness 305 // Check a value for smi-ness
300 Node* WordIsSmi(Node* a); 306 Node* WordIsSmi(Node* a);
301 307
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 342
337 // Load an array element from a FixedArray. 343 // Load an array element from a FixedArray.
338 Node* LoadFixedArrayElementInt32Index(Node* object, Node* int32_index, 344 Node* LoadFixedArrayElementInt32Index(Node* object, Node* int32_index,
339 int additional_offset = 0); 345 int additional_offset = 0);
340 Node* LoadFixedArrayElementSmiIndex(Node* object, Node* smi_index, 346 Node* LoadFixedArrayElementSmiIndex(Node* object, Node* smi_index,
341 int additional_offset = 0); 347 int additional_offset = 0);
342 Node* LoadFixedArrayElementConstantIndex(Node* object, int index); 348 Node* LoadFixedArrayElementConstantIndex(Node* object, int index);
343 349
344 // Allocate an object of the given size. 350 // Allocate an object of the given size.
345 Node* Allocate(int size, AllocationFlags flags = kNone); 351 Node* Allocate(int size, AllocationFlags flags = kNone);
352 Node* InnerAllocate(Node* previous, int offset);
346 // Allocate a HeapNumber without initializing its value. 353 // Allocate a HeapNumber without initializing its value.
347 Node* AllocateHeapNumber(); 354 Node* AllocateHeapNumber();
348 // Allocate a HeapNumber with a specific value. 355 // Allocate a HeapNumber with a specific value.
349 Node* AllocateHeapNumberWithValue(Node* value); 356 Node* AllocateHeapNumberWithValue(Node* value);
350 Node* InnerAllocate(Node* previous, int offset); 357 // Allocate a SeqOneByteString with the given length.
358 Node* AllocateSeqOneByteString(int length);
359 // Allocate a SeqTwoByteString with the given length.
360 Node* AllocateSeqTwoByteString(int length);
351 361
352 // Store an array element to a FixedArray. 362 // Store an array element to a FixedArray.
363 Node* StoreFixedArrayElementInt32Index(Node* object, Node* index,
364 Node* value);
353 Node* StoreFixedArrayElementNoWriteBarrier(Node* object, Node* index, 365 Node* StoreFixedArrayElementNoWriteBarrier(Node* object, Node* index,
354 Node* value); 366 Node* value);
355 // Load the Map of an HeapObject. 367 // Load the Map of an HeapObject.
356 Node* LoadMap(Node* object); 368 Node* LoadMap(Node* object);
357 // Store the Map of an HeapObject. 369 // Store the Map of an HeapObject.
358 Node* StoreMapNoWriteBarrier(Node* object, Node* map); 370 Node* StoreMapNoWriteBarrier(Node* object, Node* map);
359 // Load the instance type of an HeapObject. 371 // Load the instance type of an HeapObject.
360 Node* LoadInstanceType(Node* object); 372 Node* LoadInstanceType(Node* object);
361 373
362 // Load the elements backing store of a JSObject. 374 // Load the elements backing store of a JSObject.
363 Node* LoadElements(Node* object); 375 Node* LoadElements(Node* object);
364 // Load the length of a fixed array base instance. 376 // Load the length of a fixed array base instance.
365 Node* LoadFixedArrayBaseLength(Node* array); 377 Node* LoadFixedArrayBaseLength(Node* array);
366 378
367 // Returns a node that is true if the given bit is set in |word32|. 379 // Returns a node that is true if the given bit is set in |word32|.
368 template <typename T> 380 template <typename T>
369 Node* BitFieldDecode(Node* word32) { 381 Node* BitFieldDecode(Node* word32) {
370 return BitFieldDecode(word32, T::kShift, T::kMask); 382 return BitFieldDecode(word32, T::kShift, T::kMask);
371 } 383 }
372 384
373 Node* BitFieldDecode(Node* word32, uint32_t shift, uint32_t mask); 385 Node* BitFieldDecode(Node* word32, uint32_t shift, uint32_t mask);
374 386
375 // Conversions. 387 // Conversions.
376 Node* ChangeFloat64ToTagged(Node* value); 388 Node* ChangeFloat64ToTagged(Node* value);
377 Node* ChangeInt32ToTagged(Node* value); 389 Node* ChangeInt32ToTagged(Node* value);
378 Node* TruncateTaggedToFloat64(Node* context, Node* value); 390 Node* TruncateTaggedToFloat64(Node* context, Node* value);
379 Node* TruncateTaggedToWord32(Node* context, Node* value); 391 Node* TruncateTaggedToWord32(Node* context, Node* value);
380 392
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
381 // Branching helpers. 404 // Branching helpers.
382 // TODO(danno): Can we be more cleverish wrt. edge-split? 405 // TODO(danno): Can we be more cleverish wrt. edge-split?
383 void BranchIf(Node* condition, Label* if_true, Label* if_false); 406 void BranchIf(Node* condition, Label* if_true, Label* if_false);
384 407
385 #define BRANCH_HELPER(name) \ 408 #define BRANCH_HELPER(name) \
386 void BranchIf##name(Node* a, Node* b, Label* if_true, Label* if_false) { \ 409 void BranchIf##name(Node* a, Node* b, Label* if_true, Label* if_false) { \
387 BranchIf(name(a, b), if_true, if_false); \ 410 BranchIf(name(a, b), if_true, if_false); \
388 } 411 }
389 CODE_STUB_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER) 412 CODE_STUB_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER)
390 #undef BRANCH_HELPER 413 #undef BRANCH_HELPER
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // Map of variables to the list of value nodes that have been added from each 501 // Map of variables to the list of value nodes that have been added from each
479 // merge path in their order of merging. 502 // merge path in their order of merging.
480 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; 503 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_;
481 }; 504 };
482 505
483 } // namespace compiler 506 } // namespace compiler
484 } // namespace internal 507 } // namespace internal
485 } // namespace v8 508 } // namespace v8
486 509
487 #endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_ 510 #endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698