OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 2440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2451 func->shared()->set_name(*Utils::OpenHandle(*name)); | 2451 func->shared()->set_name(*Utils::OpenHandle(*name)); |
2452 } | 2452 } |
2453 | 2453 |
2454 | 2454 |
2455 Handle<Value> Function::GetName() const { | 2455 Handle<Value> Function::GetName() const { |
2456 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 2456 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
2457 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->name())); | 2457 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->name())); |
2458 } | 2458 } |
2459 | 2459 |
2460 | 2460 |
| 2461 ScriptOrigin Function::GetScriptOrigin() const { |
| 2462 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 2463 if (func->shared()->script()->IsScript()) { |
| 2464 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 2465 v8::ScriptOrigin origin( |
| 2466 Utils::ToLocal(i::Handle<i::Object>(script->name())), |
| 2467 v8::Integer::New(script->line_offset()->value()), |
| 2468 v8::Integer::New(script->column_offset()->value())); |
| 2469 return origin; |
| 2470 } |
| 2471 return v8::ScriptOrigin(Handle<Value>()); |
| 2472 } |
| 2473 |
| 2474 |
| 2475 const int Function::kLineOffsetNotFound = -1; |
| 2476 |
| 2477 |
| 2478 int Function::GetScriptLineNumber() const { |
| 2479 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 2480 if (func->shared()->script()->IsScript()) { |
| 2481 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 2482 return i::GetScriptLineNumber(script, func->shared()->start_position()); |
| 2483 } |
| 2484 return kLineOffsetNotFound; |
| 2485 } |
| 2486 |
| 2487 |
2461 int String::Length() const { | 2488 int String::Length() const { |
2462 if (IsDeadCheck("v8::String::Length()")) return 0; | 2489 if (IsDeadCheck("v8::String::Length()")) return 0; |
2463 return Utils::OpenHandle(this)->length(); | 2490 return Utils::OpenHandle(this)->length(); |
2464 } | 2491 } |
2465 | 2492 |
2466 | 2493 |
2467 int String::Utf8Length() const { | 2494 int String::Utf8Length() const { |
2468 if (IsDeadCheck("v8::String::Utf8Length()")) return 0; | 2495 if (IsDeadCheck("v8::String::Utf8Length()")) return 0; |
2469 return Utils::OpenHandle(this)->Utf8Length(); | 2496 return Utils::OpenHandle(this)->Utf8Length(); |
2470 } | 2497 } |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3839 | 3866 |
3840 | 3867 |
3841 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 3868 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
3842 HandleScopeImplementer* thread_local = | 3869 HandleScopeImplementer* thread_local = |
3843 reinterpret_cast<HandleScopeImplementer*>(storage); | 3870 reinterpret_cast<HandleScopeImplementer*>(storage); |
3844 thread_local->IterateThis(v); | 3871 thread_local->IterateThis(v); |
3845 return storage + ArchiveSpacePerThread(); | 3872 return storage + ArchiveSpacePerThread(); |
3846 } | 3873 } |
3847 | 3874 |
3848 } } // namespace v8::internal | 3875 } } // namespace v8::internal |
OLD | NEW |