| Index: src/messages.cc
|
| diff --git a/src/messages.cc b/src/messages.cc
|
| index 1c07854fb55bb9355414527f50855670c5a292a6..7dc5f64f00c9e3ee9966e8105dfc6a0a64970728 100644
|
| --- a/src/messages.cc
|
| +++ b/src/messages.cc
|
| @@ -163,6 +163,85 @@ SmartArrayPointer<char> MessageHandler::GetLocalizedMessage(
|
| }
|
|
|
|
|
| +Handle<Object> CallSite::GetFileName(Isolate* isolate) {
|
| + Handle<Object> script(fun_->shared()->script(), isolate);
|
| + if (script->IsScript()) {
|
| + return Handle<Object>(Handle<Script>::cast(script)->name(), isolate);
|
| + }
|
| + return isolate->factory()->null_value();
|
| +}
|
| +
|
| +
|
| +Handle<Object> CallSite::GetFunctionName(Isolate* isolate) {
|
| + Handle<String> result = JSFunction::GetDebugName(fun_);
|
| + if (result->length() != 0) return result;
|
| + Handle<Object> script(fun_->shared()->script(), isolate);
|
| + if (script->IsScript() &&
|
| + Handle<Script>::cast(script)->compilation_type() ==
|
| + Script::COMPILATION_TYPE_EVAL) {
|
| + return isolate->factory()->eval_string();
|
| + }
|
| + return isolate->factory()->null_value();
|
| +}
|
| +
|
| +
|
| +Handle<Object> CallSite::GetScriptNameOrSourceUrl(Isolate* isolate) {
|
| + Handle<Object> script_obj(fun_->shared()->script(), isolate);
|
| + if (script_obj->IsScript()) {
|
| + Handle<Script> script = Handle<Script>::cast(script_obj);
|
| + Object* source_url = script->source_url();
|
| + if (source_url->IsString()) return Handle<Object>(source_url, isolate);
|
| + return Handle<Object>(script->name(), isolate);
|
| + }
|
| + return isolate->factory()->null_value();
|
| +}
|
| +
|
| +
|
| +int CallSite::GetLineNumber(Isolate* isolate) {
|
| + if (pos_ >= 0) {
|
| + Handle<Object> script_obj(fun_->shared()->script(), isolate);
|
| + if (script_obj->IsScript()) {
|
| + Handle<Script> script = Handle<Script>::cast(script_obj);
|
| + return Script::GetLineNumber(script, pos_) + 1;
|
| + }
|
| + }
|
| + return -1;
|
| +}
|
| +
|
| +
|
| +int CallSite::GetColumnNumber(Isolate* isolate) {
|
| + if (pos_ >= 0) {
|
| + Handle<Object> script_obj(fun_->shared()->script(), isolate);
|
| + if (script_obj->IsScript()) {
|
| + Handle<Script> script = Handle<Script>::cast(script_obj);
|
| + return Script::GetColumnNumber(script, pos_) + 1;
|
| + }
|
| + }
|
| + return -1;
|
| +}
|
| +
|
| +
|
| +bool CallSite::IsNative(Isolate* isolate) {
|
| + Handle<Object> script(fun_->shared()->script(), isolate);
|
| + return script->IsScript() &&
|
| + Handle<Script>::cast(script)->type()->value() == Script::TYPE_NATIVE;
|
| +}
|
| +
|
| +
|
| +bool CallSite::IsToplevel(Isolate* isolate) {
|
| + return receiver_->IsJSGlobalProxy() || receiver_->IsNull() ||
|
| + receiver_->IsUndefined();
|
| +}
|
| +
|
| +
|
| +bool CallSite::IsEval(Isolate* isolate) {
|
| + Handle<Object> script(fun_->shared()->script(), isolate);
|
| + return script->IsScript() &&
|
| + Handle<Script>::cast(script)->compilation_type() ==
|
| + Script::COMPILATION_TYPE_EVAL;
|
| +}
|
| +
|
| +
|
| MaybeHandle<String> MessageTemplate::FormatMessage(int template_index,
|
| Handle<String> arg0,
|
| Handle<String> arg1,
|
|
|