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

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

Issue 1904933002: Introduce bytecodes for assisting generator suspend and resume. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Nix 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
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/compiler/bytecode-graph-builder.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 #include "src/code-stub-assembler.h" 5 #include "src/code-stub-assembler.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 10
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 Bind(&doesnt_need_filler); 398 Bind(&doesnt_need_filler);
399 Goto(&merge_address); 399 Goto(&merge_address);
400 400
401 Bind(&merge_address); 401 Bind(&merge_address);
402 // Update the top. 402 // Update the top.
403 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, 403 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address,
404 IntPtrAdd(top, adjusted_size.value())); 404 IntPtrAdd(top, adjusted_size.value()));
405 return address.value(); 405 return address.value();
406 } 406 }
407 407
408 Node* CodeStubAssembler::Allocate(int size_in_bytes, AllocationFlags flags) { 408 Node* CodeStubAssembler::Allocate(Node* size_in_bytes, AllocationFlags flags) {
409 bool const new_space = !(flags & kPretenured); 409 bool const new_space = !(flags & kPretenured);
410 Node* top_address = ExternalConstant( 410 Node* top_address = ExternalConstant(
411 new_space 411 new_space
412 ? ExternalReference::new_space_allocation_top_address(isolate()) 412 ? ExternalReference::new_space_allocation_top_address(isolate())
413 : ExternalReference::old_space_allocation_top_address(isolate())); 413 : ExternalReference::old_space_allocation_top_address(isolate()));
414 Node* limit_address = ExternalConstant( 414 Node* limit_address = ExternalConstant(
415 new_space 415 new_space
416 ? ExternalReference::new_space_allocation_limit_address(isolate()) 416 ? ExternalReference::new_space_allocation_limit_address(isolate())
417 : ExternalReference::old_space_allocation_limit_address(isolate())); 417 : ExternalReference::old_space_allocation_limit_address(isolate()));
418 418
419 #ifdef V8_HOST_ARCH_32_BIT 419 #ifdef V8_HOST_ARCH_32_BIT
420 if (flags & kDoubleAlignment) { 420 if (flags & kDoubleAlignment) {
421 return AllocateRawAligned(IntPtrConstant(size_in_bytes), flags, top_address, 421 return AllocateRawAligned(size_in_bytes, flags, top_address, limit_address);
422 limit_address);
423 } 422 }
424 #endif 423 #endif
425 424
426 return AllocateRawUnaligned(IntPtrConstant(size_in_bytes), flags, top_address, 425 return AllocateRawUnaligned(size_in_bytes, flags, top_address, limit_address);
427 limit_address); 426 }
427
428 Node* CodeStubAssembler::Allocate(int size_in_bytes, AllocationFlags flags) {
429 return CodeStubAssembler::Allocate(IntPtrConstant(size_in_bytes), flags);
428 } 430 }
429 431
430 Node* CodeStubAssembler::InnerAllocate(Node* previous, int offset) { 432 Node* CodeStubAssembler::InnerAllocate(Node* previous, int offset) {
431 return IntPtrAdd(previous, IntPtrConstant(offset)); 433 return IntPtrAdd(previous, IntPtrConstant(offset));
432 } 434 }
433 435
434 Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset, 436 Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset,
435 MachineType rep) { 437 MachineType rep) {
436 return Load(rep, buffer, IntPtrConstant(offset)); 438 return Load(rep, buffer, IntPtrConstant(offset));
437 } 439 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 486
485 Node* CodeStubAssembler::LoadMapDescriptors(Node* map) { 487 Node* CodeStubAssembler::LoadMapDescriptors(Node* map) {
486 return LoadObjectField(map, Map::kDescriptorsOffset); 488 return LoadObjectField(map, Map::kDescriptorsOffset);
487 } 489 }
488 490
489 Node* CodeStubAssembler::LoadNameHash(Node* name) { 491 Node* CodeStubAssembler::LoadNameHash(Node* name) {
490 return Load(MachineType::Uint32(), name, 492 return Load(MachineType::Uint32(), name,
491 IntPtrConstant(Name::kHashFieldOffset - kHeapObjectTag)); 493 IntPtrConstant(Name::kHashFieldOffset - kHeapObjectTag));
492 } 494 }
493 495
496 Node* CodeStubAssembler::AllocateUninitializedFixedArray(Node* length) {
497 Node* header_size = IntPtrConstant(FixedArray::kHeaderSize);
498 Node* data_size = WordShl(length, IntPtrConstant(kPointerSizeLog2));
499 Node* total_size = IntPtrAdd(data_size, header_size);
500
501 Node* result = Allocate(total_size, kNone);
502 StoreMapNoWriteBarrier(result, LoadRoot(Heap::kFixedArrayMapRootIndex));
503 StoreObjectFieldNoWriteBarrier(result, FixedArray::kLengthOffset,
504 SmiTag(length));
505
506 return result;
507 }
508
494 Node* CodeStubAssembler::LoadFixedArrayElementInt32Index( 509 Node* CodeStubAssembler::LoadFixedArrayElementInt32Index(
495 Node* object, Node* index, int additional_offset) { 510 Node* object, Node* index, int additional_offset) {
496 Node* header_size = IntPtrConstant(additional_offset + 511 Node* header_size = IntPtrConstant(additional_offset +
497 FixedArray::kHeaderSize - kHeapObjectTag); 512 FixedArray::kHeaderSize - kHeapObjectTag);
498 if (Is64()) { 513 if (Is64()) {
499 index = ChangeInt32ToInt64(index); 514 index = ChangeInt32ToInt64(index);
500 } 515 }
501 Node* scaled_index = WordShl(index, IntPtrConstant(kPointerSizeLog2)); 516 Node* scaled_index = WordShl(index, IntPtrConstant(kPointerSizeLog2));
502 Node* offset = IntPtrAdd(scaled_index, header_size); 517 Node* offset = IntPtrAdd(scaled_index, header_size);
503 return Load(MachineType::AnyTagged(), object, offset); 518 return Load(MachineType::AnyTagged(), object, offset);
(...skipping 25 matching lines...) Expand all
529 index * kPointerSize); 544 index * kPointerSize);
530 return Load(MachineType::AnyTagged(), object, offset); 545 return Load(MachineType::AnyTagged(), object, offset);
531 } 546 }
532 547
533 Node* CodeStubAssembler::StoreHeapNumberValue(Node* object, Node* value) { 548 Node* CodeStubAssembler::StoreHeapNumberValue(Node* object, Node* value) {
534 return StoreNoWriteBarrier( 549 return StoreNoWriteBarrier(
535 MachineRepresentation::kFloat64, object, 550 MachineRepresentation::kFloat64, object,
536 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag), value); 551 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag), value);
537 } 552 }
538 553
554 Node* CodeStubAssembler::StoreObjectField(
555 Node* object, int offset, Node* value) {
556 return Store(MachineRepresentation::kTagged, object,
557 IntPtrConstant(offset - kHeapObjectTag), value);
558 }
559
539 Node* CodeStubAssembler::StoreObjectFieldNoWriteBarrier( 560 Node* CodeStubAssembler::StoreObjectFieldNoWriteBarrier(
540 Node* object, int offset, Node* value, MachineRepresentation rep) { 561 Node* object, int offset, Node* value, MachineRepresentation rep) {
541 return StoreNoWriteBarrier(rep, object, 562 return StoreNoWriteBarrier(rep, object,
542 IntPtrConstant(offset - kHeapObjectTag), value); 563 IntPtrConstant(offset - kHeapObjectTag), value);
543 } 564 }
544 565
545 Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { 566 Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) {
546 return StoreNoWriteBarrier( 567 return StoreNoWriteBarrier(
547 MachineRepresentation::kTagged, object, 568 MachineRepresentation::kTagged, object,
548 IntPtrConstant(HeapNumber::kMapOffset - kHeapObjectTag), map); 569 IntPtrConstant(HeapNumber::kMapOffset - kHeapObjectTag), map);
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 } 1144 }
1124 1145
1125 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, 1146 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift,
1126 uint32_t mask) { 1147 uint32_t mask) {
1127 return Word32Shr(Word32And(word32, Int32Constant(mask)), 1148 return Word32Shr(Word32And(word32, Int32Constant(mask)),
1128 Int32Constant(shift)); 1149 Int32Constant(shift));
1129 } 1150 }
1130 1151
1131 } // namespace internal 1152 } // namespace internal
1132 } // namespace v8 1153 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698