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

Side by Side Diff: test/cctest/test-global-handles.cc

Issue 118523003: More API cleanup. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Feedback Created 7 years 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-decls.cc ('k') | test/cctest/test-global-object.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 // Create a number of handles that will not be on a block boundary 328 // Create a number of handles that will not be on a block boundary
329 const int kArrayLength = 2048-1; 329 const int kArrayLength = 2048-1;
330 int indices[kArrayLength]; 330 int indices[kArrayLength];
331 v8::Eternal<v8::Value> eternals[kArrayLength]; 331 v8::Eternal<v8::Value> eternals[kArrayLength];
332 332
333 CHECK_EQ(0, eternal_handles->NumberOfHandles()); 333 CHECK_EQ(0, eternal_handles->NumberOfHandles());
334 for (int i = 0; i < kArrayLength; i++) { 334 for (int i = 0; i < kArrayLength; i++) {
335 indices[i] = -1; 335 indices[i] = -1;
336 HandleScope scope(isolate); 336 HandleScope scope(isolate);
337 v8::Local<v8::Object> object = v8::Object::New(); 337 v8::Local<v8::Object> object = v8::Object::New(v8_isolate);
338 object->Set(i, v8::Integer::New(i, v8_isolate)); 338 object->Set(i, v8::Integer::New(v8_isolate, i));
339 // Create with internal api 339 // Create with internal api
340 eternal_handles->Create( 340 eternal_handles->Create(
341 isolate, *v8::Utils::OpenHandle(*object), &indices[i]); 341 isolate, *v8::Utils::OpenHandle(*object), &indices[i]);
342 // Create with external api 342 // Create with external api
343 CHECK(eternals[i].IsEmpty()); 343 CHECK(eternals[i].IsEmpty());
344 eternals[i].Set(v8_isolate, object); 344 eternals[i].Set(v8_isolate, object);
345 CHECK(!eternals[i].IsEmpty()); 345 CHECK(!eternals[i].IsEmpty());
346 } 346 }
347 347
348 isolate->heap()->CollectAllAvailableGarbage(); 348 isolate->heap()->CollectAllAvailableGarbage();
(...skipping 14 matching lines...) Expand all
363 CHECK(value->IsInt32()); 363 CHECK(value->IsInt32());
364 CHECK_EQ(i, value->Int32Value()); 364 CHECK_EQ(i, value->Int32Value());
365 } 365 }
366 } 366 }
367 367
368 CHECK_EQ(2*kArrayLength, eternal_handles->NumberOfHandles()); 368 CHECK_EQ(2*kArrayLength, eternal_handles->NumberOfHandles());
369 369
370 // Create an eternal via the constructor 370 // Create an eternal via the constructor
371 { 371 {
372 HandleScope scope(isolate); 372 HandleScope scope(isolate);
373 v8::Local<v8::Object> object = v8::Object::New(); 373 v8::Local<v8::Object> object = v8::Object::New(v8_isolate);
374 v8::Eternal<v8::Object> eternal(v8_isolate, object); 374 v8::Eternal<v8::Object> eternal(v8_isolate, object);
375 CHECK(!eternal.IsEmpty()); 375 CHECK(!eternal.IsEmpty());
376 CHECK(object == eternal.Get(v8_isolate)); 376 CHECK(object == eternal.Get(v8_isolate));
377 } 377 }
378 378
379 CHECK_EQ(2*kArrayLength + 1, eternal_handles->NumberOfHandles()); 379 CHECK_EQ(2*kArrayLength + 1, eternal_handles->NumberOfHandles());
380 } 380 }
OLDNEW
« no previous file with comments | « test/cctest/test-decls.cc ('k') | test/cctest/test-global-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698