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

Side by Side Diff: test/cctest/test-ordered-hash-table.cc

Issue 427723002: Enable ES6 Map and Set by default (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove old test, fix BUILD.gn Created 6 years, 4 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 | « test/cctest/test-heap-profiler.cc ('k') | test/mjsunit/builtins.js » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 20 matching lines...) Expand all
31 31
32 #include "src/factory.h" 32 #include "src/factory.h"
33 #include "test/cctest/cctest.h" 33 #include "test/cctest/cctest.h"
34 34
35 namespace { 35 namespace {
36 36
37 using namespace v8::internal; 37 using namespace v8::internal;
38 38
39 39
40 TEST(Set) { 40 TEST(Set) {
41 i::FLAG_harmony_collections = true;
42
43 LocalContext context; 41 LocalContext context;
44 Isolate* isolate = CcTest::i_isolate(); 42 Isolate* isolate = CcTest::i_isolate();
45 Factory* factory = isolate->factory(); 43 Factory* factory = isolate->factory();
46 HandleScope scope(isolate); 44 HandleScope scope(isolate);
47 Handle<OrderedHashSet> ordered_set = factory->NewOrderedHashSet(); 45 Handle<OrderedHashSet> ordered_set = factory->NewOrderedHashSet();
48 CHECK_EQ(2, ordered_set->NumberOfBuckets()); 46 CHECK_EQ(2, ordered_set->NumberOfBuckets());
49 CHECK_EQ(0, ordered_set->NumberOfElements()); 47 CHECK_EQ(0, ordered_set->NumberOfElements());
50 CHECK_EQ(0, ordered_set->NumberOfDeletedElements()); 48 CHECK_EQ(0, ordered_set->NumberOfDeletedElements());
51 49
52 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 50 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 ordered_set = OrderedHashSet::Remove(ordered_set, obj2, &was_present); 96 ordered_set = OrderedHashSet::Remove(ordered_set, obj2, &was_present);
99 CHECK(was_present); 97 CHECK(was_present);
100 ordered_set = OrderedHashSet::Remove(ordered_set, obj3, &was_present); 98 ordered_set = OrderedHashSet::Remove(ordered_set, obj3, &was_present);
101 CHECK(was_present); 99 CHECK(was_present);
102 CHECK_EQ(1, ordered_set->NumberOfElements()); 100 CHECK_EQ(1, ordered_set->NumberOfElements());
103 CHECK_EQ(2, ordered_set->NumberOfBuckets()); 101 CHECK_EQ(2, ordered_set->NumberOfBuckets());
104 } 102 }
105 103
106 104
107 TEST(Map) { 105 TEST(Map) {
108 i::FLAG_harmony_collections = true;
109
110 LocalContext context; 106 LocalContext context;
111 Isolate* isolate = CcTest::i_isolate(); 107 Isolate* isolate = CcTest::i_isolate();
112 Factory* factory = isolate->factory(); 108 Factory* factory = isolate->factory();
113 HandleScope scope(isolate); 109 HandleScope scope(isolate);
114 Handle<OrderedHashMap> ordered_map = factory->NewOrderedHashMap(); 110 Handle<OrderedHashMap> ordered_map = factory->NewOrderedHashMap();
115 CHECK_EQ(2, ordered_map->NumberOfBuckets()); 111 CHECK_EQ(2, ordered_map->NumberOfBuckets());
116 CHECK_EQ(0, ordered_map->NumberOfElements()); 112 CHECK_EQ(0, ordered_map->NumberOfElements());
117 CHECK_EQ(0, ordered_map->NumberOfDeletedElements()); 113 CHECK_EQ(0, ordered_map->NumberOfDeletedElements());
118 114
119 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 115 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ordered_map = OrderedHashMap::Remove(ordered_map, obj2, &was_present); 161 ordered_map = OrderedHashMap::Remove(ordered_map, obj2, &was_present);
166 CHECK(was_present); 162 CHECK(was_present);
167 ordered_map = OrderedHashMap::Remove(ordered_map, obj3, &was_present); 163 ordered_map = OrderedHashMap::Remove(ordered_map, obj3, &was_present);
168 CHECK(was_present); 164 CHECK(was_present);
169 CHECK_EQ(1, ordered_map->NumberOfElements()); 165 CHECK_EQ(1, ordered_map->NumberOfElements());
170 CHECK_EQ(2, ordered_map->NumberOfBuckets()); 166 CHECK_EQ(2, ordered_map->NumberOfBuckets());
171 } 167 }
172 168
173 169
174 } 170 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/mjsunit/builtins.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698