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

Side by Side Diff: src/api.cc

Issue 793333003: Correct handling of exceptions occured during getting of exception stack trace. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: offline comments addressed Created 5 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 | « no previous file | test/mjsunit/regress/regress-444805.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 } 1936 }
1937 1937
1938 1938
1939 v8::Local<Value> v8::TryCatch::StackTrace() const { 1939 v8::Local<Value> v8::TryCatch::StackTrace() const {
1940 if (HasCaught()) { 1940 if (HasCaught()) {
1941 i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_); 1941 i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_);
1942 if (!raw_obj->IsJSObject()) return v8::Local<Value>(); 1942 if (!raw_obj->IsJSObject()) return v8::Local<Value>();
1943 i::HandleScope scope(isolate_); 1943 i::HandleScope scope(isolate_);
1944 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_); 1944 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_);
1945 i::Handle<i::String> name = isolate_->factory()->stack_string(); 1945 i::Handle<i::String> name = isolate_->factory()->stack_string();
1946 {
1947 EXCEPTION_PREAMBLE(isolate_);
1948 Maybe<bool> maybe = i::JSReceiver::HasProperty(obj, name);
1949 has_pending_exception = !maybe.has_value;
1950 EXCEPTION_BAILOUT_CHECK(isolate_, v8::Local<Value>());
1951 if (!maybe.value) return v8::Local<Value>();
1952 }
1953 i::Handle<i::Object> value;
1946 EXCEPTION_PREAMBLE(isolate_); 1954 EXCEPTION_PREAMBLE(isolate_);
1947 Maybe<bool> maybe = i::JSReceiver::HasProperty(obj, name); 1955 has_pending_exception = !i::Object::GetProperty(obj, name).ToHandle(&value);
1948 has_pending_exception = !maybe.has_value;
1949 EXCEPTION_BAILOUT_CHECK(isolate_, v8::Local<Value>()); 1956 EXCEPTION_BAILOUT_CHECK(isolate_, v8::Local<Value>());
1950 if (!maybe.value) return v8::Local<Value>();
1951 i::Handle<i::Object> value;
1952 if (!i::Object::GetProperty(obj, name).ToHandle(&value)) {
1953 return v8::Local<Value>();
1954 }
1955 return v8::Utils::ToLocal(scope.CloseAndEscape(value)); 1957 return v8::Utils::ToLocal(scope.CloseAndEscape(value));
1956 } else { 1958 } else {
1957 return v8::Local<Value>(); 1959 return v8::Local<Value>();
1958 } 1960 }
1959 } 1961 }
1960 1962
1961 1963
1962 v8::Local<v8::Message> v8::TryCatch::Message() const { 1964 v8::Local<v8::Message> v8::TryCatch::Message() const {
1963 i::Object* message = reinterpret_cast<i::Object*>(message_obj_); 1965 i::Object* message = reinterpret_cast<i::Object*>(message_obj_);
1964 DCHECK(message->IsJSMessageObject() || message->IsTheHole()); 1966 DCHECK(message->IsJSMessageObject() || message->IsTheHole());
(...skipping 5795 matching lines...) Expand 10 before | Expand all | Expand 10 after
7760 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7762 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7761 Address callback_address = 7763 Address callback_address =
7762 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7764 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7763 VMState<EXTERNAL> state(isolate); 7765 VMState<EXTERNAL> state(isolate);
7764 ExternalCallbackScope call_scope(isolate, callback_address); 7766 ExternalCallbackScope call_scope(isolate, callback_address);
7765 callback(info); 7767 callback(info);
7766 } 7768 }
7767 7769
7768 7770
7769 } } // namespace v8::internal 7771 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-444805.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698