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

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

Issue 22546003: Rollback of r16071 in trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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/zone-inl.h ('k') | tools/gyp/v8.gyp » ('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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 strong_nodes_.erase(strong_nodes_.begin() + offset); 411 strong_nodes_.erase(strong_nodes_.begin() + offset);
412 } 412 }
413 413
414 void AddWeak() { 414 void AddWeak() {
415 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(isolate_); 415 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(isolate_);
416 v8::HandleScope scope(isolate); 416 v8::HandleScope scope(isolate);
417 v8::Local<v8::Object> object = v8::Object::New(); 417 v8::Local<v8::Object> object = v8::Object::New();
418 int32_t offset = ++weak_offset_; 418 int32_t offset = ++weak_offset_;
419 object->Set(7, v8::Integer::New(offset, isolate)); 419 object->Set(7, v8::Integer::New(offset, isolate));
420 v8::Persistent<v8::Object> persistent(isolate, object); 420 v8::Persistent<v8::Object> persistent(isolate, object);
421 persistent.MakeWeak(this, WeakCallback); 421 persistent.MakeWeak(isolate, this, WeakCallback);
422 persistent.MarkIndependent(); 422 persistent.MarkIndependent();
423 Object** location = v8::Utils::OpenPersistent(persistent).location(); 423 Object** location = v8::Utils::OpenPersistent(persistent).location();
424 bool inserted = 424 bool inserted =
425 weak_nodes_.insert(std::make_pair(offset, location)).second; 425 weak_nodes_.insert(std::make_pair(offset, location)).second;
426 CHECK(inserted); 426 CHECK(inserted);
427 } 427 }
428 428
429 static void WeakCallback(v8::Isolate* isolate, 429 static void WeakCallback(v8::Isolate* isolate,
430 v8::Persistent<v8::Object>* persistent, 430 v8::Persistent<v8::Object>* persistent,
431 RandomMutationData* data) { 431 RandomMutationData* data) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 512 }
513 v8::Local<v8::Value> value = object->Get(i); 513 v8::Local<v8::Value> value = object->Get(i);
514 CHECK(value->IsInt32()); 514 CHECK(value->IsInt32());
515 CHECK_EQ(i, value->Int32Value()); 515 CHECK_EQ(i, value->Int32Value());
516 } 516 }
517 } 517 }
518 518
519 CHECK_EQ(kArrayLength, eternals->NumberOfHandles()); 519 CHECK_EQ(kArrayLength, eternals->NumberOfHandles());
520 } 520 }
521 521
OLDNEW
« no previous file with comments | « src/zone-inl.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698