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

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

Issue 6717018: Introduce accessors on builtins instance (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix tests and lint. Created 9 years, 9 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/x64/virtual-frame-x64.cc ('k') | test/cctest/test-debug.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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 InstanceType instance_type = JS_OBJECT_TYPE; 84 InstanceType instance_type = JS_OBJECT_TYPE;
85 int instance_size = JSObject::kHeaderSize; 85 int instance_size = JSObject::kHeaderSize;
86 while (map_space->Available() > kMapSpaceFillerSize) { 86 while (map_space->Available() > kMapSpaceFillerSize) {
87 CHECK(!heap->AllocateMap(instance_type, instance_size)->IsFailure()); 87 CHECK(!heap->AllocateMap(instance_type, instance_size)->IsFailure());
88 } 88 }
89 CHECK(!heap->AllocateMap(instance_type, instance_size)->IsFailure()); 89 CHECK(!heap->AllocateMap(instance_type, instance_size)->IsFailure());
90 90
91 // Test that we can allocate in old pointer space and code space. 91 // Test that we can allocate in old pointer space and code space.
92 CHECK(!heap->AllocateFixedArray(100, TENURED)->IsFailure()); 92 CHECK(!heap->AllocateFixedArray(100, TENURED)->IsFailure());
93 CHECK(!heap->CopyCode(Isolate::Current()->builtins()->builtin( 93 CHECK(!heap->CopyCode(Isolate::Current()->builtins()->builtin(
94 Builtins::Illegal))->IsFailure()); 94 Builtins::kIllegal))->IsFailure());
95 95
96 // Return success. 96 // Return success.
97 return Smi::FromInt(42); 97 return Smi::FromInt(42);
98 } 98 }
99 99
100 100
101 static Handle<Object> Test() { 101 static Handle<Object> Test() {
102 CALL_HEAP_FUNCTION(ISOLATE, AllocateAfterFailures(), Object); 102 CALL_HEAP_FUNCTION(ISOLATE, AllocateAfterFailures(), Object);
103 } 103 }
104 104
(...skipping 23 matching lines...) Expand all
128 TEST(StressJS) { 128 TEST(StressJS) {
129 v8::Persistent<v8::Context> env = v8::Context::New(); 129 v8::Persistent<v8::Context> env = v8::Context::New();
130 v8::HandleScope scope; 130 v8::HandleScope scope;
131 env->Enter(); 131 env->Enter();
132 Handle<JSFunction> function = 132 Handle<JSFunction> function =
133 FACTORY->NewFunction(FACTORY->function_symbol(), FACTORY->null_value()); 133 FACTORY->NewFunction(FACTORY->function_symbol(), FACTORY->null_value());
134 // Force the creation of an initial map and set the code to 134 // Force the creation of an initial map and set the code to
135 // something empty. 135 // something empty.
136 FACTORY->NewJSObject(function); 136 FACTORY->NewJSObject(function);
137 function->ReplaceCode(Isolate::Current()->builtins()->builtin( 137 function->ReplaceCode(Isolate::Current()->builtins()->builtin(
138 Builtins::EmptyFunction)); 138 Builtins::kEmptyFunction));
139 // Patch the map to have an accessor for "get". 139 // Patch the map to have an accessor for "get".
140 Handle<Map> map(function->initial_map()); 140 Handle<Map> map(function->initial_map());
141 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); 141 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors());
142 Handle<Proxy> proxy = FACTORY->NewProxy(&kDescriptor); 142 Handle<Proxy> proxy = FACTORY->NewProxy(&kDescriptor);
143 instance_descriptors = FACTORY->CopyAppendProxyDescriptor( 143 instance_descriptors = FACTORY->CopyAppendProxyDescriptor(
144 instance_descriptors, 144 instance_descriptors,
145 FACTORY->NewStringFromAscii(Vector<const char>("get", 3)), 145 FACTORY->NewStringFromAscii(Vector<const char>("get", 3)),
146 proxy, 146 proxy,
147 static_cast<PropertyAttributes>(0)); 147 static_cast<PropertyAttributes>(0));
148 map->set_instance_descriptors(*instance_descriptors); 148 map->set_instance_descriptors(*instance_descriptors);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 if (index < blocks.length() - 1) { 212 if (index < blocks.length() - 1) {
213 blocks[index] = blocks.RemoveLast(); 213 blocks[index] = blocks.RemoveLast();
214 } else { 214 } else {
215 blocks.RemoveLast(); 215 blocks.RemoveLast();
216 } 216 }
217 } 217 }
218 } 218 }
219 219
220 Isolate::Current()->code_range()->TearDown(); 220 Isolate::Current()->code_range()->TearDown();
221 } 221 }
OLDNEW
« no previous file with comments | « src/x64/virtual-frame-x64.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698