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

Side by Side Diff: src/api.cc

Issue 198253004: Introduce per-isolate assert scopes and API to guard JS execution. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: add missing file Created 6 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
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 6496 matching lines...) Expand 10 before | Expand all | Expand 10 after
6507 isolate->Enter(); 6507 isolate->Enter();
6508 } 6508 }
6509 6509
6510 6510
6511 void Isolate::Exit() { 6511 void Isolate::Exit() {
6512 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6512 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6513 isolate->Exit(); 6513 isolate->Exit();
6514 } 6514 }
6515 6515
6516 6516
6517 Isolate::DisallowJavascriptExecutionScope::DisallowJavascriptExecutionScope(
6518 Isolate* isolate) {
6519 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6520 internal_ = reinterpret_cast<void*>(
6521 new i::DisallowJavascriptExecution(i_isolate));
6522 }
6523
6524
6525 Isolate::DisallowJavascriptExecutionScope::~DisallowJavascriptExecutionScope() {
6526 delete reinterpret_cast<i::DisallowJavascriptExecution*>(internal_);
6527 }
6528
6529
6530 Isolate::AllowJavascriptExecutionScope::AllowJavascriptExecutionScope(
6531 Isolate* isolate) {
6532 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6533 internal_ = reinterpret_cast<void*>(
6534 new i::AllowJavascriptExecution(i_isolate));
6535 }
6536
6537
6538 Isolate::AllowJavascriptExecutionScope::~AllowJavascriptExecutionScope() {
6539 delete reinterpret_cast<i::AllowJavascriptExecution*>(internal_);
6540 }
6541
6542
6517 void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { 6543 void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) {
6518 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6544 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6519 if (!isolate->IsInitialized()) { 6545 if (!isolate->IsInitialized()) {
6520 heap_statistics->total_heap_size_ = 0; 6546 heap_statistics->total_heap_size_ = 0;
6521 heap_statistics->total_heap_size_executable_ = 0; 6547 heap_statistics->total_heap_size_executable_ = 0;
6522 heap_statistics->total_physical_size_ = 0; 6548 heap_statistics->total_physical_size_ = 0;
6523 heap_statistics->used_heap_size_ = 0; 6549 heap_statistics->used_heap_size_ = 0;
6524 heap_statistics->heap_size_limit_ = 0; 6550 heap_statistics->heap_size_limit_ = 0;
6525 return; 6551 return;
6526 } 6552 }
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
7505 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7531 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7506 Address callback_address = 7532 Address callback_address =
7507 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7533 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7508 VMState<EXTERNAL> state(isolate); 7534 VMState<EXTERNAL> state(isolate);
7509 ExternalCallbackScope call_scope(isolate, callback_address); 7535 ExternalCallbackScope call_scope(isolate, callback_address);
7510 callback(info); 7536 callback(info);
7511 } 7537 }
7512 7538
7513 7539
7514 } } // namespace v8::internal 7540 } } // namespace v8::internal
OLDNEW
« include/v8.h ('K') | « include/v8.h ('k') | src/assert-scope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698