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

Side by Side Diff: test/cctest/test-mark-compact.cc

Issue 23601031: Handlify JSReceiver::SetProperty and friends. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Toon Verwaest. Created 7 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 | « test/cctest/test-heap.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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 148
149 TEST(MarkCompactCollector) { 149 TEST(MarkCompactCollector) {
150 FLAG_incremental_marking = false; 150 FLAG_incremental_marking = false;
151 CcTest::InitializeVM(); 151 CcTest::InitializeVM();
152 Isolate* isolate = Isolate::Current(); 152 Isolate* isolate = Isolate::Current();
153 Heap* heap = isolate->heap(); 153 Heap* heap = isolate->heap();
154 154
155 v8::HandleScope sc(CcTest::isolate()); 155 v8::HandleScope sc(CcTest::isolate());
156 Handle<GlobalObject> global(isolate->context()->global_object());
156 157
157 // call mark-compact when heap is empty 158 // call mark-compact when heap is empty
158 heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 1"); 159 heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 1");
159 160
160 // keep allocating garbage in new space until it fails 161 // keep allocating garbage in new space until it fails
161 const int ARRAY_SIZE = 100; 162 const int ARRAY_SIZE = 100;
162 Object* array; 163 Object* array;
163 MaybeObject* maybe_array; 164 MaybeObject* maybe_array;
164 do { 165 do {
165 maybe_array = heap->AllocateFixedArray(ARRAY_SIZE); 166 maybe_array = heap->AllocateFixedArray(ARRAY_SIZE);
(...skipping 18 matching lines...) Expand all
184 SharedFunctionInfo* function_share = SharedFunctionInfo::cast( 185 SharedFunctionInfo* function_share = SharedFunctionInfo::cast(
185 heap->AllocateSharedFunctionInfo(func_name)->ToObjectChecked()); 186 heap->AllocateSharedFunctionInfo(func_name)->ToObjectChecked());
186 JSFunction* function = JSFunction::cast( 187 JSFunction* function = JSFunction::cast(
187 heap->AllocateFunction(*isolate->function_map(), 188 heap->AllocateFunction(*isolate->function_map(),
188 function_share, 189 function_share,
189 heap->undefined_value())->ToObjectChecked()); 190 heap->undefined_value())->ToObjectChecked());
190 Map* initial_map = 191 Map* initial_map =
191 Map::cast(heap->AllocateMap(JS_OBJECT_TYPE, 192 Map::cast(heap->AllocateMap(JS_OBJECT_TYPE,
192 JSObject::kHeaderSize)->ToObjectChecked()); 193 JSObject::kHeaderSize)->ToObjectChecked());
193 function->set_initial_map(initial_map); 194 function->set_initial_map(initial_map);
194 isolate->context()->global_object()->SetProperty( 195 JSReceiver::SetProperty(
195 func_name, function, NONE, kNonStrictMode)->ToObjectChecked(); 196 global, handle(func_name), handle(function), NONE, kNonStrictMode);
196 197
197 JSObject* obj = JSObject::cast( 198 JSObject* obj = JSObject::cast(
198 heap->AllocateJSObject(function)->ToObjectChecked()); 199 heap->AllocateJSObject(function)->ToObjectChecked());
199 heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 4"); 200 heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 4");
200 201
201 func_name = String::cast( 202 func_name = String::cast(
202 heap->InternalizeUtf8String("theFunction")->ToObjectChecked()); 203 heap->InternalizeUtf8String("theFunction")->ToObjectChecked());
203 CHECK(isolate->context()->global_object()->HasLocalProperty(func_name)); 204 CHECK(isolate->context()->global_object()->HasLocalProperty(func_name));
204 Object* func_value = isolate->context()->global_object()-> 205 Object* func_value = isolate->context()->global_object()->
205 GetProperty(func_name)->ToObjectChecked(); 206 GetProperty(func_name)->ToObjectChecked();
206 CHECK(func_value->IsJSFunction()); 207 CHECK(func_value->IsJSFunction());
207 function = JSFunction::cast(func_value); 208 function = JSFunction::cast(func_value);
208 209
209 obj = JSObject::cast(heap->AllocateJSObject(function)->ToObjectChecked()); 210 obj = JSObject::cast(heap->AllocateJSObject(function)->ToObjectChecked());
210 String* obj_name = 211 String* obj_name =
211 String::cast(heap->InternalizeUtf8String("theObject")->ToObjectChecked()); 212 String::cast(heap->InternalizeUtf8String("theObject")->ToObjectChecked());
212 isolate->context()->global_object()->SetProperty( 213 JSReceiver::SetProperty(
213 obj_name, obj, NONE, kNonStrictMode)->ToObjectChecked(); 214 global, handle(obj_name), handle(obj), NONE, kNonStrictMode);
214 String* prop_name = 215 String* prop_name =
215 String::cast(heap->InternalizeUtf8String("theSlot")->ToObjectChecked()); 216 String::cast(heap->InternalizeUtf8String("theSlot")->ToObjectChecked());
216 obj->SetProperty(prop_name, 217 Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
217 Smi::FromInt(23), 218 JSReceiver::SetProperty(
218 NONE, 219 handle(obj), handle(prop_name), twenty_three, NONE, kNonStrictMode);
219 kNonStrictMode)->ToObjectChecked();
220 220
221 heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 5"); 221 heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 5");
222 222
223 obj_name = 223 obj_name =
224 String::cast(heap->InternalizeUtf8String("theObject")->ToObjectChecked()); 224 String::cast(heap->InternalizeUtf8String("theObject")->ToObjectChecked());
225 CHECK(isolate->context()->global_object()->HasLocalProperty(obj_name)); 225 CHECK(isolate->context()->global_object()->HasLocalProperty(obj_name));
226 CHECK(isolate->context()->global_object()-> 226 CHECK(isolate->context()->global_object()->
227 GetProperty(obj_name)->ToObjectChecked()->IsJSObject()); 227 GetProperty(obj_name)->ToObjectChecked()->IsJSObject());
228 obj = JSObject::cast(isolate->context()->global_object()-> 228 obj = JSObject::cast(isolate->context()->global_object()->
229 GetProperty(obj_name)->ToObjectChecked()); 229 GetProperty(obj_name)->ToObjectChecked());
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 583
584 TEST(RegressJoinThreadsOnIsolateDeinit) { 584 TEST(RegressJoinThreadsOnIsolateDeinit) {
585 intptr_t size_limit = ShortLivingIsolate() * 2; 585 intptr_t size_limit = ShortLivingIsolate() * 2;
586 for (int i = 0; i < 10; i++) { 586 for (int i = 0; i < 10; i++) {
587 CHECK_GT(size_limit, ShortLivingIsolate()); 587 CHECK_GT(size_limit, ShortLivingIsolate());
588 } 588 }
589 } 589 }
590 590
591 #endif // __linux__ and !USE_SIMULATOR 591 #endif // __linux__ and !USE_SIMULATOR
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698