| OLD | NEW |
| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 323 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
| 324 EternalHandles* eternal_handles = isolate->eternal_handles(); | 324 EternalHandles* eternal_handles = isolate->eternal_handles(); |
| 325 | 325 |
| 326 // Create a number of handles that will not be on a block boundary | 326 // Create a number of handles that will not be on a block boundary |
| 327 const int kArrayLength = 2048-1; | 327 const int kArrayLength = 2048-1; |
| 328 int indices[kArrayLength]; | 328 int indices[kArrayLength]; |
| 329 v8::Eternal<v8::Value> eternals[kArrayLength]; | 329 v8::Eternal<v8::Value> eternals[kArrayLength]; |
| 330 | 330 |
| 331 CHECK_EQ(0, eternal_handles->NumberOfHandles()); | 331 CHECK_EQ(0, eternal_handles->NumberOfHandles()); |
| 332 for (int i = 0; i < kArrayLength; i++) { | 332 for (int i = 0; i < kArrayLength; i++) { |
| 333 indices[i] = -1; |
| 333 HandleScope scope(isolate); | 334 HandleScope scope(isolate); |
| 334 v8::Local<v8::Object> object = v8::Object::New(); | 335 v8::Local<v8::Object> object = v8::Object::New(); |
| 335 object->Set(i, v8::Integer::New(i, v8_isolate)); | 336 object->Set(i, v8::Integer::New(i, v8_isolate)); |
| 336 // Create with internal api | 337 // Create with internal api |
| 337 eternal_handles->Create( | 338 eternal_handles->Create( |
| 338 isolate, *v8::Utils::OpenHandle(*object), &indices[i]); | 339 isolate, *v8::Utils::OpenHandle(*object), &indices[i]); |
| 339 // Create with external api | 340 // Create with external api |
| 340 CHECK(!eternals[i].IsEmpty()); | 341 CHECK(!eternals[i].IsEmpty()); |
| 341 eternals[i].Set(v8_isolate, object); | 342 eternals[i].Set(v8_isolate, object); |
| 342 CHECK(eternals[i].IsEmpty()); | 343 CHECK(eternals[i].IsEmpty()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 368 { | 369 { |
| 369 HandleScope scope(isolate); | 370 HandleScope scope(isolate); |
| 370 v8::Local<v8::Object> object = v8::Object::New(); | 371 v8::Local<v8::Object> object = v8::Object::New(); |
| 371 v8::Eternal<v8::Object> eternal(v8_isolate, object); | 372 v8::Eternal<v8::Object> eternal(v8_isolate, object); |
| 372 CHECK(eternal.IsEmpty()); | 373 CHECK(eternal.IsEmpty()); |
| 373 CHECK(object == eternal.Get(v8_isolate)); | 374 CHECK(object == eternal.Get(v8_isolate)); |
| 374 } | 375 } |
| 375 | 376 |
| 376 CHECK_EQ(2*kArrayLength + 1, eternal_handles->NumberOfHandles()); | 377 CHECK_EQ(2*kArrayLength + 1, eternal_handles->NumberOfHandles()); |
| 377 } | 378 } |
| OLD | NEW |