OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 | 6 |
7 #include "src/compiler/type-cache.h" | 7 #include "src/compiler/type-cache.h" |
8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
9 #include "src/frames.h" | 9 #include "src/frames.h" |
10 #include "src/handles-inl.h" | 10 #include "src/handles-inl.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 MachineType::Uint32(), kNoWriteBarrier}; | 223 MachineType::Uint32(), kNoWriteBarrier}; |
224 return access; | 224 return access; |
225 } | 225 } |
226 | 226 |
227 // static | 227 // static |
228 FieldAccess AccessBuilder::ForJSArrayBufferViewBuffer() { | 228 FieldAccess AccessBuilder::ForJSArrayBufferViewBuffer() { |
229 FieldAccess access = {kTaggedBase, | 229 FieldAccess access = {kTaggedBase, |
230 JSArrayBufferView::kBufferOffset, | 230 JSArrayBufferView::kBufferOffset, |
231 MaybeHandle<Name>(), | 231 MaybeHandle<Name>(), |
232 Type::TaggedPointer(), | 232 Type::TaggedPointer(), |
233 MachineType::AnyTagged(), | 233 MachineType::TaggedPointer(), |
234 kPointerWriteBarrier}; | 234 kPointerWriteBarrier}; |
235 return access; | 235 return access; |
236 } | 236 } |
237 | 237 |
238 // static | 238 // static |
239 FieldAccess AccessBuilder::ForJSArrayBufferViewByteLength() { | 239 FieldAccess AccessBuilder::ForJSArrayBufferViewByteLength() { |
240 FieldAccess access = {kTaggedBase, | 240 FieldAccess access = {kTaggedBase, |
241 JSArrayBufferView::kByteLengthOffset, | 241 JSArrayBufferView::kByteLengthOffset, |
242 MaybeHandle<Name>(), | 242 MaybeHandle<Name>(), |
243 TypeCache::Get().kPositiveInteger, | 243 TypeCache::Get().kPositiveInteger, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 kNoWriteBarrier}; | 359 kNoWriteBarrier}; |
360 return access; | 360 return access; |
361 } | 361 } |
362 | 362 |
363 // static | 363 // static |
364 FieldAccess AccessBuilder::ForDescriptorArrayEnumCache() { | 364 FieldAccess AccessBuilder::ForDescriptorArrayEnumCache() { |
365 FieldAccess access = {kTaggedBase, | 365 FieldAccess access = {kTaggedBase, |
366 DescriptorArray::kEnumCacheOffset, | 366 DescriptorArray::kEnumCacheOffset, |
367 Handle<Name>(), | 367 Handle<Name>(), |
368 Type::TaggedPointer(), | 368 Type::TaggedPointer(), |
369 MachineType::AnyTagged(), | 369 MachineType::TaggedPointer(), |
370 kPointerWriteBarrier}; | 370 kPointerWriteBarrier}; |
371 return access; | 371 return access; |
372 } | 372 } |
373 | 373 |
374 | 374 |
375 // static | 375 // static |
376 FieldAccess AccessBuilder::ForDescriptorArrayEnumCacheBridgeCache() { | 376 FieldAccess AccessBuilder::ForDescriptorArrayEnumCacheBridgeCache() { |
377 FieldAccess access = {kTaggedBase, | 377 FieldAccess access = {kTaggedBase, |
378 DescriptorArray::kEnumCacheBridgeCacheOffset, | 378 DescriptorArray::kEnumCacheBridgeCacheOffset, |
379 Handle<Name>(), | 379 Handle<Name>(), |
380 Type::TaggedPointer(), | 380 Type::TaggedPointer(), |
381 MachineType::AnyTagged(), | 381 MachineType::TaggedPointer(), |
382 kPointerWriteBarrier}; | 382 kPointerWriteBarrier}; |
383 return access; | 383 return access; |
384 } | 384 } |
385 | 385 |
386 | 386 |
387 // static | 387 // static |
388 FieldAccess AccessBuilder::ForMapBitField() { | 388 FieldAccess AccessBuilder::ForMapBitField() { |
389 FieldAccess access = {kTaggedBase, Map::kBitFieldOffset, | 389 FieldAccess access = {kTaggedBase, Map::kBitFieldOffset, |
390 Handle<Name>(), TypeCache::Get().kUint8, | 390 Handle<Name>(), TypeCache::Get().kUint8, |
391 MachineType::Uint8(), kNoWriteBarrier}; | 391 MachineType::Uint8(), kNoWriteBarrier}; |
392 return access; | 392 return access; |
393 } | 393 } |
394 | 394 |
395 | 395 |
396 // static | 396 // static |
397 FieldAccess AccessBuilder::ForMapBitField3() { | 397 FieldAccess AccessBuilder::ForMapBitField3() { |
398 FieldAccess access = {kTaggedBase, Map::kBitField3Offset, | 398 FieldAccess access = {kTaggedBase, Map::kBitField3Offset, |
399 Handle<Name>(), TypeCache::Get().kInt32, | 399 Handle<Name>(), TypeCache::Get().kInt32, |
400 MachineType::Int32(), kNoWriteBarrier}; | 400 MachineType::Int32(), kNoWriteBarrier}; |
401 return access; | 401 return access; |
402 } | 402 } |
403 | 403 |
404 | 404 |
405 // static | 405 // static |
406 FieldAccess AccessBuilder::ForMapDescriptors() { | 406 FieldAccess AccessBuilder::ForMapDescriptors() { |
407 FieldAccess access = { | 407 FieldAccess access = {kTaggedBase, |
408 kTaggedBase, Map::kDescriptorsOffset, Handle<Name>(), | 408 Map::kDescriptorsOffset, |
409 Type::TaggedPointer(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 409 Handle<Name>(), |
| 410 Type::TaggedPointer(), |
| 411 MachineType::TaggedPointer(), |
| 412 kPointerWriteBarrier}; |
410 return access; | 413 return access; |
411 } | 414 } |
412 | 415 |
413 | 416 |
414 // static | 417 // static |
415 FieldAccess AccessBuilder::ForMapInstanceType() { | 418 FieldAccess AccessBuilder::ForMapInstanceType() { |
416 FieldAccess access = {kTaggedBase, Map::kInstanceTypeOffset, | 419 FieldAccess access = {kTaggedBase, Map::kInstanceTypeOffset, |
417 Handle<Name>(), TypeCache::Get().kUint8, | 420 Handle<Name>(), TypeCache::Get().kUint8, |
418 MachineType::Uint8(), kNoWriteBarrier}; | 421 MachineType::Uint8(), kNoWriteBarrier}; |
419 return access; | 422 return access; |
420 } | 423 } |
421 | 424 |
422 | 425 |
423 // static | 426 // static |
424 FieldAccess AccessBuilder::ForMapPrototype() { | 427 FieldAccess AccessBuilder::ForMapPrototype() { |
425 FieldAccess access = { | 428 FieldAccess access = {kTaggedBase, |
426 kTaggedBase, Map::kPrototypeOffset, Handle<Name>(), | 429 Map::kPrototypeOffset, |
427 Type::TaggedPointer(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 430 Handle<Name>(), |
| 431 Type::TaggedPointer(), |
| 432 MachineType::TaggedPointer(), |
| 433 kPointerWriteBarrier}; |
428 return access; | 434 return access; |
429 } | 435 } |
430 | 436 |
431 | 437 |
432 // static | 438 // static |
433 FieldAccess AccessBuilder::ForNameHashField() { | 439 FieldAccess AccessBuilder::ForNameHashField() { |
434 FieldAccess access = {kTaggedBase, Name::kHashFieldOffset, | 440 FieldAccess access = {kTaggedBase, Name::kHashFieldOffset, |
435 Handle<Name>(), Type::Internal(), | 441 Handle<Name>(), Type::Internal(), |
436 MachineType::Uint32(), kNoWriteBarrier}; | 442 MachineType::Uint32(), kNoWriteBarrier}; |
437 return access; | 443 return access; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 | 609 |
604 | 610 |
605 // static | 611 // static |
606 FieldAccess AccessBuilder::ForPropertyCellValue() { | 612 FieldAccess AccessBuilder::ForPropertyCellValue() { |
607 return ForPropertyCellValue(Type::Tagged()); | 613 return ForPropertyCellValue(Type::Tagged()); |
608 } | 614 } |
609 | 615 |
610 | 616 |
611 // static | 617 // static |
612 FieldAccess AccessBuilder::ForPropertyCellValue(Type* type) { | 618 FieldAccess AccessBuilder::ForPropertyCellValue(Type* type) { |
| 619 // Extract representation dimension of {type} into MachineType {r}. |
| 620 MachineType r = MachineType::AnyTagged(); |
| 621 WriteBarrierKind w = kFullWriteBarrier; |
| 622 if (type->Is(Type::TaggedSigned())) { |
| 623 r = MachineType::TaggedSigned(); |
| 624 w = kNoWriteBarrier; |
| 625 } else if (type->Is(Type::TaggedPointer())) { |
| 626 r = MachineType::TaggedPointer(); |
| 627 } |
613 FieldAccess access = { | 628 FieldAccess access = { |
614 kTaggedBase, PropertyCell::kValueOffset, Handle<Name>(), | 629 kTaggedBase, PropertyCell::kValueOffset, Handle<Name>(), type, r, w}; |
615 type, MachineType::AnyTagged(), kFullWriteBarrier}; | |
616 return access; | 630 return access; |
617 } | 631 } |
618 | 632 |
619 // static | 633 // static |
620 ElementAccess AccessBuilder::ForFixedArrayElement() { | 634 ElementAccess AccessBuilder::ForFixedArrayElement() { |
621 ElementAccess access = {kTaggedBase, FixedArray::kHeaderSize, Type::Tagged(), | 635 ElementAccess access = {kTaggedBase, FixedArray::kHeaderSize, Type::Tagged(), |
622 MachineType::AnyTagged(), kFullWriteBarrier}; | 636 MachineType::AnyTagged(), kFullWriteBarrier}; |
623 return access; | 637 return access; |
624 } | 638 } |
625 | 639 |
626 // static | 640 // static |
627 ElementAccess AccessBuilder::ForFixedArrayElement(ElementsKind kind) { | 641 ElementAccess AccessBuilder::ForFixedArrayElement(ElementsKind kind) { |
628 ElementAccess access = {kTaggedBase, FixedArray::kHeaderSize, Type::Any(), | 642 ElementAccess access = {kTaggedBase, FixedArray::kHeaderSize, Type::Any(), |
629 MachineType::AnyTagged(), kFullWriteBarrier}; | 643 MachineType::AnyTagged(), kFullWriteBarrier}; |
630 switch (kind) { | 644 switch (kind) { |
631 case FAST_SMI_ELEMENTS: | 645 case FAST_SMI_ELEMENTS: |
632 access.type = TypeCache::Get().kSmi; | 646 access.type = TypeCache::Get().kSmi; |
| 647 access.machine_type = MachineType::TaggedSigned(); |
633 access.write_barrier_kind = kNoWriteBarrier; | 648 access.write_barrier_kind = kNoWriteBarrier; |
634 break; | 649 break; |
635 case FAST_HOLEY_SMI_ELEMENTS: | 650 case FAST_HOLEY_SMI_ELEMENTS: |
636 access.type = TypeCache::Get().kHoleySmi; | 651 access.type = TypeCache::Get().kHoleySmi; |
637 break; | 652 break; |
638 case FAST_ELEMENTS: | 653 case FAST_ELEMENTS: |
639 access.type = Type::NonInternal(); | 654 access.type = Type::NonInternal(); |
640 break; | 655 break; |
641 case FAST_HOLEY_ELEMENTS: | 656 case FAST_HOLEY_ELEMENTS: |
642 break; | 657 break; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 } | 731 } |
717 UNREACHABLE(); | 732 UNREACHABLE(); |
718 ElementAccess access = {kUntaggedBase, 0, Type::None(), MachineType::None(), | 733 ElementAccess access = {kUntaggedBase, 0, Type::None(), MachineType::None(), |
719 kNoWriteBarrier}; | 734 kNoWriteBarrier}; |
720 return access; | 735 return access; |
721 } | 736 } |
722 | 737 |
723 } // namespace compiler | 738 } // namespace compiler |
724 } // namespace internal | 739 } // namespace internal |
725 } // namespace v8 | 740 } // namespace v8 |
OLD | NEW |