Skip to content

Commit 99c7f8c

Browse files
committed
deps: backport 224d376 from V8 upstream
Orignial commit message: Abort in delete operators that shouldn't be called. Section 3.2 of the C++ standard states that destructor definitions implicitly "use" operator delete functions. Therefore, these operator delete functions must be defined even if they are never called by user code explicitly. http://www.open-std.org/JTC1/SC22/WG21/docs/ cwg_defects.html#261 gcc allows them to remain as empty definitions. However, not all compilers allow this. (e.g. xlc on zOS). This pull request creates definitions which if ever called, result in an abort. R=danno@chromium.org,jochen@chromium.org BUG= LOG=N Review-Url: https://codereview.chromium.org/2588433002 Cr-Commit-Position: refs/heads/master@{#41981}
1 parent d9ac34c commit 99c7f8c

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

deps/v8/include/v8-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 5
1212
#define V8_MINOR_VERSION 4
1313
#define V8_BUILD_NUMBER 500
14-
#define V8_PATCH_LEVEL 45
14+
#define V8_PATCH_LEVEL 46
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/api.cc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,12 @@ HandleScope::~HandleScope() {
875875
i::HandleScope::CloseScope(isolate_, prev_next_, prev_limit_);
876876
}
877877

878+
V8_NORETURN void* HandleScope::operator new(size_t) {
879+
base::OS::Abort();
880+
abort();
881+
}
882+
883+
void HandleScope::operator delete(void*, size_t) { base::OS::Abort(); }
878884

879885
int HandleScope::NumberOfHandles(Isolate* isolate) {
880886
return i::HandleScope::NumberOfHandles(
@@ -913,6 +919,13 @@ i::Object** EscapableHandleScope::Escape(i::Object** escape_value) {
913919
return escape_slot_;
914920
}
915921

922+
V8_NORETURN void* EscapableHandleScope::operator new(size_t) {
923+
base::OS::Abort();
924+
abort();
925+
}
926+
927+
void EscapableHandleScope::operator delete(void*, size_t) { base::OS::Abort(); }
928+
916929
SealHandleScope::SealHandleScope(Isolate* isolate)
917930
: isolate_(reinterpret_cast<i::Isolate*>(isolate)) {
918931
i::HandleScopeData* current = isolate_->handle_scope_data();
@@ -931,6 +944,12 @@ SealHandleScope::~SealHandleScope() {
931944
current->sealed_level = prev_sealed_level_;
932945
}
933946

947+
V8_NORETURN void* SealHandleScope::operator new(size_t) {
948+
base::OS::Abort();
949+
abort();
950+
}
951+
952+
void SealHandleScope::operator delete(void*, size_t) { base::OS::Abort(); }
934953

935954
void Context::Enter() {
936955
i::Handle<i::Context> env = Utils::OpenHandle(this);
@@ -2315,6 +2334,12 @@ v8::TryCatch::~TryCatch() {
23152334
}
23162335
}
23172336

2337+
V8_NORETURN void* v8::TryCatch::operator new(size_t) {
2338+
base::OS::Abort();
2339+
abort();
2340+
}
2341+
2342+
void v8::TryCatch::operator delete(void*, size_t) { base::OS::Abort(); }
23182343

23192344
bool v8::TryCatch::HasCaught() const {
23202345
return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(isolate_);

0 commit comments

Comments
 (0)