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

Side by Side Diff: src/elements.cc

Issue 225933002: ElementsAccessor's public interface handlification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/elements.h ('k') | src/objects.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 MUST_USE_RESULT virtual Handle<Object> Get( 636 MUST_USE_RESULT virtual Handle<Object> Get(
637 Handle<Object> receiver, 637 Handle<Object> receiver,
638 Handle<JSObject> holder, 638 Handle<JSObject> holder,
639 uint32_t key, 639 uint32_t key,
640 Handle<FixedArrayBase> backing_store) V8_FINAL V8_OVERRIDE { 640 Handle<FixedArrayBase> backing_store) V8_FINAL V8_OVERRIDE {
641 CALL_HEAP_FUNCTION(holder->GetIsolate(), 641 CALL_HEAP_FUNCTION(holder->GetIsolate(),
642 Get(*receiver, *holder, key, *backing_store), 642 Get(*receiver, *holder, key, *backing_store),
643 Object); 643 Object);
644 } 644 }
645 645
646 // TODO(ishell): Temporary wrapper until handlified.
647 MUST_USE_RESULT virtual Handle<Object> Get(
648 Handle<Object> receiver,
649 Handle<JSObject> holder,
650 uint32_t key) V8_FINAL V8_OVERRIDE {
651 CALL_HEAP_FUNCTION(holder->GetIsolate(),
652 Get(*receiver, *holder, key, NULL),
653 Object);
654 }
655
656 MUST_USE_RESULT virtual MaybeObject* Get( 646 MUST_USE_RESULT virtual MaybeObject* Get(
657 Object* receiver, 647 Object* receiver,
658 JSObject* holder, 648 JSObject* holder,
659 uint32_t key, 649 uint32_t key,
660 FixedArrayBase* backing_store) V8_FINAL V8_OVERRIDE { 650 FixedArrayBase* backing_store) V8_FINAL V8_OVERRIDE {
661 if (backing_store == NULL) {
662 backing_store = holder->elements();
663 }
664
665 if (!IsExternalArrayElementsKind(ElementsTraits::Kind) && 651 if (!IsExternalArrayElementsKind(ElementsTraits::Kind) &&
666 FLAG_trace_js_array_abuse) { 652 FLAG_trace_js_array_abuse) {
667 CheckArrayAbuse(holder, "elements read", key); 653 CheckArrayAbuse(holder, "elements read", key);
668 } 654 }
669 655
670 if (IsExternalArrayElementsKind(ElementsTraits::Kind) && 656 if (IsExternalArrayElementsKind(ElementsTraits::Kind) &&
671 FLAG_trace_external_array_abuse) { 657 FLAG_trace_external_array_abuse) {
672 CheckArrayAbuse(holder, "external elements read", key); 658 CheckArrayAbuse(holder, "external elements read", key);
673 } 659 }
674 660
675 return ElementsAccessorSubclass::GetImpl( 661 return ElementsAccessorSubclass::GetImpl(
676 receiver, holder, key, backing_store); 662 receiver, holder, key, backing_store);
677 } 663 }
678 664
679 MUST_USE_RESULT static MaybeObject* GetImpl(Object* receiver, 665 MUST_USE_RESULT static MaybeObject* GetImpl(Object* receiver,
680 JSObject* obj, 666 JSObject* obj,
681 uint32_t key, 667 uint32_t key,
682 FixedArrayBase* backing_store) { 668 FixedArrayBase* backing_store) {
683 return (key < ElementsAccessorSubclass::GetCapacityImpl(backing_store)) 669 return (key < ElementsAccessorSubclass::GetCapacityImpl(backing_store))
684 ? BackingStore::cast(backing_store)->get(key) 670 ? BackingStore::cast(backing_store)->get(key)
685 : backing_store->GetHeap()->the_hole_value(); 671 : backing_store->GetHeap()->the_hole_value();
686 } 672 }
687 673
688 MUST_USE_RESULT virtual PropertyAttributes GetAttributes( 674 MUST_USE_RESULT virtual PropertyAttributes GetAttributes(
675 Handle<Object> receiver,
676 Handle<JSObject> holder,
677 uint32_t key,
678 Handle<FixedArrayBase> backing_store) V8_FINAL V8_OVERRIDE {
679 return ElementsAccessorSubclass::GetAttributesImpl(
680 *receiver, *holder, key, *backing_store);
681 }
682
683 // TODO(ishell): To be removed once elements.cc is handlified.
684 MUST_USE_RESULT virtual PropertyAttributes GetAttributes(
689 Object* receiver, 685 Object* receiver,
690 JSObject* holder, 686 JSObject* holder,
691 uint32_t key, 687 uint32_t key,
692 FixedArrayBase* backing_store) V8_FINAL V8_OVERRIDE { 688 FixedArrayBase* backing_store) V8_FINAL V8_OVERRIDE {
693 if (backing_store == NULL) {
694 backing_store = holder->elements();
695 }
696 return ElementsAccessorSubclass::GetAttributesImpl( 689 return ElementsAccessorSubclass::GetAttributesImpl(
697 receiver, holder, key, backing_store); 690 receiver, holder, key, backing_store);
698 } 691 }
699 692
700 MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( 693 MUST_USE_RESULT static PropertyAttributes GetAttributesImpl(
701 Object* receiver, 694 Object* receiver,
702 JSObject* obj, 695 JSObject* obj,
703 uint32_t key, 696 uint32_t key,
704 FixedArrayBase* backing_store) { 697 FixedArrayBase* backing_store) {
705 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { 698 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) {
706 return ABSENT; 699 return ABSENT;
707 } 700 }
708 return BackingStore::cast(backing_store)->is_the_hole(key) ? ABSENT : NONE; 701 return BackingStore::cast(backing_store)->is_the_hole(key) ? ABSENT : NONE;
709 } 702 }
710 703
711 MUST_USE_RESULT virtual PropertyType GetType( 704 MUST_USE_RESULT virtual PropertyType GetType(
705 Handle<Object> receiver,
706 Handle<JSObject> holder,
707 uint32_t key,
708 Handle<FixedArrayBase> backing_store) V8_FINAL V8_OVERRIDE {
709 return ElementsAccessorSubclass::GetTypeImpl(
710 *receiver, *holder, key, *backing_store);
711 }
712
713 // TODO(ishell): To be removed once elements.cc is handlified.
714 MUST_USE_RESULT virtual PropertyType GetType(
712 Object* receiver, 715 Object* receiver,
713 JSObject* holder, 716 JSObject* holder,
714 uint32_t key, 717 uint32_t key,
715 FixedArrayBase* backing_store) V8_FINAL V8_OVERRIDE { 718 FixedArrayBase* backing_store) V8_FINAL V8_OVERRIDE {
716 if (backing_store == NULL) {
717 backing_store = holder->elements();
718 }
719 return ElementsAccessorSubclass::GetTypeImpl( 719 return ElementsAccessorSubclass::GetTypeImpl(
720 receiver, holder, key, backing_store); 720 receiver, holder, key, backing_store);
721 } 721 }
722 722
723 MUST_USE_RESULT static PropertyType GetTypeImpl( 723 MUST_USE_RESULT static PropertyType GetTypeImpl(
724 Object* receiver, 724 Object* receiver,
725 JSObject* obj, 725 JSObject* obj,
726 uint32_t key, 726 uint32_t key,
727 FixedArrayBase* backing_store) { 727 FixedArrayBase* backing_store) {
728 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { 728 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) {
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 UNREACHABLE(); 2065 UNREACHABLE();
2066 break; 2066 break;
2067 } 2067 }
2068 2068
2069 array->set_elements(*elms); 2069 array->set_elements(*elms);
2070 array->set_length(Smi::FromInt(number_of_elements)); 2070 array->set_length(Smi::FromInt(number_of_elements));
2071 return array; 2071 return array;
2072 } 2072 }
2073 2073
2074 } } // namespace v8::internal 2074 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/elements.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698