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

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: Fix typo 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // Constants. 159 // Constants.
160 Node* Int32Constant(int value); 160 Node* Int32Constant(int value);
161 Node* IntPtrConstant(intptr_t value); 161 Node* IntPtrConstant(intptr_t value);
162 Node* NumberConstant(double value); 162 Node* NumberConstant(double value);
163 Node* SmiConstant(Smi* value); 163 Node* SmiConstant(Smi* value);
164 Node* HeapConstant(Handle<HeapObject> object); 164 Node* HeapConstant(Handle<HeapObject> object);
165 Node* BooleanConstant(bool value); 165 Node* BooleanConstant(bool value);
166 Node* ExternalConstant(ExternalReference address); 166 Node* ExternalConstant(ExternalReference address);
167 Node* Float64Constant(double value); 167 Node* Float64Constant(double value);
168 Node* BooleanMapConstant(); 168 Node* BooleanMapConstant();
169 Node* EmptyStringConstant();
169 Node* HeapNumberMapConstant(); 170 Node* HeapNumberMapConstant();
171 Node* NaNConstant();
172 Node* NoContextConstant();
170 Node* NullConstant(); 173 Node* NullConstant();
171 Node* UndefinedConstant(); 174 Node* UndefinedConstant();
172 175
173 Node* Parameter(int value); 176 Node* Parameter(int value);
174 void Return(Node* value); 177 void Return(Node* value);
175 178
176 void Bind(Label* label); 179 void Bind(Label* label);
177 void Goto(Label* label); 180 void Goto(Label* label);
178 void GotoIf(Node* condition, Label* true_label); 181 void GotoIf(Node* condition, Label* true_label);
179 void GotoUnless(Node* condition, Label* false_label); 182 void GotoUnless(Node* condition, Label* false_label);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // Float64 operations. 278 // Float64 operations.
276 Node* Float64Ceil(Node* x); 279 Node* Float64Ceil(Node* x);
277 Node* Float64Floor(Node* x); 280 Node* Float64Floor(Node* x);
278 Node* Float64Round(Node* x); 281 Node* Float64Round(Node* x);
279 Node* Float64Trunc(Node* x); 282 Node* Float64Trunc(Node* x);
280 283
281 // Tag a Word as a Smi value. 284 // Tag a Word as a Smi value.
282 Node* SmiTag(Node* value); 285 Node* SmiTag(Node* value);
283 // Untag a Smi value as a Word. 286 // Untag a Smi value as a Word.
284 Node* SmiUntag(Node* value); 287 Node* SmiUntag(Node* value);
288 Node* SmiToWord(Node* value) { return SmiUntag(value); }
285 289
286 // Smi conversions. 290 // Smi conversions.
287 Node* SmiToFloat64(Node* value); 291 Node* SmiToFloat64(Node* value);
292 Node* SmiFromWord32(Node* value);
288 Node* SmiToWord32(Node* value); 293 Node* SmiToWord32(Node* value);
289 294
290 // Smi operations. 295 // Smi operations.
291 Node* SmiAdd(Node* a, Node* b); 296 Node* SmiAdd(Node* a, Node* b);
292 Node* SmiAddWithOverflow(Node* a, Node* b); 297 Node* SmiAddWithOverflow(Node* a, Node* b);
293 Node* SmiSub(Node* a, Node* b); 298 Node* SmiSub(Node* a, Node* b);
294 Node* SmiSubWithOverflow(Node* a, Node* b); 299 Node* SmiSubWithOverflow(Node* a, Node* b);
295 Node* SmiEqual(Node* a, Node* b); 300 Node* SmiEqual(Node* a, Node* b);
301 Node* SmiAboveOrEqual(Node* a, Node* b);
296 Node* SmiLessThan(Node* a, Node* b); 302 Node* SmiLessThan(Node* a, Node* b);
297 Node* SmiLessThanOrEqual(Node* a, Node* b); 303 Node* SmiLessThanOrEqual(Node* a, Node* b);
298 Node* SmiMin(Node* a, Node* b); 304 Node* SmiMin(Node* a, Node* b);
299 305
300 // Load a value from the root array. 306 // Load a value from the root array.
301 Node* LoadRoot(Heap::RootListIndex root_index); 307 Node* LoadRoot(Heap::RootListIndex root_index);
302 308
303 // Check a value for smi-ness 309 // Check a value for smi-ness
304 Node* WordIsSmi(Node* a); 310 Node* WordIsSmi(Node* a);
305 311
306 // Check that the value is a positive smi. 312 // Check that the value is a positive smi.
307 Node* WordIsPositiveSmi(Node* a); 313 Node* WordIsPositiveSmi(Node* a);
308 314
309 // Load an object pointer from a buffer that isn't in the heap. 315 // Load an object pointer from a buffer that isn't in the heap.
310 Node* LoadBufferObject(Node* buffer, int offset, 316 Node* LoadBufferObject(Node* buffer, int offset,
311 MachineType rep = MachineType::AnyTagged()); 317 MachineType rep = MachineType::AnyTagged());
312 // Load a field from an object on the heap. 318 // Load a field from an object on the heap.
313 Node* LoadObjectField(Node* object, int offset, 319 Node* LoadObjectField(Node* object, int offset,
314 MachineType rep = MachineType::AnyTagged()); 320 MachineType rep = MachineType::AnyTagged());
321 // Store a field to an object on the heap.
322 Node* StoreObjectFieldNoWriteBarrier(
323 Node* object, int offset, Node* value,
324 MachineRepresentation rep = MachineRepresentation::kTagged);
315 // Load the floating point value of a HeapNumber. 325 // Load the floating point value of a HeapNumber.
316 Node* LoadHeapNumberValue(Node* object); 326 Node* LoadHeapNumberValue(Node* object);
317 // Store the floating point value of a HeapNumber. 327 // Store the floating point value of a HeapNumber.
318 Node* StoreHeapNumberValue(Node* object, Node* value); 328 Node* StoreHeapNumberValue(Node* object, Node* value);
319 // Truncate the floating point value of a HeapNumber to an Int32. 329 // Truncate the floating point value of a HeapNumber to an Int32.
320 Node* TruncateHeapNumberValueToWord32(Node* object); 330 Node* TruncateHeapNumberValueToWord32(Node* object);
321 // Load the bit field of a Map. 331 // Load the bit field of a Map.
322 Node* LoadMapBitField(Node* map); 332 Node* LoadMapBitField(Node* map);
323 // Load bit field 2 of a map. 333 // Load bit field 2 of a map.
324 Node* LoadMapBitField2(Node* map); 334 Node* LoadMapBitField2(Node* map);
325 // Load bit field 3 of a map. 335 // Load bit field 3 of a map.
326 Node* LoadMapBitField3(Node* map); 336 Node* LoadMapBitField3(Node* map);
327 // Load the instance type of a map. 337 // Load the instance type of a map.
328 Node* LoadMapInstanceType(Node* map); 338 Node* LoadMapInstanceType(Node* map);
329 // Load the instance descriptors of a map. 339 // Load the instance descriptors of a map.
330 Node* LoadMapDescriptors(Node* map); 340 Node* LoadMapDescriptors(Node* map);
331 341
332 // Load the hash field of a name. 342 // Load the hash field of a name.
333 Node* LoadNameHash(Node* name); 343 Node* LoadNameHash(Node* name);
334 344
335 // Load an array element from a FixedArray. 345 // Load an array element from a FixedArray.
336 Node* LoadFixedArrayElementInt32Index(Node* object, Node* int32_index, 346 Node* LoadFixedArrayElementInt32Index(Node* object, Node* int32_index,
337 int additional_offset = 0); 347 int additional_offset = 0);
338 Node* LoadFixedArrayElementSmiIndex(Node* object, Node* smi_index, 348 Node* LoadFixedArrayElementSmiIndex(Node* object, Node* smi_index,
339 int additional_offset = 0); 349 int additional_offset = 0);
340 Node* LoadFixedArrayElementConstantIndex(Node* object, int index); 350 Node* LoadFixedArrayElementConstantIndex(Node* object, int index);
341 351
342 // Allocate an object of the given size. 352 // Allocate an object of the given size.
343 Node* Allocate(int size, AllocationFlags flags = kNone); 353 Node* Allocate(int size, AllocationFlags flags = kNone);
354 Node* InnerAllocate(Node* previous, int offset);
344 // Allocate a HeapNumber without initializing its value. 355 // Allocate a HeapNumber without initializing its value.
345 Node* AllocateHeapNumber(); 356 Node* AllocateHeapNumber();
346 // Allocate a HeapNumber with a specific value. 357 // Allocate a HeapNumber with a specific value.
347 Node* AllocateHeapNumberWithValue(Node* value); 358 Node* AllocateHeapNumberWithValue(Node* value);
359 // Allocate a SeqOneByteString with the given length.
360 Node* AllocateSeqOneByteString(int length);
361 // Allocate a SeqTwoByteString with the given length.
362 Node* AllocateSeqTwoByteString(int length);
348 363
349 // Store an array element to a FixedArray. 364 // Store an array element to a FixedArray.
365 Node* StoreFixedArrayElementInt32Index(Node* object, Node* index,
366 Node* value);
350 Node* StoreFixedArrayElementNoWriteBarrier(Node* object, Node* index, 367 Node* StoreFixedArrayElementNoWriteBarrier(Node* object, Node* index,
351 Node* value); 368 Node* value);
352 // Load the Map of an HeapObject. 369 // Load the Map of an HeapObject.
353 Node* LoadMap(Node* object); 370 Node* LoadMap(Node* object);
354 // Store the Map of an HeapObject. 371 // Store the Map of an HeapObject.
355 Node* StoreMapNoWriteBarrier(Node* object, Node* map); 372 Node* StoreMapNoWriteBarrier(Node* object, Node* map);
356 // Load the instance type of an HeapObject. 373 // Load the instance type of an HeapObject.
357 Node* LoadInstanceType(Node* object); 374 Node* LoadInstanceType(Node* object);
358 375
359 // Load the elements backing store of a JSObject. 376 // Load the elements backing store of a JSObject.
360 Node* LoadElements(Node* object); 377 Node* LoadElements(Node* object);
361 // Load the length of a fixed array base instance. 378 // Load the length of a fixed array base instance.
362 Node* LoadFixedArrayBaseLength(Node* array); 379 Node* LoadFixedArrayBaseLength(Node* array);
363 380
364 // Returns a node that is true if the given bit is set in |word32|. 381 // Returns a node that is true if the given bit is set in |word32|.
365 template <typename T> 382 template <typename T>
366 Node* BitFieldDecode(Node* word32) { 383 Node* BitFieldDecode(Node* word32) {
367 return BitFieldDecode(word32, T::kShift, T::kMask); 384 return BitFieldDecode(word32, T::kShift, T::kMask);
368 } 385 }
369 386
370 Node* BitFieldDecode(Node* word32, uint32_t shift, uint32_t mask); 387 Node* BitFieldDecode(Node* word32, uint32_t shift, uint32_t mask);
371 388
372 // Conversions. 389 // Conversions.
373 Node* ChangeFloat64ToTagged(Node* value); 390 Node* ChangeFloat64ToTagged(Node* value);
374 Node* ChangeInt32ToTagged(Node* value); 391 Node* ChangeInt32ToTagged(Node* value);
375 Node* TruncateTaggedToFloat64(Node* context, Node* value); 392 Node* TruncateTaggedToFloat64(Node* context, Node* value);
376 Node* TruncateTaggedToWord32(Node* context, Node* value); 393 Node* TruncateTaggedToWord32(Node* context, Node* value);
377 394
395 // Type conversions.
396 // Throws a TypeError for {method_name} if {value} is not coercible to Object,
397 // or returns the {value} converted to a String otherwise.
398 Node* ToThisString(Node* context, Node* value, char const* method_name);
399
400 // String helpers.
401 // Load a character from a String (might flatten a ConsString).
402 Node* StringCharCodeAt(Node* string, Node* smi_index);
403 // Return the single character string with only {code}.
404 Node* StringFromCharCode(Node* code);
405
378 // Branching helpers. 406 // Branching helpers.
379 // TODO(danno): Can we be more cleverish wrt. edge-split? 407 // TODO(danno): Can we be more cleverish wrt. edge-split?
380 void BranchIf(Node* condition, Label* if_true, Label* if_false); 408 void BranchIf(Node* condition, Label* if_true, Label* if_false);
381 409
382 #define BRANCH_HELPER(name) \ 410 #define BRANCH_HELPER(name) \
383 void BranchIf##name(Node* a, Node* b, Label* if_true, Label* if_false) { \ 411 void BranchIf##name(Node* a, Node* b, Label* if_true, Label* if_false) { \
384 BranchIf(name(a, b), if_true, if_false); \ 412 BranchIf(name(a, b), if_true, if_false); \
385 } 413 }
386 CODE_STUB_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER) 414 CODE_STUB_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER)
387 #undef BRANCH_HELPER 415 #undef BRANCH_HELPER
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 // Map of variables to the list of value nodes that have been added from each 503 // Map of variables to the list of value nodes that have been added from each
476 // merge path in their order of merging. 504 // merge path in their order of merging.
477 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; 505 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_;
478 }; 506 };
479 507
480 } // namespace compiler 508 } // namespace compiler
481 } // namespace internal 509 } // namespace internal
482 } // namespace v8 510 } // namespace v8
483 511
484 #endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_ 512 #endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698