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

Side by Side Diff: src/elements.cc

Issue 504093002: Fix and re-enable test-api/InitializeAndDispose. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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/compiler/instruction.cc ('k') | src/isolate.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 // 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/elements.h" 9 #include "src/elements.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 #define ELEMENTS_TRAITS(Class, KindParam, Store) \ 113 #define ELEMENTS_TRAITS(Class, KindParam, Store) \
114 template<> class ElementsKindTraits<KindParam> { \ 114 template<> class ElementsKindTraits<KindParam> { \
115 public: /* NOLINT */ \ 115 public: /* NOLINT */ \
116 static const ElementsKind Kind = KindParam; \ 116 static const ElementsKind Kind = KindParam; \
117 typedef Store BackingStore; \ 117 typedef Store BackingStore; \
118 }; 118 };
119 ELEMENTS_LIST(ELEMENTS_TRAITS) 119 ELEMENTS_LIST(ELEMENTS_TRAITS)
120 #undef ELEMENTS_TRAITS 120 #undef ELEMENTS_TRAITS
121 121
122 122
123 ElementsAccessor** ElementsAccessor::elements_accessors_; 123 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
124 124
125 125
126 static bool HasKey(Handle<FixedArray> array, Handle<Object> key_handle) { 126 static bool HasKey(Handle<FixedArray> array, Handle<Object> key_handle) {
127 DisallowHeapAllocation no_gc; 127 DisallowHeapAllocation no_gc;
128 Object* key = *key_handle; 128 Object* key = *key_handle;
129 int len0 = array->length(); 129 int len0 = array->length();
130 for (int i = 0; i < len0; i++) { 130 for (int i = 0; i < len0; i++) {
131 Object* element = array->get(i); 131 Object* element = array->get(i);
132 if (element->IsSmi() && element == key) return true; 132 if (element->IsSmi() && element == key) return true;
133 if (element->IsString() && 133 if (element->IsString() &&
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 }; 1728 };
1729 1729
1730 STATIC_ASSERT((sizeof(accessor_array) / sizeof(*accessor_array)) == 1730 STATIC_ASSERT((sizeof(accessor_array) / sizeof(*accessor_array)) ==
1731 kElementsKindCount); 1731 kElementsKindCount);
1732 1732
1733 elements_accessors_ = accessor_array; 1733 elements_accessors_ = accessor_array;
1734 } 1734 }
1735 1735
1736 1736
1737 void ElementsAccessor::TearDown() { 1737 void ElementsAccessor::TearDown() {
1738 if (elements_accessors_ == NULL) return;
1738 #define ACCESSOR_DELETE(Class, Kind, Store) delete elements_accessors_[Kind]; 1739 #define ACCESSOR_DELETE(Class, Kind, Store) delete elements_accessors_[Kind];
1739 ELEMENTS_LIST(ACCESSOR_DELETE) 1740 ELEMENTS_LIST(ACCESSOR_DELETE)
1740 #undef ACCESSOR_DELETE 1741 #undef ACCESSOR_DELETE
1741 elements_accessors_ = NULL; 1742 elements_accessors_ = NULL;
1742 } 1743 }
1743 1744
1744 1745
1745 template <typename ElementsAccessorSubclass, typename ElementsKindTraits> 1746 template <typename ElementsAccessorSubclass, typename ElementsKindTraits>
1746 MUST_USE_RESULT 1747 MUST_USE_RESULT
1747 MaybeHandle<Object> ElementsAccessorBase<ElementsAccessorSubclass, 1748 MaybeHandle<Object> ElementsAccessorBase<ElementsAccessorSubclass,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 UNREACHABLE(); 1898 UNREACHABLE();
1898 break; 1899 break;
1899 } 1900 }
1900 1901
1901 array->set_elements(*elms); 1902 array->set_elements(*elms);
1902 array->set_length(Smi::FromInt(number_of_elements)); 1903 array->set_length(Smi::FromInt(number_of_elements));
1903 return array; 1904 return array;
1904 } 1905 }
1905 1906
1906 } } // namespace v8::internal 1907 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler/instruction.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698