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

Side by Side Diff: src/api.cc

Issue 15974006: Transforming PersistentHandleVisitor to not need to copy Persistent handles. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 7 years, 6 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 | « include/v8.h ('k') | test/cctest/test-api.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 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 5086 matching lines...) Expand 10 before | Expand all | Expand 10 after
5097 5097
5098 5098
5099 class VisitorAdapter : public i::ObjectVisitor { 5099 class VisitorAdapter : public i::ObjectVisitor {
5100 public: 5100 public:
5101 explicit VisitorAdapter(PersistentHandleVisitor* visitor) 5101 explicit VisitorAdapter(PersistentHandleVisitor* visitor)
5102 : visitor_(visitor) {} 5102 : visitor_(visitor) {}
5103 virtual void VisitPointers(i::Object** start, i::Object** end) { 5103 virtual void VisitPointers(i::Object** start, i::Object** end) {
5104 UNREACHABLE(); 5104 UNREACHABLE();
5105 } 5105 }
5106 virtual void VisitEmbedderReference(i::Object** p, uint16_t class_id) { 5106 virtual void VisitEmbedderReference(i::Object** p, uint16_t class_id) {
5107 #ifdef V8_USE_OLD_STYLE_PERSISTENT_HANDLE_VISITORS
5107 visitor_->VisitPersistentHandle(ToApi<Value>(i::Handle<i::Object>(p)), 5108 visitor_->VisitPersistentHandle(ToApi<Value>(i::Handle<i::Object>(p)),
5108 class_id); 5109 class_id);
5110 #else
5111 Value* value = ToApi<Value>(i::Handle<i::Object>(p));
5112 visitor_->VisitPersistentHandle(
5113 reinterpret_cast<Persistent<Value>*>(&value), class_id);
5114 #endif
5109 } 5115 }
5110 private: 5116 private:
5111 PersistentHandleVisitor* visitor_; 5117 PersistentHandleVisitor* visitor_;
5112 }; 5118 };
5113 5119
5114 5120
5115 void v8::V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) { 5121 void v8::V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) {
5116 i::Isolate* isolate = i::Isolate::Current(); 5122 i::Isolate* isolate = i::Isolate::Current();
5117 IsDeadCheck(isolate, "v8::V8::VisitHandlesWithClassId"); 5123 IsDeadCheck(isolate, "v8::V8::VisitHandlesWithClassId");
5118 5124
(...skipping 2784 matching lines...) Expand 10 before | Expand all | Expand 10 after
7903 7909
7904 v->VisitPointers(blocks_.first(), first_block_limit_); 7910 v->VisitPointers(blocks_.first(), first_block_limit_);
7905 7911
7906 for (int i = 1; i < blocks_.length(); i++) { 7912 for (int i = 1; i < blocks_.length(); i++) {
7907 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7913 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7908 } 7914 }
7909 } 7915 }
7910 7916
7911 7917
7912 } } // namespace v8::internal 7918 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698