Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 571f2ca3c5800810d93853080ab825b743722056..4d77c5b65b20b7b5849fa4f723fb19633d08ac19 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -2449,16 +2449,12 @@ v8::Local<v8::StackTrace> Message::GetStackTrace() const { |
| Maybe<int> Message::GetLineNumber(Local<Context> context) const { |
| - PREPARE_FOR_EXECUTION_PRIMITIVE(context, Message, GetLineNumber, int); |
| - i::Handle<i::JSFunction> fun = isolate->message_get_line_number(); |
| - i::Handle<i::Object> undefined = isolate->factory()->undefined_value(); |
| - i::Handle<i::Object> args[] = {Utils::OpenHandle(this)}; |
| - i::Handle<i::Object> result; |
| - has_pending_exception = |
| - !i::Execution::Call(isolate, fun, undefined, arraysize(args), args) |
| - .ToHandle(&result); |
| - RETURN_ON_FAILED_EXECUTION_PRIMITIVE(int); |
| - return Just(static_cast<int>(result->Number())); |
| + auto self = Utils::OpenHandle(this); |
| + i::Isolate* isolate = self->GetIsolate(); |
| + ENTER_V8(isolate); |
| + EscapableHandleScope handle_scope(reinterpret_cast<Isolate*>(isolate)); |
| + auto msg = i::Handle<i::JSMessageObject>::cast(self); |
| + return Just(msg->GetLineNumber()); |
|
jgruber
2016/08/08 14:00:18
Here and all other cases below: even though this i
jgruber
2016/08/08 14:04:06
The failing test is test-api/PromiseRejectCallback
Yang
2016/08/10 09:03:18
As discussed, let's leave the API.
|
| } |
| @@ -2481,16 +2477,12 @@ int Message::GetEndPosition() const { |
| Maybe<int> Message::GetStartColumn(Local<Context> context) const { |
| - PREPARE_FOR_EXECUTION_PRIMITIVE(context, Message, GetStartColumn, int); |
| - i::Handle<i::JSFunction> fun = isolate->message_get_column_number(); |
| - i::Handle<i::Object> undefined = isolate->factory()->undefined_value(); |
| - i::Handle<i::Object> args[] = {Utils::OpenHandle(this)}; |
| - i::Handle<i::Object> result; |
| - has_pending_exception = |
| - !i::Execution::Call(isolate, fun, undefined, arraysize(args), args) |
| - .ToHandle(&result); |
| - RETURN_ON_FAILED_EXECUTION_PRIMITIVE(int); |
| - return Just(static_cast<int>(result->Number())); |
| + auto self = Utils::OpenHandle(this); |
| + i::Isolate* isolate = self->GetIsolate(); |
| + ENTER_V8(isolate); |
| + EscapableHandleScope handle_scope(reinterpret_cast<Isolate*>(isolate)); |
| + auto msg = i::Handle<i::JSMessageObject>::cast(self); |
| + return Just(msg->GetColumnNumber()); |
| } |
| @@ -2503,18 +2495,15 @@ int Message::GetStartColumn() const { |
| Maybe<int> Message::GetEndColumn(Local<Context> context) const { |
| auto self = Utils::OpenHandle(this); |
| - PREPARE_FOR_EXECUTION_PRIMITIVE(context, Message, GetEndColumn, int); |
| - i::Handle<i::JSFunction> fun = isolate->message_get_column_number(); |
| - i::Handle<i::Object> undefined = isolate->factory()->undefined_value(); |
| - i::Handle<i::Object> args[] = {self}; |
| - i::Handle<i::Object> result; |
| - has_pending_exception = |
| - !i::Execution::Call(isolate, fun, undefined, arraysize(args), args) |
| - .ToHandle(&result); |
| - RETURN_ON_FAILED_EXECUTION_PRIMITIVE(int); |
| - int start = self->start_position(); |
| - int end = self->end_position(); |
| - return Just(static_cast<int>(result->Number()) + (end - start)); |
| + i::Isolate* isolate = self->GetIsolate(); |
| + ENTER_V8(isolate); |
| + EscapableHandleScope handle_scope(reinterpret_cast<Isolate*>(isolate)); |
| + auto msg = i::Handle<i::JSMessageObject>::cast(self); |
| + const int column_number = msg->GetColumnNumber(); |
| + if (column_number == -1) return Just(-1); |
|
jgruber
2016/08/08 14:00:18
This is a behavior change. Previously any error wa
|
| + const int start = self->start_position(); |
| + const int end = self->end_position(); |
| + return Just(column_number + (end - start)); |
| } |
| @@ -2547,20 +2536,12 @@ bool Message::IsOpaque() const { |
| MaybeLocal<String> Message::GetSourceLine(Local<Context> context) const { |
| - PREPARE_FOR_EXECUTION(context, Message, GetSourceLine, String); |
| - i::Handle<i::JSFunction> fun = isolate->message_get_source_line(); |
| - i::Handle<i::Object> undefined = isolate->factory()->undefined_value(); |
| - i::Handle<i::Object> args[] = {Utils::OpenHandle(this)}; |
| - i::Handle<i::Object> result; |
| - has_pending_exception = |
| - !i::Execution::Call(isolate, fun, undefined, arraysize(args), args) |
| - .ToHandle(&result); |
| - RETURN_ON_FAILED_EXECUTION(String); |
| - Local<String> str; |
| - if (result->IsString()) { |
| - str = Utils::ToLocal(i::Handle<i::String>::cast(result)); |
| - } |
| - RETURN_ESCAPED(str); |
| + auto self = Utils::OpenHandle(this); |
| + i::Isolate* isolate = self->GetIsolate(); |
| + ENTER_V8(isolate); |
| + EscapableHandleScope handle_scope(reinterpret_cast<Isolate*>(isolate)); |
| + auto msg = i::Handle<i::JSMessageObject>::cast(self); |
| + RETURN_ESCAPED(Utils::ToLocal(msg->GetSourceLine())); |
| } |