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

Side by Side Diff: src/api.cc

Issue 402173003: Add bailout checks to Message::Get{Start,End}Column() (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Created 6 years, 5 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 | no next file » | 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 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after
2061 ENTER_V8(isolate); 2061 ENTER_V8(isolate);
2062 i::HandleScope scope(isolate); 2062 i::HandleScope scope(isolate);
2063 i::Handle<i::JSMessageObject> message = 2063 i::Handle<i::JSMessageObject> message =
2064 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 2064 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
2065 return message->end_position(); 2065 return message->end_position();
2066 } 2066 }
2067 2067
2068 2068
2069 int Message::GetStartColumn() const { 2069 int Message::GetStartColumn() const {
2070 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2070 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2071 ON_BAILOUT(isolate, "v8::Message::GetStartColumn()", return kNoColumnInfo);
2071 ENTER_V8(isolate); 2072 ENTER_V8(isolate);
2072 i::HandleScope scope(isolate); 2073 i::HandleScope scope(isolate);
2073 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); 2074 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
2074 EXCEPTION_PREAMBLE(isolate); 2075 EXCEPTION_PREAMBLE(isolate);
2075 i::Handle<i::Object> start_col_obj; 2076 i::Handle<i::Object> start_col_obj;
2076 has_pending_exception = !CallV8HeapFunction( 2077 has_pending_exception = !CallV8HeapFunction(
2077 "GetPositionInLine", data_obj).ToHandle(&start_col_obj); 2078 "GetPositionInLine", data_obj).ToHandle(&start_col_obj);
2078 EXCEPTION_BAILOUT_CHECK(isolate, 0); 2079 EXCEPTION_BAILOUT_CHECK(isolate, 0);
2079 return static_cast<int>(start_col_obj->Number()); 2080 return static_cast<int>(start_col_obj->Number());
2080 } 2081 }
2081 2082
2082 2083
2083 int Message::GetEndColumn() const { 2084 int Message::GetEndColumn() const {
2084 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2085 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2086 ON_BAILOUT(isolate, "v8::Message::GetEndColumn()", return kNoColumnInfo);
2085 ENTER_V8(isolate); 2087 ENTER_V8(isolate);
2086 i::HandleScope scope(isolate); 2088 i::HandleScope scope(isolate);
2087 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); 2089 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
2088 EXCEPTION_PREAMBLE(isolate); 2090 EXCEPTION_PREAMBLE(isolate);
2089 i::Handle<i::Object> start_col_obj; 2091 i::Handle<i::Object> start_col_obj;
2090 has_pending_exception = !CallV8HeapFunction( 2092 has_pending_exception = !CallV8HeapFunction(
2091 "GetPositionInLine", data_obj).ToHandle(&start_col_obj); 2093 "GetPositionInLine", data_obj).ToHandle(&start_col_obj);
2092 EXCEPTION_BAILOUT_CHECK(isolate, 0); 2094 EXCEPTION_BAILOUT_CHECK(isolate, 0);
2093 i::Handle<i::JSMessageObject> message = 2095 i::Handle<i::JSMessageObject> message =
2094 i::Handle<i::JSMessageObject>::cast(data_obj); 2096 i::Handle<i::JSMessageObject>::cast(data_obj);
(...skipping 5508 matching lines...) Expand 10 before | Expand all | Expand 10 after
7603 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7605 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7604 Address callback_address = 7606 Address callback_address =
7605 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7607 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7606 VMState<EXTERNAL> state(isolate); 7608 VMState<EXTERNAL> state(isolate);
7607 ExternalCallbackScope call_scope(isolate, callback_address); 7609 ExternalCallbackScope call_scope(isolate, callback_address);
7608 callback(info); 7610 callback(info);
7609 } 7611 }
7610 7612
7611 7613
7612 } } // namespace v8::internal 7614 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698