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 4094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4105 } | 4105 } |
4106 | 4106 |
4107 | 4107 |
4108 Handle<Value> Function::GetInferredName() const { | 4108 Handle<Value> Function::GetInferredName() const { |
4109 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4109 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
4110 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name(), | 4110 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name(), |
4111 func->GetIsolate())); | 4111 func->GetIsolate())); |
4112 } | 4112 } |
4113 | 4113 |
4114 | 4114 |
4115 Handle<Value> Function::GetDisplayName() const { | |
yurys
2013/10/16 14:57:52
If you anyways return either empty handle or Strin
aandrey
2013/10/16 15:25:19
I guess we can, but there are 2 similar methods de
yurys
2013/10/17 07:40:19
That's because they will return Undefined when the
| |
4116 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | |
4117 ON_BAILOUT(isolate, "v8::Function::GetDisplayName()", | |
4118 return Local<v8::Value>()); | |
4119 ENTER_V8(isolate); | |
4120 i::HandleScope scope(isolate); | |
4121 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | |
4122 i::Handle<i::String> property_name = | |
4123 isolate->factory()->InternalizeOneByteString( | |
4124 STATIC_ASCII_VECTOR("displayName")); | |
4125 i::LookupResult lookup(isolate); | |
4126 func->LookupRealNamedProperty(*property_name, &lookup); | |
yurys
2013/10/16 14:57:52
Should we count displayName property declared on p
aandrey
2013/10/16 15:19:45
I think we should. And this code does look up on p
| |
4127 if (!lookup.IsFound()) return Local<v8::Value>(); | |
4128 i::Object* value = lookup.GetLazyValue(); | |
4129 if (value && value->IsString()) { | |
4130 i::String* name = i::String::cast(value); | |
4131 if (name->length() > 0) return Utils::ToLocal(i::Handle<i::String>(name)); | |
4132 } | |
4133 return Local<v8::Value>(); | |
4134 } | |
4135 | |
4136 | |
4115 ScriptOrigin Function::GetScriptOrigin() const { | 4137 ScriptOrigin Function::GetScriptOrigin() const { |
4116 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4138 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
4117 if (func->shared()->script()->IsScript()) { | 4139 if (func->shared()->script()->IsScript()) { |
4118 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4140 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
4119 i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); | 4141 i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); |
4120 v8::ScriptOrigin origin( | 4142 v8::ScriptOrigin origin( |
4121 Utils::ToLocal(scriptName), | 4143 Utils::ToLocal(scriptName), |
4122 v8::Integer::New(script->line_offset()->value()), | 4144 v8::Integer::New(script->line_offset()->value()), |
4123 v8::Integer::New(script->column_offset()->value())); | 4145 v8::Integer::New(script->column_offset()->value())); |
4124 return origin; | 4146 return origin; |
(...skipping 3419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7544 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7566 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7545 Address callback_address = | 7567 Address callback_address = |
7546 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7568 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7547 VMState<EXTERNAL> state(isolate); | 7569 VMState<EXTERNAL> state(isolate); |
7548 ExternalCallbackScope call_scope(isolate, callback_address); | 7570 ExternalCallbackScope call_scope(isolate, callback_address); |
7549 callback(info); | 7571 callback(info); |
7550 } | 7572 } |
7551 | 7573 |
7552 | 7574 |
7553 } } // namespace v8::internal | 7575 } } // namespace v8::internal |
OLD | NEW |