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

Side by Side Diff: src/api.cc

Issue 203223013: Introduce API to trigger exception on JS execution. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment 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 6497 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 6517 Isolate::DisallowJavascriptExecutionScope::DisallowJavascriptExecutionScope(
6518 Isolate* isolate) { 6518 Isolate* isolate,
6519 Isolate::DisallowJavascriptExecutionScope::OnFailure on_failure)
6520 : on_failure_(on_failure) {
6519 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 6521 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6520 internal_ = reinterpret_cast<void*>( 6522 if (on_failure_ == CRASH_ON_FAILURE) {
6521 new i::DisallowJavascriptExecution(i_isolate)); 6523 internal_ = reinterpret_cast<void*>(
6524 new i::DisallowJavascriptExecution(i_isolate));
6525 } else {
6526 ASSERT_EQ(THROW_ON_FAILURE, on_failure);
6527 internal_ = reinterpret_cast<void*>(
6528 new i::ThrowOnJavascriptExecution(i_isolate));
6529 }
6522 } 6530 }
6523 6531
6524 6532
6525 Isolate::DisallowJavascriptExecutionScope::~DisallowJavascriptExecutionScope() { 6533 Isolate::DisallowJavascriptExecutionScope::~DisallowJavascriptExecutionScope() {
6526 delete reinterpret_cast<i::DisallowJavascriptExecution*>(internal_); 6534 if (on_failure_ == CRASH_ON_FAILURE) {
6535 delete reinterpret_cast<i::DisallowJavascriptExecution*>(internal_);
6536 } else {
6537 delete reinterpret_cast<i::ThrowOnJavascriptExecution*>(internal_);
6538 }
6527 } 6539 }
6528 6540
6529 6541
6530 Isolate::AllowJavascriptExecutionScope::AllowJavascriptExecutionScope( 6542 Isolate::AllowJavascriptExecutionScope::AllowJavascriptExecutionScope(
6531 Isolate* isolate) { 6543 Isolate* isolate) {
6532 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 6544 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6533 internal_ = reinterpret_cast<void*>( 6545 internal_assert_ = reinterpret_cast<void*>(
6534 new i::AllowJavascriptExecution(i_isolate)); 6546 new i::AllowJavascriptExecution(i_isolate));
6547 internal_throws_ = reinterpret_cast<void*>(
6548 new i::NoThrowOnJavascriptExecution(i_isolate));
6535 } 6549 }
6536 6550
6537 6551
6538 Isolate::AllowJavascriptExecutionScope::~AllowJavascriptExecutionScope() { 6552 Isolate::AllowJavascriptExecutionScope::~AllowJavascriptExecutionScope() {
6539 delete reinterpret_cast<i::AllowJavascriptExecution*>(internal_); 6553 delete reinterpret_cast<i::AllowJavascriptExecution*>(internal_assert_);
6554 delete reinterpret_cast<i::NoThrowOnJavascriptExecution*>(internal_throws_);
6540 } 6555 }
6541 6556
6542 6557
6543 void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { 6558 void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) {
6544 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6559 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6545 if (!isolate->IsInitialized()) { 6560 if (!isolate->IsInitialized()) {
6546 heap_statistics->total_heap_size_ = 0; 6561 heap_statistics->total_heap_size_ = 0;
6547 heap_statistics->total_heap_size_executable_ = 0; 6562 heap_statistics->total_heap_size_executable_ = 0;
6548 heap_statistics->total_physical_size_ = 0; 6563 heap_statistics->total_physical_size_ = 0;
6549 heap_statistics->used_heap_size_ = 0; 6564 heap_statistics->used_heap_size_ = 0;
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
7528 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7543 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7529 Address callback_address = 7544 Address callback_address =
7530 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7545 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7531 VMState<EXTERNAL> state(isolate); 7546 VMState<EXTERNAL> state(isolate);
7532 ExternalCallbackScope call_scope(isolate, callback_address); 7547 ExternalCallbackScope call_scope(isolate, callback_address);
7533 callback(info); 7548 callback(info);
7534 } 7549 }
7535 7550
7536 7551
7537 } } // namespace v8::internal 7552 } } // 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