OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4103 } | 4103 } |
4104 | 4104 |
4105 | 4105 |
4106 Handle<Value> Function::GetInferredName() const { | 4106 Handle<Value> Function::GetInferredName() const { |
4107 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4107 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
4108 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name(), | 4108 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name(), |
4109 func->GetIsolate())); | 4109 func->GetIsolate())); |
4110 } | 4110 } |
4111 | 4111 |
4112 | 4112 |
4113 Handle<Value> Function::GetDisplayName() const { | |
4114 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | |
4115 ON_BAILOUT(isolate, "v8::Function::GetDisplayName()", | |
4116 return ToApiHandle<Primitive>( | |
4117 isolate->factory()->undefined_value())); | |
4118 ENTER_V8(isolate); | |
4119 i::HandleScope scope(isolate); | |
4120 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | |
4121 i::Handle<i::String> property_name = | |
4122 isolate->factory()->InternalizeOneByteString( | |
4123 STATIC_ASCII_VECTOR("displayName")); | |
4124 i::LookupResult lookup(isolate); | |
4125 func->LookupRealNamedProperty(*property_name, &lookup); | |
4126 if (lookup.IsFound()) { | |
4127 i::Object* value = lookup.GetLazyValue(); | |
4128 if (value && value->IsString()) { | |
4129 i::String* name = i::String::cast(value); | |
4130 if (name->length() > 0) return Utils::ToLocal(i::Handle<i::String>(name)); | |
4131 } | |
4132 } | |
4133 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); | |
4134 } | |
4135 | |
4136 | |
4137 ScriptOrigin Function::GetScriptOrigin() const { | 4113 ScriptOrigin Function::GetScriptOrigin() const { |
4138 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4114 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
4139 if (func->shared()->script()->IsScript()) { | 4115 if (func->shared()->script()->IsScript()) { |
4140 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4116 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
4141 i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); | 4117 i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); |
4142 v8::ScriptOrigin origin( | 4118 v8::ScriptOrigin origin( |
4143 Utils::ToLocal(scriptName), | 4119 Utils::ToLocal(scriptName), |
4144 v8::Integer::New(script->line_offset()->value()), | 4120 v8::Integer::New(script->line_offset()->value()), |
4145 v8::Integer::New(script->column_offset()->value())); | 4121 v8::Integer::New(script->column_offset()->value())); |
4146 return origin; | 4122 return origin; |
(...skipping 3426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7573 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7549 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7574 Address callback_address = | 7550 Address callback_address = |
7575 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7551 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7576 VMState<EXTERNAL> state(isolate); | 7552 VMState<EXTERNAL> state(isolate); |
7577 ExternalCallbackScope call_scope(isolate, callback_address); | 7553 ExternalCallbackScope call_scope(isolate, callback_address); |
7578 callback(info); | 7554 callback(info); |
7579 } | 7555 } |
7580 | 7556 |
7581 | 7557 |
7582 } } // namespace v8::internal | 7558 } } // namespace v8::internal |
OLD | NEW |