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 4287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4298 | 4298 |
4299 | 4299 |
4300 int Function::ScriptId() const { | 4300 int Function::ScriptId() const { |
4301 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4301 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
4302 if (!func->shared()->script()->IsScript()) return v8::Script::kNoScriptId; | 4302 if (!func->shared()->script()->IsScript()) return v8::Script::kNoScriptId; |
4303 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4303 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
4304 return script->id()->value(); | 4304 return script->id()->value(); |
4305 } | 4305 } |
4306 | 4306 |
4307 | 4307 |
| 4308 Local<v8::Value> Function::GetBoundFunction() const { |
| 4309 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4310 if (!func->shared()->bound()) { |
| 4311 return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate())); |
| 4312 } |
| 4313 i::Handle<i::FixedArray> bound_args = i::Handle<i::FixedArray>( |
| 4314 i::FixedArray::cast(func->function_bindings())); |
| 4315 i::Handle<i::Object> original( |
| 4316 bound_args->get(i::JSFunction::kBoundFunctionIndex), |
| 4317 func->GetIsolate()); |
| 4318 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(original)); |
| 4319 } |
| 4320 |
| 4321 |
4308 int String::Length() const { | 4322 int String::Length() const { |
4309 i::Handle<i::String> str = Utils::OpenHandle(this); | 4323 i::Handle<i::String> str = Utils::OpenHandle(this); |
4310 return str->length(); | 4324 return str->length(); |
4311 } | 4325 } |
4312 | 4326 |
4313 | 4327 |
4314 bool String::IsOneByte() const { | 4328 bool String::IsOneByte() const { |
4315 i::Handle<i::String> str = Utils::OpenHandle(this); | 4329 i::Handle<i::String> str = Utils::OpenHandle(this); |
4316 return str->HasOnlyOneByteChars(); | 4330 return str->HasOnlyOneByteChars(); |
4317 } | 4331 } |
(...skipping 3453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7771 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7785 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7772 Address callback_address = | 7786 Address callback_address = |
7773 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7787 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7774 VMState<EXTERNAL> state(isolate); | 7788 VMState<EXTERNAL> state(isolate); |
7775 ExternalCallbackScope call_scope(isolate, callback_address); | 7789 ExternalCallbackScope call_scope(isolate, callback_address); |
7776 callback(info); | 7790 callback(info); |
7777 } | 7791 } |
7778 | 7792 |
7779 | 7793 |
7780 } } // namespace v8::internal | 7794 } } // namespace v8::internal |
OLD | NEW |