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: src/assert-scope.cc

Issue 2635913002: [ast] Remove internalization before AST rewriting (Closed)
Patch Set: Be less stupid Created 3 years, 11 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
« no previous file with comments | « src/assert-scope.h ('k') | src/parsing/rewriter.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/assert-scope.h" 5 #include "src/assert-scope.h"
6 6
7 #include "src/base/lazy-instance.h" 7 #include "src/base/lazy-instance.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 PerThreadAssertData::SetCurrent(data_); 76 PerThreadAssertData::SetCurrent(data_);
77 } 77 }
78 data_->IncrementLevel(); 78 data_->IncrementLevel();
79 old_state_ = data_->Get(kType); 79 old_state_ = data_->Get(kType);
80 data_->Set(kType, kAllow); 80 data_->Set(kType, kAllow);
81 } 81 }
82 82
83 83
84 template <PerThreadAssertType kType, bool kAllow> 84 template <PerThreadAssertType kType, bool kAllow>
85 PerThreadAssertScope<kType, kAllow>::~PerThreadAssertScope() { 85 PerThreadAssertScope<kType, kAllow>::~PerThreadAssertScope() {
86 if (data_ == nullptr) return;
87 Release();
88 }
89
90 template <PerThreadAssertType kType, bool kAllow>
91 void PerThreadAssertScope<kType, kAllow>::Release() {
86 DCHECK_NOT_NULL(data_); 92 DCHECK_NOT_NULL(data_);
87 data_->Set(kType, old_state_); 93 data_->Set(kType, old_state_);
88 if (data_->DecrementLevel()) { 94 if (data_->DecrementLevel()) {
89 PerThreadAssertData::SetCurrent(NULL); 95 PerThreadAssertData::SetCurrent(NULL);
90 delete data_; 96 delete data_;
91 } 97 }
98 data_ = nullptr;
92 } 99 }
93 100
94
95 // static 101 // static
96 template <PerThreadAssertType kType, bool kAllow> 102 template <PerThreadAssertType kType, bool kAllow>
97 bool PerThreadAssertScope<kType, kAllow>::IsAllowed() { 103 bool PerThreadAssertScope<kType, kAllow>::IsAllowed() {
98 PerThreadAssertData* data = PerThreadAssertData::GetCurrent(); 104 PerThreadAssertData* data = PerThreadAssertData::GetCurrent();
99 return data == NULL || data->Get(kType); 105 return data == NULL || data->Get(kType);
100 } 106 }
101 107
102 108
103 template <PerIsolateAssertType kType, bool kAllow> 109 template <PerIsolateAssertType kType, bool kAllow>
104 class PerIsolateAssertScope<kType, kAllow>::DataBit 110 class PerIsolateAssertScope<kType, kAllow>::DataBit
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, true>; 151 template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, true>;
146 template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, false>; 152 template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, false>;
147 template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, true>; 153 template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, true>;
148 template class PerIsolateAssertScope<DEOPTIMIZATION_ASSERT, false>; 154 template class PerIsolateAssertScope<DEOPTIMIZATION_ASSERT, false>;
149 template class PerIsolateAssertScope<DEOPTIMIZATION_ASSERT, true>; 155 template class PerIsolateAssertScope<DEOPTIMIZATION_ASSERT, true>;
150 template class PerIsolateAssertScope<COMPILATION_ASSERT, false>; 156 template class PerIsolateAssertScope<COMPILATION_ASSERT, false>;
151 template class PerIsolateAssertScope<COMPILATION_ASSERT, true>; 157 template class PerIsolateAssertScope<COMPILATION_ASSERT, true>;
152 158
153 } // namespace internal 159 } // namespace internal
154 } // namespace v8 160 } // namespace v8
OLDNEW
« no previous file with comments | « src/assert-scope.h ('k') | src/parsing/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698