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

Side by Side Diff: test/cctest/test-alloc.cc

Issue 234783002: Handlify Map::CopyDropDescriptors(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Some more refactoring. 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/transitions.cc ('k') | no next file » | 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 function->ReplaceCode(CcTest::i_isolate()->builtins()->builtin( 130 function->ReplaceCode(CcTest::i_isolate()->builtins()->builtin(
131 Builtins::kEmptyFunction)); 131 Builtins::kEmptyFunction));
132 // Patch the map to have an accessor for "get". 132 // Patch the map to have an accessor for "get".
133 Handle<Map> map(function->initial_map()); 133 Handle<Map> map(function->initial_map());
134 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); 134 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors());
135 Handle<Foreign> foreign = factory->NewForeign(&kDescriptor); 135 Handle<Foreign> foreign = factory->NewForeign(&kDescriptor);
136 Handle<String> name = 136 Handle<String> name =
137 factory->NewStringFromAscii(Vector<const char>("get", 3)); 137 factory->NewStringFromAscii(Vector<const char>("get", 3));
138 ASSERT(instance_descriptors->IsEmpty()); 138 ASSERT(instance_descriptors->IsEmpty());
139 139
140 Handle<DescriptorArray> new_descriptors = factory->NewDescriptorArray(0, 1); 140 Map::EnsureDescriptorSlack(map, 1);
141
142 v8::internal::DescriptorArray::WhitenessWitness witness(*new_descriptors);
143 map->set_instance_descriptors(*new_descriptors);
144 141
145 CallbacksDescriptor d(name, 142 CallbacksDescriptor d(name,
146 foreign, 143 foreign,
147 static_cast<PropertyAttributes>(0)); 144 static_cast<PropertyAttributes>(0));
148 map->AppendDescriptor(&d, witness); 145 map->AppendDescriptor(&d);
149 146
150 // Add the Foo constructor the global object. 147 // Add the Foo constructor the global object.
151 env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "Foo"), 148 env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "Foo"),
152 v8::Utils::ToLocal(function)); 149 v8::Utils::ToLocal(function));
153 // Call the accessor through JavaScript. 150 // Call the accessor through JavaScript.
154 v8::Handle<v8::Value> result = v8::Script::Compile( 151 v8::Handle<v8::Value> result = v8::Script::Compile(
155 v8::String::NewFromUtf8(CcTest::isolate(), "(new Foo).get"))->Run(); 152 v8::String::NewFromUtf8(CcTest::isolate(), "(new Foo).get"))->Run();
156 CHECK_EQ(42, result->Int32Value()); 153 CHECK_EQ(42, result->Int32Value());
157 env->Exit(); 154 env->Exit();
158 } 155 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 if (index < blocks.length() - 1) { 217 if (index < blocks.length() - 1) {
221 blocks[index] = blocks.RemoveLast(); 218 blocks[index] = blocks.RemoveLast();
222 } else { 219 } else {
223 blocks.RemoveLast(); 220 blocks.RemoveLast();
224 } 221 }
225 } 222 }
226 } 223 }
227 224
228 code_range.TearDown(); 225 code_range.TearDown();
229 } 226 }
OLDNEW
« no previous file with comments | « src/transitions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698