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

Side by Side Diff: src/api.cc

Issue 12989019: Put zapping of local handles behind the extra checks flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Jakob Kummerow. Created 7 years, 9 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/api.h ('k') | src/apiutils.h » ('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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 } 470 }
471 471
472 472
473 void V8::SetAllowCodeGenerationFromStringsCallback( 473 void V8::SetAllowCodeGenerationFromStringsCallback(
474 AllowCodeGenerationFromStringsCallback callback) { 474 AllowCodeGenerationFromStringsCallback callback) {
475 i::Isolate* isolate = EnterIsolateIfNeeded(); 475 i::Isolate* isolate = EnterIsolateIfNeeded();
476 isolate->set_allow_code_gen_callback(callback); 476 isolate->set_allow_code_gen_callback(callback);
477 } 477 }
478 478
479 479
480 #ifdef DEBUG
481 void ImplementationUtilities::ZapHandleRange(i::Object** begin,
482 i::Object** end) {
483 i::HandleScope::ZapRange(begin, end);
484 }
485 #endif
486
487
488 void V8::SetFlagsFromString(const char* str, int length) { 480 void V8::SetFlagsFromString(const char* str, int length) {
489 i::FlagList::SetFlagsFromString(str, length); 481 i::FlagList::SetFlagsFromString(str, length);
490 } 482 }
491 483
492 484
493 void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) { 485 void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
494 i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags); 486 i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags);
495 } 487 }
496 488
497 489
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 v8::ImplementationUtilities::HandleScopeData* current = 691 v8::ImplementationUtilities::HandleScopeData* current =
700 isolate_->handle_scope_data(); 692 isolate_->handle_scope_data();
701 current->level--; 693 current->level--;
702 ASSERT(current->level >= 0); 694 ASSERT(current->level >= 0);
703 current->next = prev_next_; 695 current->next = prev_next_;
704 if (current->limit != prev_limit_) { 696 if (current->limit != prev_limit_) {
705 current->limit = prev_limit_; 697 current->limit = prev_limit_;
706 i::HandleScope::DeleteExtensions(isolate_); 698 i::HandleScope::DeleteExtensions(isolate_);
707 } 699 }
708 700
709 #ifdef DEBUG 701 #ifdef ENABLE_EXTRA_CHECKS
710 i::HandleScope::ZapRange(prev_next_, prev_limit_); 702 i::HandleScope::ZapRange(prev_next_, prev_limit_);
711 #endif 703 #endif
712 } 704 }
713 705
714 706
715 int HandleScope::NumberOfHandles() { 707 int HandleScope::NumberOfHandles() {
716 i::Isolate* isolate = i::Isolate::Current(); 708 i::Isolate* isolate = i::Isolate::Current();
717 if (!EnsureInitializedForIsolate(isolate, "HandleScope::NumberOfHandles")) { 709 if (!EnsureInitializedForIsolate(isolate, "HandleScope::NumberOfHandles")) {
718 return 0; 710 return 0;
719 } 711 }
(...skipping 6326 matching lines...) Expand 10 before | Expand all | Expand 10 after
7046 void HandleScopeImplementer::BeginDeferredScope() { 7038 void HandleScopeImplementer::BeginDeferredScope() {
7047 ASSERT(last_handle_before_deferred_block_ == NULL); 7039 ASSERT(last_handle_before_deferred_block_ == NULL);
7048 last_handle_before_deferred_block_ = isolate()->handle_scope_data()->next; 7040 last_handle_before_deferred_block_ = isolate()->handle_scope_data()->next;
7049 } 7041 }
7050 7042
7051 7043
7052 DeferredHandles::~DeferredHandles() { 7044 DeferredHandles::~DeferredHandles() {
7053 isolate_->UnlinkDeferredHandles(this); 7045 isolate_->UnlinkDeferredHandles(this);
7054 7046
7055 for (int i = 0; i < blocks_.length(); i++) { 7047 for (int i = 0; i < blocks_.length(); i++) {
7056 #ifdef DEBUG 7048 #ifdef ENABLE_EXTRA_CHECKS
7057 HandleScope::ZapRange(blocks_[i], &blocks_[i][kHandleBlockSize]); 7049 HandleScope::ZapRange(blocks_[i], &blocks_[i][kHandleBlockSize]);
7058 #endif 7050 #endif
7059 isolate_->handle_scope_implementer()->ReturnBlock(blocks_[i]); 7051 isolate_->handle_scope_implementer()->ReturnBlock(blocks_[i]);
7060 } 7052 }
7061 } 7053 }
7062 7054
7063 7055
7064 void DeferredHandles::Iterate(ObjectVisitor* v) { 7056 void DeferredHandles::Iterate(ObjectVisitor* v) {
7065 ASSERT(!blocks_.is_empty()); 7057 ASSERT(!blocks_.is_empty());
7066 7058
7067 ASSERT((first_block_limit_ >= blocks_.first()) && 7059 ASSERT((first_block_limit_ >= blocks_.first()) &&
7068 (first_block_limit_ <= &(blocks_.first())[kHandleBlockSize])); 7060 (first_block_limit_ <= &(blocks_.first())[kHandleBlockSize]));
7069 7061
7070 v->VisitPointers(blocks_.first(), first_block_limit_); 7062 v->VisitPointers(blocks_.first(), first_block_limit_);
7071 7063
7072 for (int i = 1; i < blocks_.length(); i++) { 7064 for (int i = 1; i < blocks_.length(); i++) {
7073 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7065 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7074 } 7066 }
7075 } 7067 }
7076 7068
7077 7069
7078 } } // namespace v8::internal 7070 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.h ('k') | src/apiutils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698