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

Side by Side Diff: src/objects.cc

Issue 1009603003: Add debug checks to catch crashes with WeakCell::cast(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/isolate.cc ('k') | src/objects-inl.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 10346 matching lines...) Expand 10 before | Expand all | Expand 10 after
10357 if (!Execution::TryCall(method, script_wrapper, 0, NULL).ToHandle(&result)) { 10357 if (!Execution::TryCall(method, script_wrapper, 0, NULL).ToHandle(&result)) {
10358 return isolate->factory()->undefined_value(); 10358 return isolate->factory()->undefined_value();
10359 } 10359 }
10360 return result; 10360 return result;
10361 } 10361 }
10362 10362
10363 10363
10364 Handle<JSObject> Script::GetWrapper(Handle<Script> script) { 10364 Handle<JSObject> Script::GetWrapper(Handle<Script> script) {
10365 Isolate* isolate = script->GetIsolate(); 10365 Isolate* isolate = script->GetIsolate();
10366 if (!script->wrapper()->IsUndefined()) { 10366 if (!script->wrapper()->IsUndefined()) {
10367 DCHECK(script->wrapper()->IsWeakCell());
10367 Handle<WeakCell> cell(WeakCell::cast(script->wrapper())); 10368 Handle<WeakCell> cell(WeakCell::cast(script->wrapper()));
10368 if (!cell->cleared()) { 10369 if (!cell->cleared()) {
10369 // Return a handle for the existing script wrapper from the cache. 10370 // Return a handle for the existing script wrapper from the cache.
10370 return handle(JSObject::cast(cell->value())); 10371 return handle(JSObject::cast(cell->value()));
10371 } 10372 }
10372 // If we found an empty WeakCell, that means the script wrapper was 10373 // If we found an empty WeakCell, that means the script wrapper was
10373 // GCed. We are not notified directly of that, so we decrement here 10374 // GCed. We are not notified directly of that, so we decrement here
10374 // so that we at least don't count double for any given script. 10375 // so that we at least don't count double for any given script.
10375 isolate->counters()->script_wrappers()->Decrement(); 10376 isolate->counters()->script_wrappers()->Decrement();
10376 } 10377 }
(...skipping 6702 matching lines...) Expand 10 before | Expand all | Expand 10 after
17079 CompilationInfo* info) { 17080 CompilationInfo* info) {
17080 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( 17081 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo(
17081 handle(cell->dependent_code(), info->isolate()), 17082 handle(cell->dependent_code(), info->isolate()),
17082 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); 17083 DependentCode::kPropertyCellChangedGroup, info->object_wrapper());
17083 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 17084 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
17084 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 17085 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
17085 cell, info->zone()); 17086 cell, info->zone());
17086 } 17087 }
17087 17088
17088 } } // namespace v8::internal 17089 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698